/sudo player /kill now lists the sudoer as killing the target

This commit is contained in:
CapsizeGlimmer 2020-04-24 12:17:56 -04:00
parent bbbe03a033
commit 29fd45eb52

View File

@ -353,17 +353,26 @@ fn handle_goto(
fn handle_kill(
server: &mut Server,
_client: EcsEntity,
client: EcsEntity,
target: EcsEntity,
_args: String,
_action: &ChatCommand,
) {
let reason = if client == target {
comp::HealthSource::Suicide
} else {
if let Some(uid) = server.state.read_storage::<Uid>().get(client) {
comp::HealthSource::Attack { by: *uid }
} else {
comp::HealthSource::Command
}
};
server
.state
.ecs_mut()
.write_storage::<comp::Stats>()
.get_mut(target)
.map(|s| s.health.set_to(0, comp::HealthSource::Suicide));
.map(|s| s.health.set_to(0, reason));
}
fn handle_time(