Don't display commands that the player cannot use.

This commit is contained in:
soruh
2019-10-21 18:36:35 +02:00
parent baf04e75d9
commit db69bf23b8

View File

@ -516,13 +516,14 @@ fn handle_build(server: &mut Server, entity: EcsEntity, _args: String, _action:
} }
} }
// TODO: Don't display commands that the player cannot use.
fn handle_help(server: &mut Server, entity: EcsEntity, _args: String, _action: &ChatCommand) { fn handle_help(server: &mut Server, entity: EcsEntity, _args: String, _action: &ChatCommand) {
for cmd in CHAT_COMMANDS.iter() { for cmd in CHAT_COMMANDS.iter() {
if !cmd.needs_admin || server.entity_is_admin(entity) {
server server
.clients .clients
.notify(entity, ServerMsg::private(String::from(cmd.help_string))); .notify(entity, ServerMsg::private(String::from(cmd.help_string)));
} }
}
} }
fn alignment_to_agent(alignment: &str, target: EcsEntity) -> Option<comp::Agent> { fn alignment_to_agent(alignment: &str, target: EcsEntity) -> Option<comp::Agent> {