diff --git a/server/src/cmd.rs b/server/src/cmd.rs index b31ed2ee28..48ee5f0236 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -75,6 +75,12 @@ lazy_static! { "/tp : Teleport to another player", handle_tp ), + ChatCommand::new( + "kill", + "{}", + "/kill : Kill yourself", + handle_kill + ), ChatCommand::new( "pet", "{}", @@ -132,6 +138,12 @@ fn handle_goto(server: &mut Server, entity: EcsEntity, args: String, action: &Ch } } +fn handle_kill(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) { + server + .state + .write_component::(entity, comp::Dying) +} + fn handle_alias(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) { let opt_alias = scan_fmt!(&args, action.arg_fmt, String); match opt_alias {