aboutsummaryrefslogtreecommitdiff
path: root/server/src/entity/button.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/entity/button.rs')
-rw-r--r--server/src/entity/button.rs18
1 files changed, 14 insertions, 4 deletions
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));
}