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
13cbef7865
commit
f73b5b2fcb
@ -1079,6 +1079,11 @@ fn handle_level(server: &mut Server, entity: EcsEntity, args: String, action: &C
|
||||
Ok(player) => {
|
||||
if let Some(stats) = ecs.write_storage::<comp::Stats>().get_mut(player) {
|
||||
stats.level.set_level(lvl);
|
||||
|
||||
stats.update_max_hp();
|
||||
stats
|
||||
.health
|
||||
.set_to(stats.health.maximum(), comp::HealthSource::LevelUp);
|
||||
} else {
|
||||
error_msg = Some(ServerMsg::private(String::from("Player has no stats!")));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user