mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
/sudo player /kill
now lists the sudoer as killing the target
This commit is contained in:
parent
bbbe03a033
commit
29fd45eb52
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user