Merge branch 'shandley/level-up-command-hp' into 'master'

Update max hp after using the set_level command

Closes #496

See merge request veloren/veloren!816
This commit is contained in:
Forest Anderson 2020-02-23 00:41:51 +00:00
commit 5bad014ae2

View File

@ -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!")));
}