mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Moved sfx from common to voxygen
This commit is contained in:
@ -21,7 +21,6 @@ use common::{
|
|||||||
self, ControlAction, ControlEvent, Controller, ControllerInputs, InventoryManip,
|
self, ControlAction, ControlEvent, Controller, ControllerInputs, InventoryManip,
|
||||||
InventoryUpdateEvent,
|
InventoryUpdateEvent,
|
||||||
},
|
},
|
||||||
event::{EventBus, SfxEvent, SfxEventItem},
|
|
||||||
msg::{
|
msg::{
|
||||||
validate_chat_msg, ChatMsgValidationError, ClientMsg, ClientState, Notification,
|
validate_chat_msg, ChatMsgValidationError, ClientMsg, ClientState, Notification,
|
||||||
PlayerInfo, PlayerListUpdate, RegisterError, RequestStateError, ServerInfo, ServerMsg,
|
PlayerInfo, PlayerListUpdate, RegisterError, RequestStateError, ServerInfo, ServerMsg,
|
||||||
@ -57,6 +56,7 @@ pub enum Event {
|
|||||||
Chat(comp::ChatMsg),
|
Chat(comp::ChatMsg),
|
||||||
Disconnect,
|
Disconnect,
|
||||||
DisconnectionNotification(u64),
|
DisconnectionNotification(u64),
|
||||||
|
InventoryUpdated(InventoryUpdateEvent),
|
||||||
Notification(Notification),
|
Notification(Notification),
|
||||||
SetViewDistance(u32),
|
SetViewDistance(u32),
|
||||||
}
|
}
|
||||||
@ -883,34 +883,15 @@ impl Client {
|
|||||||
self.clean_state();
|
self.clean_state();
|
||||||
},
|
},
|
||||||
ServerMsg::InventoryUpdate(inventory, event) => {
|
ServerMsg::InventoryUpdate(inventory, event) => {
|
||||||
// TODO: Move this SFX code to Voxygen
|
|
||||||
let sfx_event = SfxEvent::from(&event);
|
|
||||||
self.state
|
|
||||||
.ecs()
|
|
||||||
.read_resource::<EventBus<SfxEventItem>>()
|
|
||||||
.emit_now(SfxEventItem::at_player_position(sfx_event));
|
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
InventoryUpdateEvent::CollectFailed => {
|
InventoryUpdateEvent::CollectFailed => {},
|
||||||
// TODO This might not be the best way to show an error
|
|
||||||
frontend_events.push(Event::Chat(comp::ChatMsg {
|
|
||||||
message: String::from(
|
|
||||||
"Failed to collect item. Your inventory may be full!",
|
|
||||||
),
|
|
||||||
chat_type: comp::ChatType::CommandError,
|
|
||||||
}))
|
|
||||||
},
|
|
||||||
_ => {
|
_ => {
|
||||||
if let InventoryUpdateEvent::Collected(item) = event {
|
// Push the updated inventory component to the client
|
||||||
frontend_events.push(Event::Chat(comp::ChatMsg {
|
|
||||||
message: format!("Picked up {}", item.name()),
|
|
||||||
chat_type: comp::ChatType::Meta,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
self.state.write_component(self.entity, inventory);
|
self.state.write_component(self.entity, inventory);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frontend_events.push(Event::InventoryUpdated(event));
|
||||||
},
|
},
|
||||||
ServerMsg::TerrainChunkUpdate { key, chunk } => {
|
ServerMsg::TerrainChunkUpdate { key, chunk } => {
|
||||||
if let Ok(chunk) = chunk {
|
if let Ok(chunk) = chunk {
|
||||||
|
@ -1,95 +1,10 @@
|
|||||||
use crate::{
|
use crate::{comp, sync::Uid, util::Dir};
|
||||||
comp,
|
use comp::item::Item;
|
||||||
comp::item::{Consumable, ItemKind},
|
|
||||||
sync::Uid,
|
|
||||||
util::Dir,
|
|
||||||
};
|
|
||||||
use comp::{item::ToolCategory, CharacterAbilityType, InventoryUpdateEvent, Item};
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use serde::Deserialize;
|
|
||||||
use specs::Entity as EcsEntity;
|
use specs::Entity as EcsEntity;
|
||||||
use std::{collections::VecDeque, convert::TryFrom, ops::DerefMut};
|
use std::{collections::VecDeque, ops::DerefMut};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
pub struct SfxEventItem {
|
|
||||||
pub sfx: SfxEvent,
|
|
||||||
pub pos: Option<Vec3<f32>>,
|
|
||||||
pub vol: Option<f32>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SfxEventItem {
|
|
||||||
pub fn new(sfx: SfxEvent, pos: Option<Vec3<f32>>, vol: Option<f32>) -> Self {
|
|
||||||
Self { sfx, pos, vol }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn at_player_position(sfx: SfxEvent) -> Self {
|
|
||||||
Self {
|
|
||||||
sfx,
|
|
||||||
pos: None,
|
|
||||||
vol: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
|
|
||||||
pub enum SfxEvent {
|
|
||||||
Idle,
|
|
||||||
Run,
|
|
||||||
Roll,
|
|
||||||
Climb,
|
|
||||||
GliderOpen,
|
|
||||||
Glide,
|
|
||||||
GliderClose,
|
|
||||||
Jump,
|
|
||||||
Fall,
|
|
||||||
ExperienceGained,
|
|
||||||
LevelUp,
|
|
||||||
Attack(CharacterAbilityType, ToolCategory),
|
|
||||||
Wield(ToolCategory),
|
|
||||||
Unwield(ToolCategory),
|
|
||||||
Inventory(SfxInventoryEvent),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
|
|
||||||
pub enum SfxInventoryEvent {
|
|
||||||
Collected,
|
|
||||||
CollectedTool(ToolCategory),
|
|
||||||
CollectFailed,
|
|
||||||
Consumed(Consumable),
|
|
||||||
Debug,
|
|
||||||
Dropped,
|
|
||||||
Given,
|
|
||||||
Swapped,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<&InventoryUpdateEvent> for SfxEvent {
|
|
||||||
fn from(value: &InventoryUpdateEvent) -> Self {
|
|
||||||
match value {
|
|
||||||
InventoryUpdateEvent::Collected(item) => {
|
|
||||||
// Handle sound effects for types of collected items, falling back to the
|
|
||||||
// default Collected event
|
|
||||||
match item.kind {
|
|
||||||
ItemKind::Tool(tool) => SfxEvent::Inventory(SfxInventoryEvent::CollectedTool(
|
|
||||||
ToolCategory::try_from(tool.kind).unwrap(),
|
|
||||||
)),
|
|
||||||
_ => SfxEvent::Inventory(SfxInventoryEvent::Collected),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
InventoryUpdateEvent::CollectFailed => {
|
|
||||||
SfxEvent::Inventory(SfxInventoryEvent::CollectFailed)
|
|
||||||
},
|
|
||||||
InventoryUpdateEvent::Consumed(consumable) => {
|
|
||||||
SfxEvent::Inventory(SfxInventoryEvent::Consumed(*consumable))
|
|
||||||
},
|
|
||||||
InventoryUpdateEvent::Debug => SfxEvent::Inventory(SfxInventoryEvent::Debug),
|
|
||||||
InventoryUpdateEvent::Dropped => SfxEvent::Inventory(SfxInventoryEvent::Dropped),
|
|
||||||
InventoryUpdateEvent::Given => SfxEvent::Inventory(SfxInventoryEvent::Given),
|
|
||||||
InventoryUpdateEvent::Swapped => SfxEvent::Inventory(SfxInventoryEvent::Swapped),
|
|
||||||
_ => SfxEvent::Inventory(SfxInventoryEvent::Swapped),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum LocalEvent {
|
pub enum LocalEvent {
|
||||||
/// Applies upward force to entity's `Vel`
|
/// Applies upward force to entity's `Vel`
|
||||||
Jump(EcsEntity),
|
Jump(EcsEntity),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp,
|
comp,
|
||||||
event::{EventBus, LocalEvent, ServerEvent, SfxEventItem},
|
event::{EventBus, LocalEvent, ServerEvent},
|
||||||
region::RegionMap,
|
region::RegionMap,
|
||||||
sync::WorldSyncExt,
|
sync::WorldSyncExt,
|
||||||
sys,
|
sys,
|
||||||
@ -170,7 +170,6 @@ impl State {
|
|||||||
// TODO: only register on the server
|
// TODO: only register on the server
|
||||||
ecs.insert(EventBus::<ServerEvent>::default());
|
ecs.insert(EventBus::<ServerEvent>::default());
|
||||||
ecs.insert(EventBus::<LocalEvent>::default());
|
ecs.insert(EventBus::<LocalEvent>::default());
|
||||||
ecs.insert(EventBus::<SfxEventItem>::default());
|
|
||||||
ecs.insert(RegionMap::new());
|
ecs.insert(RegionMap::new());
|
||||||
|
|
||||||
ecs
|
ecs
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// EventMapper::Combat watches the combat states of surrounding entities' and
|
/// EventMapper::Combat watches the combat states of surrounding entities' and
|
||||||
/// emits sfx related to weapons and attacks/abilities
|
/// emits sfx related to weapons and attacks/abilities
|
||||||
use crate::audio::sfx::{SfxTriggerItem, SfxTriggers, SFX_DIST_LIMIT_SQR};
|
use crate::audio::sfx::{SfxEvent, SfxEventItem, SfxTriggerItem, SfxTriggers, SFX_DIST_LIMIT_SQR};
|
||||||
|
|
||||||
use super::EventMapper;
|
use super::EventMapper;
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ use common::{
|
|||||||
item::{Item, ItemKind, ToolCategory},
|
item::{Item, ItemKind, ToolCategory},
|
||||||
CharacterAbilityType, CharacterState, ItemConfig, Loadout, Pos,
|
CharacterAbilityType, CharacterState, ItemConfig, Loadout, Pos,
|
||||||
},
|
},
|
||||||
event::{EventBus, SfxEvent, SfxEventItem},
|
event::EventBus,
|
||||||
state::State,
|
state::State,
|
||||||
};
|
};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::audio::sfx::SfxEvent;
|
||||||
use common::{
|
use common::{
|
||||||
assets,
|
assets,
|
||||||
comp::{item::tool::ToolCategory, CharacterAbilityType, CharacterState, ItemConfig, Loadout},
|
comp::{item::tool::ToolCategory, CharacterAbilityType, CharacterState, ItemConfig, Loadout},
|
||||||
event::SfxEvent,
|
|
||||||
states,
|
states,
|
||||||
};
|
};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
@ -2,11 +2,10 @@
|
|||||||
/// and triggers sfx related to running, climbing and gliding, at a volume
|
/// and triggers sfx related to running, climbing and gliding, at a volume
|
||||||
/// proportionate to the extity's size
|
/// proportionate to the extity's size
|
||||||
use super::EventMapper;
|
use super::EventMapper;
|
||||||
|
use crate::audio::sfx::{SfxEvent, SfxEventItem, SfxTriggerItem, SfxTriggers, SFX_DIST_LIMIT_SQR};
|
||||||
use crate::audio::sfx::{SfxTriggerItem, SfxTriggers, SFX_DIST_LIMIT_SQR};
|
|
||||||
use common::{
|
use common::{
|
||||||
comp::{Body, CharacterState, PhysicsState, Pos, Vel},
|
comp::{Body, CharacterState, PhysicsState, Pos, Vel},
|
||||||
event::{EventBus, SfxEvent, SfxEventItem},
|
event::EventBus,
|
||||||
state::State,
|
state::State,
|
||||||
};
|
};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::audio::sfx::SfxEvent;
|
||||||
use common::{
|
use common::{
|
||||||
comp::{
|
comp::{
|
||||||
bird_small, humanoid, quadruped_medium, quadruped_small, Body, CharacterState, PhysicsState,
|
bird_small, humanoid, quadruped_medium, quadruped_small, Body, CharacterState, PhysicsState,
|
||||||
},
|
},
|
||||||
event::SfxEvent,
|
|
||||||
states,
|
states,
|
||||||
};
|
};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
@ -2,13 +2,9 @@
|
|||||||
/// and triggers sfx for gaining experience and levelling up
|
/// and triggers sfx for gaining experience and levelling up
|
||||||
use super::EventMapper;
|
use super::EventMapper;
|
||||||
|
|
||||||
use crate::audio::sfx::SfxTriggers;
|
use crate::audio::sfx::{SfxEvent, SfxEventItem, SfxTriggers};
|
||||||
|
|
||||||
use common::{
|
use common::{comp::Stats, event::EventBus, state::State};
|
||||||
comp::Stats,
|
|
||||||
event::{EventBus, SfxEvent, SfxEventItem},
|
|
||||||
state::State,
|
|
||||||
};
|
|
||||||
use specs::WorldExt;
|
use specs::WorldExt;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone, PartialEq)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use common::event::SfxEvent;
|
use crate::audio::sfx::SfxEvent;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_change_returns_none() {
|
fn no_change_returns_none() {
|
||||||
|
@ -84,16 +84,21 @@
|
|||||||
mod event_mapper;
|
mod event_mapper;
|
||||||
|
|
||||||
use crate::audio::AudioFrontend;
|
use crate::audio::AudioFrontend;
|
||||||
|
|
||||||
use common::{
|
use common::{
|
||||||
assets,
|
assets,
|
||||||
comp::{Ori, Pos},
|
comp::{
|
||||||
event::{EventBus, SfxEvent, SfxEventItem},
|
item::{Consumable, ItemKind, ToolCategory},
|
||||||
|
CharacterAbilityType, InventoryUpdateEvent, Ori, Pos,
|
||||||
|
},
|
||||||
|
event::EventBus,
|
||||||
state::State,
|
state::State,
|
||||||
};
|
};
|
||||||
use event_mapper::SfxEventMapper;
|
use event_mapper::SfxEventMapper;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use specs::WorldExt;
|
use specs::WorldExt;
|
||||||
|
use std::convert::TryFrom;
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
@ -104,6 +109,85 @@ use vek::*;
|
|||||||
/// player.
|
/// player.
|
||||||
const SFX_DIST_LIMIT_SQR: f32 = 20000.0;
|
const SFX_DIST_LIMIT_SQR: f32 = 20000.0;
|
||||||
|
|
||||||
|
pub struct SfxEventItem {
|
||||||
|
pub sfx: SfxEvent,
|
||||||
|
pub pos: Option<Vec3<f32>>,
|
||||||
|
pub vol: Option<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SfxEventItem {
|
||||||
|
pub fn new(sfx: SfxEvent, pos: Option<Vec3<f32>>, vol: Option<f32>) -> Self {
|
||||||
|
Self { sfx, pos, vol }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn at_player_position(sfx: SfxEvent) -> Self {
|
||||||
|
Self {
|
||||||
|
sfx,
|
||||||
|
pos: None,
|
||||||
|
vol: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
|
||||||
|
pub enum SfxEvent {
|
||||||
|
Idle,
|
||||||
|
Run,
|
||||||
|
Roll,
|
||||||
|
Climb,
|
||||||
|
GliderOpen,
|
||||||
|
Glide,
|
||||||
|
GliderClose,
|
||||||
|
Jump,
|
||||||
|
Fall,
|
||||||
|
ExperienceGained,
|
||||||
|
LevelUp,
|
||||||
|
Attack(CharacterAbilityType, ToolCategory),
|
||||||
|
Wield(ToolCategory),
|
||||||
|
Unwield(ToolCategory),
|
||||||
|
Inventory(SfxInventoryEvent),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
|
||||||
|
pub enum SfxInventoryEvent {
|
||||||
|
Collected,
|
||||||
|
CollectedTool(ToolCategory),
|
||||||
|
CollectFailed,
|
||||||
|
Consumed(Consumable),
|
||||||
|
Debug,
|
||||||
|
Dropped,
|
||||||
|
Given,
|
||||||
|
Swapped,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&InventoryUpdateEvent> for SfxEvent {
|
||||||
|
fn from(value: &InventoryUpdateEvent) -> Self {
|
||||||
|
match value {
|
||||||
|
InventoryUpdateEvent::Collected(item) => {
|
||||||
|
// Handle sound effects for types of collected items, falling back to the
|
||||||
|
// default Collected event
|
||||||
|
match item.kind {
|
||||||
|
ItemKind::Tool(tool) => SfxEvent::Inventory(SfxInventoryEvent::CollectedTool(
|
||||||
|
ToolCategory::try_from(tool.kind).unwrap(),
|
||||||
|
)),
|
||||||
|
_ => SfxEvent::Inventory(SfxInventoryEvent::Collected),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
InventoryUpdateEvent::CollectFailed => {
|
||||||
|
SfxEvent::Inventory(SfxInventoryEvent::CollectFailed)
|
||||||
|
},
|
||||||
|
InventoryUpdateEvent::Consumed(consumable) => {
|
||||||
|
SfxEvent::Inventory(SfxInventoryEvent::Consumed(*consumable))
|
||||||
|
},
|
||||||
|
InventoryUpdateEvent::Debug => SfxEvent::Inventory(SfxInventoryEvent::Debug),
|
||||||
|
InventoryUpdateEvent::Dropped => SfxEvent::Inventory(SfxInventoryEvent::Dropped),
|
||||||
|
InventoryUpdateEvent::Given => SfxEvent::Inventory(SfxInventoryEvent::Given),
|
||||||
|
InventoryUpdateEvent::Swapped => SfxEvent::Inventory(SfxInventoryEvent::Swapped),
|
||||||
|
_ => SfxEvent::Inventory(SfxInventoryEvent::Swapped),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct SfxTriggerItem {
|
pub struct SfxTriggerItem {
|
||||||
pub files: Vec<String>,
|
pub files: Vec<String>,
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
pub mod comp;
|
pub mod comp;
|
||||||
pub mod sys;
|
pub mod sys;
|
||||||
|
|
||||||
|
use crate::audio::sfx::SfxEventItem;
|
||||||
|
use common::event::EventBus;
|
||||||
use specs::{Entity, World, WorldExt};
|
use specs::{Entity, World, WorldExt};
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
@ -25,4 +27,7 @@ pub fn init(world: &mut World) {
|
|||||||
world.register::<comp::HpFloaterList>();
|
world.register::<comp::HpFloaterList>();
|
||||||
world.register::<comp::Interpolated>();
|
world.register::<comp::Interpolated>();
|
||||||
world.insert(MyExpFloaterList::default());
|
world.insert(MyExpFloaterList::default());
|
||||||
|
|
||||||
|
// Voxygen event buses
|
||||||
|
world.insert(EventBus::<SfxEventItem>::default());
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
|
audio::sfx::{SfxEvent, SfxEventItem},
|
||||||
ecs::MyEntity,
|
ecs::MyEntity,
|
||||||
hud::{DebugInfo, Event as HudEvent, Hud, HudInfo, PressBehavior},
|
hud::{DebugInfo, Event as HudEvent, Hud, HudInfo, PressBehavior},
|
||||||
i18n::{i18n_asset_key, VoxygenLocalization},
|
i18n::{i18n_asset_key, VoxygenLocalization},
|
||||||
@ -14,7 +15,8 @@ use common::{
|
|||||||
assets::{load_watched, watch},
|
assets::{load_watched, watch},
|
||||||
clock::Clock,
|
clock::Clock,
|
||||||
comp,
|
comp,
|
||||||
comp::{Pos, Vel, MAX_PICKUP_RANGE_SQR},
|
comp::{ChatMsg, ChatType, InventoryUpdateEvent, Pos, Vel, MAX_PICKUP_RANGE_SQR},
|
||||||
|
event::EventBus,
|
||||||
msg::ClientState,
|
msg::ClientState,
|
||||||
terrain::{Block, BlockKind},
|
terrain::{Block, BlockKind},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
@ -83,6 +85,32 @@ impl SessionState {
|
|||||||
client::Event::Chat(m) => {
|
client::Event::Chat(m) => {
|
||||||
self.hud.new_message(m);
|
self.hud.new_message(m);
|
||||||
},
|
},
|
||||||
|
client::Event::InventoryUpdated(inv_event) => {
|
||||||
|
let sfx_event = SfxEvent::from(&inv_event);
|
||||||
|
client
|
||||||
|
.state()
|
||||||
|
.ecs()
|
||||||
|
.read_resource::<EventBus<SfxEventItem>>()
|
||||||
|
.emit_now(SfxEventItem::at_player_position(sfx_event));
|
||||||
|
|
||||||
|
match inv_event {
|
||||||
|
InventoryUpdateEvent::CollectFailed => {
|
||||||
|
self.hud.new_message(ChatMsg {
|
||||||
|
message: String::from(
|
||||||
|
"Failed to collect item. Your inventory may be full!",
|
||||||
|
),
|
||||||
|
chat_type: ChatType::CommandError,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
InventoryUpdateEvent::Collected(item) => {
|
||||||
|
self.hud.new_message(ChatMsg {
|
||||||
|
message: format!("Picked up {}", item.name()),
|
||||||
|
chat_type: ChatType::CommandInfo,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
};
|
||||||
|
},
|
||||||
client::Event::Disconnect => return Ok(TickAction::Disconnect),
|
client::Event::Disconnect => return Ok(TickAction::Disconnect),
|
||||||
client::Event::DisconnectionNotification(time) => {
|
client::Event::DisconnectionNotification(time) => {
|
||||||
let message = match time {
|
let message = match time {
|
||||||
@ -90,8 +118,8 @@ impl SessionState {
|
|||||||
_ => format!("Connection lost. Kicking in {} seconds", time),
|
_ => format!("Connection lost. Kicking in {} seconds", time),
|
||||||
};
|
};
|
||||||
|
|
||||||
self.hud.new_message(comp::ChatMsg {
|
self.hud.new_message(ChatMsg {
|
||||||
chat_type: comp::ChatType::CommandError,
|
chat_type: ChatType::CommandError,
|
||||||
message,
|
message,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user