diff --git a/client/src/lib.rs b/client/src/lib.rs index 493a2717db..cca7a0d6a6 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -902,10 +902,10 @@ impl Client { }, _ => { if let InventoryUpdateEvent::Collected(item) = event { - frontend_events.push(Event::Chat { + frontend_events.push(Event::Chat(comp::ChatMsg { message: format!("Picked up {}", item.name()), - chat_type: ChatType::Meta, - }); + chat_type: comp::ChatType::Meta, + })); } self.state.write_component(self.entity, inventory); @@ -1088,6 +1088,7 @@ impl Client { // NPCs can't talk. Should be filtered by hud/mod.rs for voxygen and should be filtered // by server (due to not having a Pos) for chat-cli comp::ChatType::Npc(_uid, _r) => "".to_string(), + comp::ChatType::Meta => message.to_string(), } } } diff --git a/common/src/comp/chat.rs b/common/src/comp/chat.rs index 1da7e3c8a5..c53d85df4c 100644 --- a/common/src/comp/chat.rs +++ b/common/src/comp/chat.rs @@ -79,6 +79,8 @@ pub enum ChatType { /// /// The u16 field is a random number for selecting localization variants. Npc(Uid, u16), + /// Anything else + Meta, } impl ChatType { @@ -142,6 +144,7 @@ impl ChatMsg { ChatType::Region(_u) => SpeechBubbleType::Region, ChatType::World(_u) => SpeechBubbleType::World, ChatType::Npc(_u, _r) => SpeechBubbleType::None, + ChatType::Meta => SpeechBubbleType::None, } } @@ -161,6 +164,7 @@ impl ChatMsg { ChatType::Region(u) => Some(*u), ChatType::World(u) => Some(*u), ChatType::Npc(u, _r) => Some(*u), + ChatType::Meta => None, } } } diff --git a/server/src/state_ext.rs b/server/src/state_ext.rs index 47332fe7ec..9566c083fe 100644 --- a/server/src/state_ext.rs +++ b/server/src/state_ext.rs @@ -247,6 +247,7 @@ impl StateExt for State { | comp::ChatType::CommandInfo | comp::ChatType::CommandError | comp::ChatType::Kill + | comp::ChatType::Meta | comp::ChatType::World(_) => { self.notify_registered_clients(ServerMsg::ChatMsg(msg.clone())) }, diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index 99fc644ab2..9e2cd3fc5f 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -489,5 +489,6 @@ fn render_chat_line(chat_type: &ChatType, imgs: &Imgs) -> (Color, conrod_core::i ChatType::Region(_uid) => (REGION_COLOR, imgs.chat_region_small), ChatType::World(_uid) => (WORLD_COLOR, imgs.chat_world_small), ChatType::Npc(_uid, _r) => panic!("NPCs can't talk"), // Should be filtered by hud/mod.rs + ChatType::Meta => (INFO_COLOR, imgs.chat_command_info_small), } }