From 3ebb7582afc24992674cf6ebc0d6f314569d727f Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 7 Jul 2024 15:25:48 +0200 Subject: transmit boosting state --- server/examples/client.rs | 10 ++++++---- server/src/customer/movement.rs | 1 + server/src/game.rs | 3 ++- server/src/protocol.rs | 2 ++ 4 files changed, 11 insertions(+), 5 deletions(-) (limited to 'server') diff --git a/server/examples/client.rs b/server/examples/client.rs index 6c757f77..e7863cdb 100644 --- a/server/examples/client.rs +++ b/server/examples/client.rs @@ -1,19 +1,19 @@ /* Undercooked - a game about cooking Copyright 2024 metamuffin - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License only. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . - + */ use std::{ io::{stdin, BufRead, BufReader, Write}, @@ -49,6 +49,7 @@ fn main() { toks.next().unwrap().parse().unwrap(), toks.next().unwrap().parse().unwrap(), ), + boosting: false, rot: 0., }, "i" => PacketS::Position { @@ -56,6 +57,7 @@ fn main() { toks.next().unwrap().parse().unwrap(), toks.next().unwrap().parse().unwrap(), ), + boosting: false, rot: toks.next().unwrap_or("0").parse().unwrap(), }, _ => { diff --git a/server/src/customer/movement.rs b/server/src/customer/movement.rs index c6350ebd..bf2752f1 100644 --- a/server/src/customer/movement.rs +++ b/server/src/customer/movement.rs @@ -72,6 +72,7 @@ impl MovementBase { PacketS::Position { pos: self.position, + boosting: false, rot, } } diff --git a/server/src/game.rs b/server/src/game.rs index 13ee5410..d8184c1e 100644 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -274,7 +274,7 @@ impl Game { self.packet_out .push_back(PacketC::RemovePlayer { id: player }) } - PacketS::Position { pos, rot } => { + PacketS::Position { pos, rot, boosting } => { let pid = player; let player = self .players @@ -297,6 +297,7 @@ impl Game { player: pid, pos: player.position, rot, + boosting, }); // if !movement_ok { // bail!( diff --git a/server/src/protocol.rs b/server/src/protocol.rs index 58182917..facfa5ab 100644 --- a/server/src/protocol.rs +++ b/server/src/protocol.rs @@ -47,6 +47,7 @@ pub enum PacketS { Position { pos: Vec2, rot: f32, + boosting: bool, }, Interact { pos: IVec2, @@ -98,6 +99,7 @@ pub enum PacketC { player: PlayerID, pos: Vec2, rot: f32, + boosting: bool, }, MoveItem { from: ItemLocation, -- cgit v1.2.3-70-g09d2