mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Renamed command event
This commit is contained in:
parent
0067cea560
commit
294b6e394a
@ -140,7 +140,7 @@ pub enum ServerEvent {
|
||||
ClientDisconnect(EcsEntity, DisconnectReason),
|
||||
ClientDisconnectWithoutPersistence(EcsEntity),
|
||||
ChunkRequest(EcsEntity, Vec2<i32>),
|
||||
ChatCmd(EcsEntity, String, Vec<String>),
|
||||
Command(EcsEntity, String, Vec<String>),
|
||||
/// Send a chat message to the player from an npc or other player
|
||||
Chat(comp::UnresolvedChatMsg),
|
||||
Aura {
|
||||
|
@ -51,7 +51,7 @@ impl Server {
|
||||
let mut frontend_events = Vec::new();
|
||||
|
||||
let mut requested_chunks = Vec::new();
|
||||
let mut chat_commands = Vec::new();
|
||||
let mut commands = Vec::new();
|
||||
let mut chat_messages = Vec::new();
|
||||
|
||||
let events = self
|
||||
@ -188,8 +188,8 @@ impl Server {
|
||||
ServerEvent::ChunkRequest(entity, key) => {
|
||||
requested_chunks.push((entity, key));
|
||||
},
|
||||
ServerEvent::ChatCmd(entity, name, args) => {
|
||||
chat_commands.push((entity, name, args));
|
||||
ServerEvent::Command(entity, name, args) => {
|
||||
commands.push((entity, name, args));
|
||||
},
|
||||
ServerEvent::Chat(msg) => {
|
||||
chat_messages.push(msg);
|
||||
@ -229,8 +229,8 @@ impl Server {
|
||||
self.generate_chunk(entity, key);
|
||||
}
|
||||
|
||||
for (entity, name, args) in chat_commands {
|
||||
self.process_chat_cmd(entity, name, args);
|
||||
for (entity, name, args) in commands {
|
||||
self.process_command(entity, name, args);
|
||||
}
|
||||
|
||||
for msg in chat_messages {
|
||||
|
@ -983,7 +983,7 @@ impl Server {
|
||||
);
|
||||
}
|
||||
|
||||
fn process_chat_cmd(&mut self, entity: EcsEntity, name: String, args: Vec<String>) {
|
||||
fn process_command(&mut self, entity: EcsEntity, name: String, args: Vec<String>) {
|
||||
// Find the command object and run its handler.
|
||||
if let Ok(command) = name.parse::<ChatCommand>() {
|
||||
command.execute(self, entity, args);
|
||||
|
@ -49,7 +49,7 @@ impl Sys {
|
||||
},
|
||||
ClientGeneral::Command(name, args) => {
|
||||
if player.is_some() {
|
||||
server_emitter.emit(ServerEvent::ChatCmd(entity, name, args));
|
||||
server_emitter.emit(ServerEvent::Command(entity, name, args));
|
||||
}
|
||||
},
|
||||
ClientGeneral::Terminate => {
|
||||
|
Loading…
Reference in New Issue
Block a user