summaryrefslogtreecommitdiff
path: root/server/src/entity
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-04 20:00:30 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-04 20:00:30 +0200
commit740dc4b45cb59ff184e5cebc5b19f402bb9d54d2 (patch)
tree188c59484dc4b4c268a107def8d485919a3b5100 /server/src/entity
parent406ba2117783f17010f4786a86fa02ae715388e6 (diff)
downloadhurrycurry-740dc4b45cb59ff184e5cebc5b19f402bb9d54d2.tar
hurrycurry-740dc4b45cb59ff184e5cebc5b19f402bb9d54d2.tar.bz2
hurrycurry-740dc4b45cb59ff184e5cebc5b19f402bb9d54d2.tar.zst
refactor interact function and new progress proto
Diffstat (limited to 'server/src/entity')
-rw-r--r--server/src/entity/conveyor.rs10
-rw-r--r--server/src/entity/item_portal.rs10
2 files changed, 10 insertions, 10 deletions
diff --git a/server/src/entity/conveyor.rs b/server/src/entity/conveyor.rs
index 5602e082..4efbd385 100644
--- a/server/src/entity/conveyor.rs
+++ b/server/src/entity/conveyor.rs
@@ -15,8 +15,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-use super::{EntityContext, Entity};
-use crate::server::interact_effect;
+use super::{Entity, EntityContext};
+use crate::interaction::interact;
use anyhow::{anyhow, Result};
use hurrycurry_protocol::{glam::IVec2, ItemIndex, ItemLocation};
@@ -68,18 +68,18 @@ impl Entity for Conveyor {
.get_many_mut([&self.from, &self.to])
.ok_or(anyhow!("conveyor does ends in itself"))?;
- interact_effect(
+ interact(
&c.game.data,
true,
+ Some(to.kind),
&mut to.item,
ItemLocation::Tile(self.to),
&mut from.item,
ItemLocation::Tile(self.from),
- Some(to.kind),
- c.packet_out,
&mut c.game.score,
c.score_changed,
true,
+ c.packet_out,
);
}
diff --git a/server/src/entity/item_portal.rs b/server/src/entity/item_portal.rs
index faaa210b..99b9d57a 100644
--- a/server/src/entity/item_portal.rs
+++ b/server/src/entity/item_portal.rs
@@ -15,8 +15,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-use super::{EntityContext, Entity};
-use crate::server::interact_effect;
+use super::{Entity, EntityContext};
+use crate::interaction::interact;
use anyhow::{anyhow, Result};
use hurrycurry_protocol::{glam::IVec2, ItemLocation};
@@ -35,18 +35,18 @@ impl Entity for ItemPortal {
.ok_or(anyhow!("conveyor does ends in itself"))?;
if from.item.is_some() {
- interact_effect(
+ interact(
&c.game.data,
true,
+ Some(to.kind),
&mut to.item,
ItemLocation::Tile(self.to),
&mut from.item,
ItemLocation::Tile(self.from),
- Some(to.kind),
- c.packet_out,
&mut c.game.score,
c.score_changed,
true,
+ c.packet_out,
);
}