diff options
Diffstat (limited to 'server/src/entity')
| -rw-r--r-- | server/src/entity/book.rs | 6 | ||||
| -rw-r--r-- | server/src/entity/bot.rs | 4 | ||||
| -rw-r--r-- | server/src/entity/campaign.rs | 6 | ||||
| -rw-r--r-- | server/src/entity/mod.rs | 4 | ||||
| -rw-r--r-- | server/src/entity/tutorial.rs | 10 |
5 files changed, 11 insertions, 19 deletions
diff --git a/server/src/entity/book.rs b/server/src/entity/book.rs index 8daec972..e8456591 100644 --- a/server/src/entity/book.rs +++ b/server/src/entity/book.rs @@ -18,7 +18,7 @@ use super::{Entity, EntityContext}; use anyhow::Result; use hurrycurry_locale::TrError; -use hurrycurry_protocol::{Menu, PacketC, PlayerID, glam::IVec2}; +use hurrycurry_protocol::{ItemLocation, Menu, PacketC, PlayerID, glam::IVec2}; #[derive(Debug, Clone)] pub struct Book(pub IVec2); @@ -27,10 +27,10 @@ impl Entity for Book { fn interact( &mut self, c: EntityContext<'_>, - pos: Option<IVec2>, + pos: Option<ItemLocation>, _player: PlayerID, ) -> Result<bool, TrError> { - if pos == Some(self.0) { + if pos == Some(ItemLocation::Tile(self.0)) { if let Some(r) = c.replies { r.push(PacketC::Menu(Menu::Book(c.serverdata.book.clone()))); } diff --git a/server/src/entity/bot.rs b/server/src/entity/bot.rs index 78b300b6..9627bb76 100644 --- a/server/src/entity/bot.rs +++ b/server/src/entity/bot.rs @@ -18,7 +18,7 @@ use super::{Entity, EntityContext}; use anyhow::Result; use hurrycurry_bot::{BotAlgo, DynBotAlgo}; -use hurrycurry_protocol::{Character, Hand, PacketS, PlayerClass, PlayerID}; +use hurrycurry_protocol::{Character, Hand, ItemLocation, PacketS, PlayerClass, PlayerID}; use log::debug; use std::any::Any; @@ -71,7 +71,7 @@ impl<T: BotAlgo + Any> Entity for BotDriver<T> { self.interacting = input.interact.is_some(); c.packet_in.push_back(PacketS::Interact { player: self.id, - pos: input.interact, + target: input.interact.map(ItemLocation::Tile), hand: Hand(0), }) } diff --git a/server/src/entity/campaign.rs b/server/src/entity/campaign.rs index 33baf631..ddbdc3bc 100644 --- a/server/src/entity/campaign.rs +++ b/server/src/entity/campaign.rs @@ -21,7 +21,7 @@ use anyhow::Result; use hurrycurry_data::entities::GateCondition; use hurrycurry_locale::{TrError, trm}; use hurrycurry_protocol::{ - Message, PacketC, PlayerID, TileIndex, + ItemLocation, Message, PacketC, PlayerID, TileIndex, glam::{IVec2, Vec2}, }; @@ -70,10 +70,10 @@ impl Entity for Gate { fn interact( &mut self, c: EntityContext<'_>, - pos: Option<IVec2>, + pos: Option<ItemLocation>, _player: PlayerID, ) -> Result<bool, TrError> { - if !self.unlocked && pos == Some(self.pos) { + if !self.unlocked && pos == Some(ItemLocation::Tile(self.pos)) { c.packet_out.push_back(PacketC::ServerMessage { message: trm!( "s.campaign.unlock_condition", diff --git a/server/src/entity/mod.rs b/server/src/entity/mod.rs index 7c38e532..4bca9dc8 100644 --- a/server/src/entity/mod.rs +++ b/server/src/entity/mod.rs @@ -41,7 +41,7 @@ use environment_effect::{EnvironmentController, EnvironmentEffectController}; use hurrycurry_client_lib::Game; use hurrycurry_data::{Serverdata, entities::EntityDecl}; use hurrycurry_locale::TrError; -use hurrycurry_protocol::{Character, PacketC, PacketS, PlayerID, glam::IVec2}; +use hurrycurry_protocol::{Character, ItemLocation, PacketC, PacketS, PlayerID}; use item_portal::ItemPortal; use player_portal::PlayerPortal; use std::{ @@ -77,7 +77,7 @@ pub trait Entity: Any { fn interact( &mut self, _c: EntityContext<'_>, - _pos: Option<IVec2>, + _target: Option<ItemLocation>, _player: PlayerID, ) -> Result<bool, TrError> { Ok(false) diff --git a/server/src/entity/tutorial.rs b/server/src/entity/tutorial.rs index 69086165..8cc896ac 100644 --- a/server/src/entity/tutorial.rs +++ b/server/src/entity/tutorial.rs @@ -17,7 +17,7 @@ */ use super::{Entity, EntityContext}; use anyhow::Result; -use hurrycurry_locale::{TrError, trm}; +use hurrycurry_locale::trm; use hurrycurry_protocol::{ ItemIndex, Message, PacketC, PlayerID, Recipe, RecipeIndex, TileIndex, glam::IVec2, }; @@ -121,14 +121,6 @@ impl Entity for Tutorial { Ok(()) } - fn interact( - &mut self, - _c: EntityContext<'_>, - _pos: Option<IVec2>, - _player: PlayerID, - ) -> Result<bool, TrError> { - Ok(false) - } } struct StepContext<'a> { |