diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-03-13 15:20:16 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-03-13 15:20:16 +0100 |
| commit | 57e3bd8f6960ac1a0fcda877c30da8bb05530381 (patch) | |
| tree | da21ae114fb8b3af9e7eb19b5096e0358dbb40cc /server | |
| parent | 5726d34f31d0129d314dc447340b0feb56534060 (diff) | |
| download | hurrycurry-57e3bd8f6960ac1a0fcda877c30da8bb05530381.tar hurrycurry-57e3bd8f6960ac1a0fcda877c30da8bb05530381.tar.bz2 hurrycurry-57e3bd8f6960ac1a0fcda877c30da8bb05530381.tar.zst | |
vote buttons
Diffstat (limited to 'server')
| -rw-r--r-- | server/game-core/src/interaction.rs | 8 | ||||
| -rw-r--r-- | server/src/entity/button.rs | 18 | ||||
| -rw-r--r-- | server/src/server.rs | 2 |
3 files changed, 19 insertions, 9 deletions
diff --git a/server/game-core/src/interaction.rs b/server/game-core/src/interaction.rs index e49487c6..0b02b341 100644 --- a/server/game-core/src/interaction.rs +++ b/server/game-core/src/interaction.rs @@ -156,7 +156,7 @@ impl Game { && item.kind == *input && item.active.is_none() { - info!("start active {ri}"); + info!("Active {ri} started"); item.active = Some(Involvement { players: other_player_id.into_iter().collect(), recipe: ri, @@ -171,7 +171,7 @@ impl Game { && item.active.is_none() { let mut item = other_slot.take().unwrap(); - info!("start active {ri}"); + info!("Active {ri} started"); item.active = Some(Involvement { players: other_player_id.into_iter().collect(), recipe: ri, @@ -208,7 +208,7 @@ impl Game { let ok = inputs[0] == on_tile && inputs[1] == in_hand; let ok_flip = inputs[1] == on_tile && inputs[0] == in_hand; if ok || ok_flip { - info!("instant {ri} flip={ok_flip}"); + info!("Instant {ri} (flip={ok_flip})"); let flip = ok_flip as usize; let this_had_item = this_slot.is_some(); let other_had_item = other_slot.is_some(); @@ -412,7 +412,7 @@ fn produce_events( other: &Option<Item>, other_loc: ItemLocation, ) { - info!("produce {this_loc} <~ {other_loc}"); + info!("Produce {this_loc} <~ {other_loc}"); if this_had_item { events.push_back(PacketC::SetItem { location: this_loc, diff --git a/server/src/entity/button.rs b/server/src/entity/button.rs index 74726253..f0e2087d 100644 --- a/server/src/entity/button.rs +++ b/server/src/entity/button.rs @@ -19,7 +19,7 @@ use super::{Entity, EntityContext}; use anyhow::Result; use hurrycurry_data::entities::ButtonAction; use hurrycurry_locale::TrError; -use hurrycurry_protocol::{ItemLocation, Menu, PacketC, PlayerID, glam::IVec2}; +use hurrycurry_protocol::{ItemLocation, Menu, PacketC, PacketS, PlayerID, glam::IVec2}; #[derive(Debug, Clone)] pub struct Button { @@ -32,7 +32,7 @@ impl Entity for Button { &mut self, c: EntityContext<'_>, pos: Option<ItemLocation>, - _player: PlayerID, + player: PlayerID, ) -> Result<bool, TrError> { if pos == Some(ItemLocation::Tile(self.pos)) { match self.action { @@ -41,8 +41,18 @@ impl Entity for Button { .unwrap() .push(PacketC::Menu(Menu::Book(c.serverdata.book.clone()))); } - ButtonAction::VoteYes => {} - ButtonAction::VoteNo => {} + ButtonAction::VoteYes => { + c.packet_in.push_back(PacketS::CastVote { + player, + agree: true, + }); + } + ButtonAction::VoteNo => { + c.packet_in.push_back(PacketS::CastVote { + player, + agree: true, + }); + } ButtonAction::MapSelector => { c.replies.unwrap().push(PacketC::Menu(Menu::MapSelector)); } diff --git a/server/src/server.rs b/server/src/server.rs index 87e77fb2..e272c07d 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -650,7 +650,7 @@ impl Server { while let Some(p) = self.packet_loopback.pop_front() { if let Err(e) = self.packet_in(&mut vec![], p) { - warn!("Internal packet errored: {e}"); + warn!("Loopback packet errored: {e}"); } } |