diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-07-07 15:25:48 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-07-07 15:25:48 +0200 | 
| commit | 3ebb7582afc24992674cf6ebc0d6f314569d727f (patch) | |
| tree | 093d355bb411b051e4e6ba3d80bb061f77b4939b /server | |
| parent | 120eb58c117f251fc548275a7440c2b2492ec6aa (diff) | |
| download | hurrycurry-3ebb7582afc24992674cf6ebc0d6f314569d727f.tar hurrycurry-3ebb7582afc24992674cf6ebc0d6f314569d727f.tar.bz2 hurrycurry-3ebb7582afc24992674cf6ebc0d6f314569d727f.tar.zst | |
transmit boosting state
Diffstat (limited to 'server')
| -rw-r--r-- | server/examples/client.rs | 10 | ||||
| -rw-r--r-- | server/src/customer/movement.rs | 1 | ||||
| -rw-r--r-- | server/src/game.rs | 3 | ||||
| -rw-r--r-- | server/src/protocol.rs | 2 | 
4 files changed, 11 insertions, 5 deletions
| 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 <https://www.gnu.org/licenses/>. -     +  */  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, | 
