summaryrefslogtreecommitdiff
path: root/server/src/entity/item_portal.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/entity/item_portal.rs')
-rw-r--r--server/src/entity/item_portal.rs25
1 files changed, 10 insertions, 15 deletions
diff --git a/server/src/entity/item_portal.rs b/server/src/entity/item_portal.rs
index f63ff274..be6acd06 100644
--- a/server/src/entity/item_portal.rs
+++ b/server/src/entity/item_portal.rs
@@ -15,11 +15,10 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-use super::EntityT;
-use crate::game::{interact_effect, Game};
+use super::{EntityContext, EntityT};
+use crate::server::interact_effect;
use anyhow::{anyhow, Result};
-use hurrycurry_protocol::{glam::IVec2, ItemLocation, PacketC};
-use std::collections::VecDeque;
+use hurrycurry_protocol::{glam::IVec2, ItemLocation};
#[derive(Debug, Default, Clone)]
pub struct ItemPortal {
@@ -28,29 +27,25 @@ pub struct ItemPortal {
}
impl EntityT for ItemPortal {
- fn tick(
- &mut self,
- game: &mut Game,
- packet_out: &mut VecDeque<PacketC>,
- _dt: f32,
- ) -> Result<()> {
- let [from, to] = game
+ fn tick(&mut self, c: EntityContext) -> Result<()> {
+ let [from, to] = c
+ .game
.tiles
.get_many_mut([&self.from, &self.to])
.ok_or(anyhow!("conveyor does ends in itself"))?;
if from.item.is_some() {
interact_effect(
- &game.data,
+ &c.game.data,
true,
&mut to.item,
ItemLocation::Tile(self.to),
&mut from.item,
ItemLocation::Tile(self.from),
Some(to.kind),
- packet_out,
- &mut game.score,
- &mut game.score_changed,
+ c.packet_out,
+ &mut c.game.score,
+ c.score_changed,
true,
);
}