diff options
Diffstat (limited to 'server/src/entity/ctf_minigame.rs')
| -rw-r--r-- | server/src/entity/ctf_minigame.rs | 13 |
1 files changed, 7 insertions, 6 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) |