diff options
Diffstat (limited to 'server/src/entity/portal.rs')
-rw-r--r-- | server/src/entity/portal.rs | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/server/src/entity/portal.rs b/server/src/entity/portal.rs index 092a8da5..3aed35ac 100644 --- a/server/src/entity/portal.rs +++ b/server/src/entity/portal.rs @@ -16,13 +16,9 @@ */ use super::EntityT; -use crate::{ - data::Gamedata, - game::{interact_effect, Tile}, -}; +use crate::game::{interact_effect, Game}; use anyhow::{anyhow, Result}; -use hurrycurry_protocol::{glam::IVec2, ItemLocation, PacketC}; -use std::collections::{HashMap, VecDeque}; +use hurrycurry_protocol::{glam::IVec2, ItemLocation}; #[derive(Debug, Default, Clone)] pub struct Portal { @@ -31,29 +27,23 @@ pub struct Portal { } impl EntityT for Portal { - fn tick( - &mut self, - data: &Gamedata, - points: &mut i64, - packet_out: &mut VecDeque<PacketC>, - tiles: &mut HashMap<IVec2, Tile>, - _dt: f32, - ) -> Result<()> { - let [from, to] = tiles + fn tick(&mut self, game: &mut Game, _dt: f32) -> Result<()> { + let [from, to] = game + .tiles .get_many_mut([&self.from, &self.to]) .ok_or(anyhow!("conveyor does ends in itself"))?; if from.item.is_some() { interact_effect( - data, + &game.data, true, &mut to.item, ItemLocation::Tile(self.to), &mut from.item, ItemLocation::Tile(self.from), Some(to.kind), - packet_out, - points, + &mut game.packet_out, + &mut game.points, true, ); } |