summaryrefslogtreecommitdiff
path: root/server/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'server/protocol')
-rw-r--r--server/protocol/src/lib.rs5
-rw-r--r--server/protocol/src/movement.rs13
-rw-r--r--server/protocol/src/registry.rs4
3 files changed, 17 insertions, 5 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs
index 56ddc7a8..b826edae 100644
--- a/server/protocol/src/lib.rs
+++ b/server/protocol/src/lib.rs
@@ -28,7 +28,7 @@ pub use glam;
pub mod movement;
pub mod registry;
-pub const VERSION: (u32, u32) = (7, 0);
+pub const VERSION: (u32, u32) = (7, 1);
pub const BINCODE_CONFIG: Configuration<LittleEndian, Varint, Limit<4096>> =
standard().with_limit();
@@ -247,6 +247,9 @@ pub enum PacketC {
item: ItemIndex,
success: bool,
},
+ Redirect {
+ uri: Vec<String>,
+ },
/// For use in replay sessions only
ReplayStart,
diff --git a/server/protocol/src/movement.rs b/server/protocol/src/movement.rs
index 85accb31..a02ee8ee 100644
--- a/server/protocol/src/movement.rs
+++ b/server/protocol/src/movement.rs
@@ -17,7 +17,7 @@
*/
use crate::{
glam::{IVec2, Vec2},
- PacketS, PlayerID,
+ PacketC, PacketS, PlayerID,
};
use std::collections::HashSet;
@@ -81,7 +81,7 @@ impl MovementBase {
collide_player_tiles(self, map);
}
- pub fn movement_packet(&self, player: PlayerID) -> PacketS {
+ pub fn movement_packet_s(&self, player: PlayerID) -> PacketS {
PacketS::Movement {
pos: Some(self.position),
boost: self.input_boost,
@@ -89,6 +89,15 @@ impl MovementBase {
player,
}
}
+ pub fn movement_packet_c(&self, player: PlayerID) -> PacketC {
+ PacketC::Movement {
+ rot: self.rotation,
+ pos: self.position,
+ boost: self.input_boost,
+ dir: self.input_direction,
+ player,
+ }
+ }
pub fn collide(&mut self, other: &mut Self, dt: f32) {
let diff = self.position - other.position;
diff --git a/server/protocol/src/registry.rs b/server/protocol/src/registry.rs
index 92f2c454..b5b83bd1 100644
--- a/server/protocol/src/registry.rs
+++ b/server/protocol/src/registry.rs
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize)]
+#[derive(Debug, Clone, Serialize)]
pub struct Entry {
pub name: String,
pub address: Vec<String>,
@@ -9,7 +9,7 @@ pub struct Entry {
pub version: (u32, u32),
}
-#[derive(Debug, Deserialize, Serialize)]
+#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Submission {
pub secret: u128,
pub name: String,