mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Update max hp and refill health when a player uses the set_level command.
This commit is contained in:
parent
b9391d2337
commit
b13e6d0e3b
@ -1079,6 +1079,11 @@ fn handle_level(server: &mut Server, entity: EcsEntity, args: String, action: &C
|
|||||||
Ok(player) => {
|
Ok(player) => {
|
||||||
if let Some(stats) = ecs.write_storage::<comp::Stats>().get_mut(player) {
|
if let Some(stats) = ecs.write_storage::<comp::Stats>().get_mut(player) {
|
||||||
stats.level.set_level(lvl);
|
stats.level.set_level(lvl);
|
||||||
|
|
||||||
|
stats.update_max_hp();
|
||||||
|
stats
|
||||||
|
.health
|
||||||
|
.set_to(stats.health.maximum(), comp::HealthSource::LevelUp);
|
||||||
} else {
|
} else {
|
||||||
error_msg = Some(ServerMsg::private(String::from("Player has no stats!")));
|
error_msg = Some(ServerMsg::private(String::from("Player has no stats!")));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user