aboutsummaryrefslogtreecommitdiff
path: root/server/src/entity
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-03-24 16:46:16 +0100
committermetamuffin <metamuffin@disroot.org>2026-03-24 16:46:16 +0100
commitef733f9c8bc4d07609c7c3388203762f12e9065c (patch)
tree6b1b8ddeb28d3d938cf5ccb03e97cfbae8106bb5 /server/src/entity
parent2a7a6b2deb1fe3457b1946654ebfaec2f79e8cc2 (diff)
downloadhurrycurry-ef733f9c8bc4d07609c7c3388203762f12e9065c.tar
hurrycurry-ef733f9c8bc4d07609c7c3388203762f12e9065c.tar.bz2
hurrycurry-ef733f9c8bc4d07609c7c3388203762f12e9065c.tar.zst
Effect when points are changed; change effect packetHEADmaster
Diffstat (limited to 'server/src/entity')
-rw-r--r--server/src/entity/ctf_minigame.rs13
-rw-r--r--server/src/entity/demand_sink.rs12
2 files changed, 16 insertions, 9 deletions
diff --git a/server/src/entity/ctf_minigame.rs b/server/src/entity/ctf_minigame.rs
index 03261e41..d2b23aee 100644
--- a/server/src/entity/ctf_minigame.rs
+++ b/server/src/entity/ctf_minigame.rs
@@ -18,6 +18,7 @@
use super::{Entity, EntityContext};
use anyhow::Result;
use hurrycurry_locale::TrError;
+use hurrycurry_protocol::{Effect, Hand};
use hurrycurry_protocol::{ItemIndex, ItemLocation, Message, PacketC, PlayerID, glam::IVec2};
use std::collections::{HashMap, HashSet};
use std::fmt::Write;
@@ -36,11 +37,11 @@ struct TeamData {
}
impl TeamData {
- fn effect(&self, c: &mut EntityContext, name: &str) -> Result<(), TrError> {
+ fn effect(&self, c: &mut EntityContext, effect: Effect) -> Result<(), TrError> {
for pid in self.players.iter() {
- c.packet_out.push_back(PacketC::Effect2 {
- name: name.to_string(),
- location: ItemLocation::Player(*pid, hurrycurry_protocol::Hand(0)),
+ c.packet_out.push_back(PacketC::Effect {
+ effect: effect.clone(),
+ location: ItemLocation::Player(*pid, Hand(0)),
});
}
Ok(())
@@ -257,14 +258,14 @@ impl Entity for CtfMinigame {
.is_some_and(|a| a == from_team_idx)
{
for i in self.player_flags(&mut c, from)? {
- self.teams.get(&i).unwrap().effect(&mut c, "angry")?;
+ self.teams.get(&i).unwrap().effect(&mut c, Effect::Angry)?;
self.return_flag(&mut c, i)?;
self.teams.get_mut(&from_team_idx).unwrap().score += 10;
}
self.teams
.get(&from_team_idx)
.unwrap()
- .effect(&mut c, "satisfied")?;
+ .effect(&mut c, Effect::Satisfied)?;
self.send_table(&mut c)?;
}
Ok(true)
diff --git a/server/src/entity/demand_sink.rs b/server/src/entity/demand_sink.rs
index 6fcfa643..45244e91 100644
--- a/server/src/entity/demand_sink.rs
+++ b/server/src/entity/demand_sink.rs
@@ -19,7 +19,7 @@
use crate::entity::{Entity, EntityContext};
use anyhow::Result;
use hurrycurry_locale::TrError;
-use hurrycurry_protocol::{ItemLocation, PacketC, glam::IVec2};
+use hurrycurry_protocol::{Effect, ItemLocation, PacketC, glam::IVec2};
pub struct DemandSink {
pub pos: IVec2,
@@ -36,8 +36,14 @@ impl Entity for DemandSink {
c.game.score.demands_completed += 1;
c.game.score.points += demand.points;
*c.score_changed = true;
- c.packet_out.push_back(PacketC::Effect2 {
- name: "satisfied".to_string(),
+ c.packet_out.push_back(PacketC::Effect {
+ effect: Effect::Satisfied,
+ location: ItemLocation::Tile(self.pos),
+ });
+ c.packet_out.push_back(PacketC::Effect {
+ effect: Effect::Points {
+ amount: demand.points,
+ },
location: ItemLocation::Tile(self.pos),
});
} else {