From d02c61ad8a47cc8e20cb5eb7fc7227b161390bd6 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 1 Mar 2021 17:40:42 -0500 Subject: [PATCH] Item use is now goes through a control action rather than a control event. --- client/src/lib.rs | 51 ++++++++++++---------------- common/src/comp/controller.rs | 46 ++++++++++++------------- common/src/comp/mod.rs | 2 +- common/src/event.rs | 2 +- common/src/states/behavior.rs | 10 +++--- common/src/states/dance.rs | 6 ++-- common/src/states/glide_wield.rs | 6 ++-- common/src/states/idle.rs | 6 ++-- common/src/states/sit.rs | 6 ++-- common/src/states/sneak.rs | 6 ++-- common/src/states/talk.rs | 6 ++-- common/src/states/utils.rs | 11 +++--- common/src/states/wielding.rs | 14 ++++---- common/sys/src/controller.rs | 4 +-- server/src/events/inventory_manip.rs | 25 +++++--------- 15 files changed, 91 insertions(+), 110 deletions(-) diff --git a/client/src/lib.rs b/client/src/lib.rs index d181381543..bacc5d2e83 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -27,7 +27,7 @@ use common::{ skills::Skill, slot::Slot, ChatMode, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, - InventoryManip, InventoryUpdateEvent, LoadoutManip, + InventoryAction, InventoryEvent, InventoryUpdateEvent, }, event::{EventBus, LocalEvent}, grid::Grid, @@ -621,24 +621,17 @@ impl Client { } pub fn use_slot(&mut self, slot: Slot) { - match slot { - Slot::Equip(equip) => { - self.control_action(ControlAction::LoadoutManip(LoadoutManip::Use(equip))) - }, - Slot::Inventory(inv) => self.send_msg(ClientGeneral::ControlEvent( - ControlEvent::InventoryManip(InventoryManip::Use(inv)), - )), - } + self.control_action(ControlAction::InventoryAction(InventoryAction::Use(slot))) } pub fn swap_slots(&mut self, a: Slot, b: Slot) { match (a, b) { - (Slot::Equip(equip), slot) | (slot, Slot::Equip(equip)) => { - self.control_action(ControlAction::LoadoutManip(LoadoutManip::Swap(equip, slot))) - }, + (Slot::Equip(equip), slot) | (slot, Slot::Equip(equip)) => self.control_action( + ControlAction::InventoryAction(InventoryAction::Swap(equip, slot)), + ), (Slot::Inventory(inv1), Slot::Inventory(inv2)) => { - self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryManip( - InventoryManip::Swap(inv1, inv2), + self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryEvent( + InventoryEvent::Swap(inv1, inv2), ))) }, } @@ -647,10 +640,10 @@ impl Client { pub fn drop_slot(&mut self, slot: Slot) { match slot { Slot::Equip(equip) => { - self.control_action(ControlAction::LoadoutManip(LoadoutManip::Drop(equip))) + self.control_action(ControlAction::InventoryAction(InventoryAction::Drop(equip))) }, Slot::Inventory(inv) => self.send_msg(ClientGeneral::ControlEvent( - ControlEvent::InventoryManip(InventoryManip::Drop(inv)), + ControlEvent::InventoryEvent(InventoryEvent::Drop(inv)), )), } } @@ -670,12 +663,12 @@ impl Client { pub fn split_swap_slots(&mut self, a: comp::slot::Slot, b: comp::slot::Slot) { match (a, b) { - (Slot::Equip(equip), slot) | (slot, Slot::Equip(equip)) => { - self.control_action(ControlAction::LoadoutManip(LoadoutManip::Swap(equip, slot))) - }, + (Slot::Equip(equip), slot) | (slot, Slot::Equip(equip)) => self.control_action( + ControlAction::InventoryAction(InventoryAction::Swap(equip, slot)), + ), (Slot::Inventory(inv1), Slot::Inventory(inv2)) => { - self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryManip( - InventoryManip::SplitSwap(inv1, inv2), + self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryEvent( + InventoryEvent::SplitSwap(inv1, inv2), ))) }, } @@ -684,10 +677,10 @@ impl Client { pub fn split_drop_slot(&mut self, slot: comp::slot::Slot) { match slot { Slot::Equip(equip) => { - self.control_action(ControlAction::LoadoutManip(LoadoutManip::Drop(equip))) + self.control_action(ControlAction::InventoryAction(InventoryAction::Drop(equip))) }, Slot::Inventory(inv) => self.send_msg(ClientGeneral::ControlEvent( - ControlEvent::InventoryManip(InventoryManip::SplitDrop(inv)), + ControlEvent::InventoryEvent(InventoryEvent::SplitDrop(inv)), )), } } @@ -701,8 +694,8 @@ impl Client { return; } - self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryManip( - InventoryManip::Pickup(uid), + self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryEvent( + InventoryEvent::Pickup(uid), ))); } } @@ -740,8 +733,8 @@ impl Client { pub fn craft_recipe(&mut self, recipe: &str) -> bool { if self.can_craft_recipe(recipe) { - self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryManip( - InventoryManip::CraftRecipe(recipe.to_string()), + self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryEvent( + InventoryEvent::CraftRecipe(recipe.to_string()), ))); true } else { @@ -1048,8 +1041,8 @@ impl Client { } pub fn collect_block(&mut self, pos: Vec3) { - self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryManip( - InventoryManip::Collect(pos), + self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryEvent( + InventoryEvent::Collect(pos), ))); } diff --git a/common/src/comp/controller.rs b/common/src/comp/controller.rs index 20891432fe..000c13de57 100644 --- a/common/src/comp/controller.rs +++ b/common/src/comp/controller.rs @@ -18,10 +18,9 @@ use vek::*; pub const DEFAULT_HOLD_DURATION: Duration = Duration::from_millis(200); #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum InventoryManip { +pub enum InventoryEvent { Pickup(Uid), Collect(Vec3), - Use(InvSlotId), Swap(InvSlotId, InvSlotId), SplitSwap(InvSlotId, InvSlotId), Drop(InvSlotId), @@ -30,14 +29,14 @@ pub enum InventoryManip { } #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] -pub enum LoadoutManip { - Use(EquipSlot), +pub enum InventoryAction { Swap(EquipSlot, Slot), Drop(EquipSlot), + Use(Slot), } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum SlotManip { +pub enum InventoryManip { Pickup(Uid), Collect(Vec3), Use(Slot), @@ -48,31 +47,30 @@ pub enum SlotManip { CraftRecipe(String), } -impl From for SlotManip { - fn from(loadout_manip: LoadoutManip) -> Self { - match loadout_manip { - LoadoutManip::Use(equip) => Self::Use(Slot::Equip(equip)), - LoadoutManip::Swap(equip, slot) => Self::Swap(Slot::Equip(equip), slot), - LoadoutManip::Drop(equip) => Self::Drop(Slot::Equip(equip)), +impl From for InventoryManip { + fn from(inv_action: InventoryAction) -> Self { + match inv_action { + InventoryAction::Use(slot) => Self::Use(slot), + InventoryAction::Swap(equip, slot) => Self::Swap(Slot::Equip(equip), slot), + InventoryAction::Drop(equip) => Self::Drop(Slot::Equip(equip)), } } } -impl From for SlotManip { - fn from(inv_manip: InventoryManip) -> Self { - match inv_manip { - InventoryManip::Pickup(pickup) => Self::Pickup(pickup), - InventoryManip::Collect(collect) => Self::Collect(collect), - InventoryManip::Use(inv) => Self::Use(Slot::Inventory(inv)), - InventoryManip::Swap(inv1, inv2) => { +impl From for InventoryManip { + fn from(inv_event: InventoryEvent) -> Self { + match inv_event { + InventoryEvent::Pickup(pickup) => Self::Pickup(pickup), + InventoryEvent::Collect(collect) => Self::Collect(collect), + InventoryEvent::Swap(inv1, inv2) => { Self::Swap(Slot::Inventory(inv1), Slot::Inventory(inv2)) }, - InventoryManip::SplitSwap(inv1, inv2) => { + InventoryEvent::SplitSwap(inv1, inv2) => { Self::SplitSwap(Slot::Inventory(inv1), Slot::Inventory(inv2)) }, - InventoryManip::Drop(inv) => Self::Drop(Slot::Inventory(inv)), - InventoryManip::SplitDrop(inv) => Self::SplitDrop(Slot::Inventory(inv)), - InventoryManip::CraftRecipe(recipe) => Self::CraftRecipe(recipe), + InventoryEvent::Drop(inv) => Self::Drop(Slot::Inventory(inv)), + InventoryEvent::SplitDrop(inv) => Self::SplitDrop(Slot::Inventory(inv)), + InventoryEvent::CraftRecipe(recipe) => Self::CraftRecipe(recipe), } } } @@ -95,7 +93,7 @@ pub enum ControlEvent { PerformTradeAction(TradeId, TradeAction), Mount(Uid), Unmount, - InventoryManip(InventoryManip), + InventoryEvent(InventoryEvent), GroupManip(GroupManip), RemoveBuff(BuffKind), Respawn, @@ -104,7 +102,7 @@ pub enum ControlEvent { #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] pub enum ControlAction { SwapEquippedWeapons, - LoadoutManip(LoadoutManip), + InventoryAction(InventoryAction), Wield, GlideWield, Unwield, diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index 8e342cde4e..b2ffefc035 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -62,7 +62,7 @@ pub use self::{ combo::Combo, controller::{ Climb, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, Input, - InventoryManip, LoadoutManip, MountState, Mounting, SlotManip, + InventoryAction, InventoryEvent, InventoryManip, MountState, Mounting, }, energy::{Energy, EnergyChange, EnergySource}, group::Group, diff --git a/common/src/event.rs b/common/src/event.rs index ecf2f784ea..f4b97f95e1 100644 --- a/common/src/event.rs +++ b/common/src/event.rs @@ -54,7 +54,7 @@ pub enum ServerEvent { entity: EcsEntity, cause: comp::HealthSource, }, - InventoryManip(EcsEntity, comp::SlotManip), + InventoryManip(EcsEntity, comp::InventoryManip), GroupManip(EcsEntity, comp::GroupManip), Respawn(EcsEntity), Shoot { diff --git a/common/src/states/behavior.rs b/common/src/states/behavior.rs index f791dd13d1..cbc31ec5de 100644 --- a/common/src/states/behavior.rs +++ b/common/src/states/behavior.rs @@ -1,8 +1,8 @@ use crate::{ comp::{ item::MaterialStatManifest, Beam, Body, CharacterState, Combo, ControlAction, Controller, - ControllerInputs, Energy, Health, Inventory, LoadoutManip, Melee, Ori, PhysicsState, Pos, - StateUpdate, Stats, Vel, + ControllerInputs, Energy, Health, Inventory, InventoryAction, Melee, Ori, PhysicsState, + Pos, StateUpdate, Stats, Vel, }, resources::DeltaTime, uid::Uid, @@ -18,7 +18,7 @@ pub trait CharacterBehavior { fn behavior(&self, data: &JoinData) -> StateUpdate; // Impl these to provide behavior for these inputs fn swap_equipped_weapons(&self, data: &JoinData) -> StateUpdate { StateUpdate::from(data) } - fn manipulate_loadout(&self, data: &JoinData, _loadout_manip: LoadoutManip) -> StateUpdate { + fn manipulate_loadout(&self, data: &JoinData, _inv_action: InventoryAction) -> StateUpdate { StateUpdate::from(data) } fn wield(&self, data: &JoinData) -> StateUpdate { StateUpdate::from(data) } @@ -32,9 +32,7 @@ pub trait CharacterBehavior { fn handle_event(&self, data: &JoinData, event: ControlAction) -> StateUpdate { match event { ControlAction::SwapEquippedWeapons => self.swap_equipped_weapons(data), - ControlAction::LoadoutManip(loadout_manip) => { - self.manipulate_loadout(data, loadout_manip) - }, + ControlAction::InventoryAction(inv_action) => self.manipulate_loadout(data, inv_action), ControlAction::Wield => self.wield(data), ControlAction::GlideWield => self.glide_wield(data), ControlAction::Unwield => self.unwield(data), diff --git a/common/src/states/dance.rs b/common/src/states/dance.rs index d5a039ac1e..2966600bfd 100644 --- a/common/src/states/dance.rs +++ b/common/src/states/dance.rs @@ -1,6 +1,6 @@ use super::utils::*; use crate::{ - comp::{CharacterState, LoadoutManip, StateUpdate}, + comp::{CharacterState, InventoryAction, StateUpdate}, states::behavior::{CharacterBehavior, JoinData}, }; use serde::{Deserialize, Serialize}; @@ -42,9 +42,9 @@ impl CharacterBehavior for Data { update } - fn manipulate_loadout(&self, data: &JoinData, loadout_manip: LoadoutManip) -> StateUpdate { + fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_manipulate_loadout(&data, &mut update, loadout_manip); + handle_manipulate_loadout(&data, &mut update, inv_action); update } } diff --git a/common/src/states/glide_wield.rs b/common/src/states/glide_wield.rs index 2cd42d6313..ffc1568d64 100644 --- a/common/src/states/glide_wield.rs +++ b/common/src/states/glide_wield.rs @@ -1,6 +1,6 @@ use super::utils::*; use crate::{ - comp::{slot::EquipSlot, CharacterState, EnergySource, LoadoutManip, StateUpdate}, + comp::{slot::EquipSlot, CharacterState, EnergySource, InventoryAction, StateUpdate}, states::behavior::{CharacterBehavior, JoinData}, }; @@ -69,9 +69,9 @@ impl CharacterBehavior for Data { update } - fn manipulate_loadout(&self, data: &JoinData, loadout_manip: LoadoutManip) -> StateUpdate { + fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_manipulate_loadout(&data, &mut update, loadout_manip); + handle_manipulate_loadout(&data, &mut update, inv_action); update } } diff --git a/common/src/states/idle.rs b/common/src/states/idle.rs index 7ffa0f351e..a32728844e 100644 --- a/common/src/states/idle.rs +++ b/common/src/states/idle.rs @@ -1,6 +1,6 @@ use super::utils::*; use crate::{ - comp::{LoadoutManip, StateUpdate}, + comp::{InventoryAction, StateUpdate}, states::behavior::{CharacterBehavior, JoinData}, }; @@ -61,9 +61,9 @@ impl CharacterBehavior for Data { update } - fn manipulate_loadout(&self, data: &JoinData, loadout_manip: LoadoutManip) -> StateUpdate { + fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_manipulate_loadout(&data, &mut update, loadout_manip); + handle_manipulate_loadout(&data, &mut update, inv_action); update } } diff --git a/common/src/states/sit.rs b/common/src/states/sit.rs index 07ddbf1eb3..5091e0be45 100644 --- a/common/src/states/sit.rs +++ b/common/src/states/sit.rs @@ -1,6 +1,6 @@ use super::utils::*; use crate::{ - comp::{CharacterState, LoadoutManip, StateUpdate}, + comp::{CharacterState, InventoryAction, StateUpdate}, states::behavior::{CharacterBehavior, JoinData}, }; use serde::{Deserialize, Serialize}; @@ -42,9 +42,9 @@ impl CharacterBehavior for Data { update } - fn manipulate_loadout(&self, data: &JoinData, loadout_manip: LoadoutManip) -> StateUpdate { + fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_manipulate_loadout(&data, &mut update, loadout_manip); + handle_manipulate_loadout(&data, &mut update, inv_action); update } } diff --git a/common/src/states/sneak.rs b/common/src/states/sneak.rs index 4a1b13e444..03fe51772a 100644 --- a/common/src/states/sneak.rs +++ b/common/src/states/sneak.rs @@ -1,6 +1,6 @@ use super::utils::*; use crate::{ - comp::{CharacterState, LoadoutManip, StateUpdate}, + comp::{CharacterState, InventoryAction, StateUpdate}, states::behavior::{CharacterBehavior, JoinData}, }; @@ -60,9 +60,9 @@ impl CharacterBehavior for Data { update } - fn manipulate_loadout(&self, data: &JoinData, loadout_manip: LoadoutManip) -> StateUpdate { + fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_manipulate_loadout(&data, &mut update, loadout_manip); + handle_manipulate_loadout(&data, &mut update, inv_action); update } } diff --git a/common/src/states/talk.rs b/common/src/states/talk.rs index 9519865815..9017ef16e0 100644 --- a/common/src/states/talk.rs +++ b/common/src/states/talk.rs @@ -1,6 +1,6 @@ use super::utils::*; use crate::{ - comp::{CharacterState, LoadoutManip, StateUpdate}, + comp::{CharacterState, InventoryAction, StateUpdate}, states::behavior::{CharacterBehavior, JoinData}, }; use serde::{Deserialize, Serialize}; @@ -47,9 +47,9 @@ impl CharacterBehavior for Data { update } - fn manipulate_loadout(&self, data: &JoinData, loadout_manip: LoadoutManip) -> StateUpdate { + fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_manipulate_loadout(&data, &mut update, loadout_manip); + handle_manipulate_loadout(&data, &mut update, inv_action); update } } diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 032173629d..e2913acbe7 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -5,7 +5,7 @@ use crate::{ item::{Hands, ItemKind, Tool, ToolKind}, quadruped_low, quadruped_medium, quadruped_small, skills::Skill, - theropod, Body, CharacterAbility, CharacterState, LoadoutManip, StateUpdate, + theropod, Body, CharacterAbility, CharacterState, InventoryAction, StateUpdate, }, consts::{FRIC_GROUND, GRAVITY}, event::{LocalEvent, ServerEvent}, @@ -395,12 +395,11 @@ pub fn attempt_swap_equipped_weapons(data: &JoinData, update: &mut StateUpdate) pub fn handle_manipulate_loadout( data: &JoinData, update: &mut StateUpdate, - loadout_manip: LoadoutManip, + inv_action: InventoryAction, ) { - update.server_events.push_front(ServerEvent::InventoryManip( - data.entity, - loadout_manip.into(), - )); + update + .server_events + .push_front(ServerEvent::InventoryManip(data.entity, inv_action.into())); } /// Checks that player can wield the glider and updates `CharacterState` if so diff --git a/common/src/states/wielding.rs b/common/src/states/wielding.rs index dc21ae44d7..d0a67f9ec9 100644 --- a/common/src/states/wielding.rs +++ b/common/src/states/wielding.rs @@ -2,7 +2,7 @@ use super::utils::*; use crate::{ comp::{ slot::{EquipSlot, Slot}, - CharacterState, LoadoutManip, StateUpdate, + CharacterState, InventoryAction, StateUpdate, }, states::behavior::{CharacterBehavior, JoinData}, }; @@ -61,17 +61,17 @@ impl CharacterBehavior for Data { update } - fn manipulate_loadout(&self, data: &JoinData, loadout_manip: LoadoutManip) -> StateUpdate { + fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate { let mut update = StateUpdate::from(data); - match loadout_manip { - LoadoutManip::Drop(EquipSlot::Mainhand) - | LoadoutManip::Swap(EquipSlot::Mainhand, _) - | LoadoutManip::Swap(_, Slot::Equip(EquipSlot::Mainhand)) => { + match inv_action { + InventoryAction::Drop(EquipSlot::Mainhand) + | InventoryAction::Swap(EquipSlot::Mainhand, _) + | InventoryAction::Swap(_, Slot::Equip(EquipSlot::Mainhand)) => { update.character = CharacterState::Idle; }, _ => (), } - handle_manipulate_loadout(&data, &mut update, loadout_manip); + handle_manipulate_loadout(&data, &mut update, inv_action); update } } diff --git a/common/sys/src/controller.rs b/common/sys/src/controller.rs index 9289c5d497..8618c55e97 100644 --- a/common/sys/src/controller.rs +++ b/common/sys/src/controller.rs @@ -93,8 +93,8 @@ impl<'a> System<'a> for Sys { server_emitter .emit(ServerEvent::ProcessTradeAction(entity, trade_id, action)); }, - ControlEvent::InventoryManip(manip) => { - server_emitter.emit(ServerEvent::InventoryManip(entity, manip.into())); + ControlEvent::InventoryEvent(event) => { + server_emitter.emit(ServerEvent::InventoryManip(entity, event.into())); }, ControlEvent::GroupManip(manip) => { server_emitter.emit(ServerEvent::GroupManip(entity, manip)) diff --git a/server/src/events/inventory_manip.rs b/server/src/events/inventory_manip.rs index f73e871503..f1adfee1f9 100644 --- a/server/src/events/inventory_manip.rs +++ b/server/src/events/inventory_manip.rs @@ -39,7 +39,7 @@ pub fn snuff_lantern(storage: &mut WriteStorage, entity: Ecs #[allow(clippy::blocks_in_if_conditions)] #[allow(clippy::same_item_push)] // TODO: Pending review in #587 -pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::SlotManip) { +pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::InventoryManip) { let state = server.state_mut(); let uid = state @@ -76,7 +76,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Slo }; match manip { - comp::SlotManip::Pickup(uid) => { + comp::InventoryManip::Pickup(uid) => { let picked_up_item: Option; let item_entity = if let (Some((item, item_entity)), Some(mut inv)) = ( state @@ -148,8 +148,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Slo state.write_component(entity, event); }, - - comp::SlotManip::Collect(pos) => { + comp::InventoryManip::Collect(pos) => { let block = state.terrain().get(pos).ok().copied(); if let Some(block) = block { @@ -219,8 +218,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Slo } } }, - - comp::SlotManip::Use(slot) => { + comp::InventoryManip::Use(slot) => { let mut inventories = state.ecs().write_storage::(); let mut inventory = if let Some(inventory) = inventories.get_mut(entity) { inventory @@ -423,8 +421,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Slo state.write_component(entity, comp::InventoryUpdate::new(event)); } }, - - comp::SlotManip::Swap(a, b) => { + comp::InventoryManip::Swap(a, b) => { let ecs = state.ecs(); if let Some(pos) = ecs.read_storage::().get(entity) { @@ -458,8 +455,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Slo comp::InventoryUpdate::new(comp::InventoryUpdateEvent::Swapped), ); }, - - comp::SlotManip::SplitSwap(slot, target) => { + comp::InventoryManip::SplitSwap(slot, target) => { let msm = state.ecs().read_resource::(); let mut inventories = state.ecs().write_storage::(); let mut inventory = if let Some(inventory) = inventories.get_mut(entity) { @@ -507,8 +503,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Slo comp::InventoryUpdate::new(comp::InventoryUpdateEvent::Swapped), ); }, - - comp::SlotManip::Drop(slot) => { + comp::InventoryManip::Drop(slot) => { let item = match slot { Slot::Inventory(slot) => state .ecs() @@ -540,8 +535,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Slo comp::InventoryUpdate::new(comp::InventoryUpdateEvent::Dropped), ); }, - - comp::SlotManip::SplitDrop(slot) => { + comp::InventoryManip::SplitDrop(slot) => { let msm = state.ecs().read_resource::(); let item = match slot { Slot::Inventory(slot) => state @@ -571,8 +565,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Slo comp::InventoryUpdate::new(comp::InventoryUpdateEvent::Dropped), ); }, - - comp::SlotManip::CraftRecipe(recipe) => { + comp::InventoryManip::CraftRecipe(recipe) => { if let Some(mut inv) = state .ecs() .write_storage::()