aboutsummaryrefslogtreecommitdiff
path: root/src/net/cargo.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/cargo.rs')
-rw-r--r--src/net/cargo.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/net/cargo.rs b/src/net/cargo.rs
new file mode 100644
index 0000000..6e6ee41
--- /dev/null
+++ b/src/net/cargo.rs
@@ -0,0 +1,38 @@
+//! The cargo is information actually concerning the inner workings of graf karto,
+//! as opposed to the inner workings of the network library.
+
+use crate::world::{Icon, Room, Wall, World};
+use nalgebra::Matrix3;
+use serde::{Deserialize, Serialize};
+
+/// Packets sent oven the network will carry this cargo to inform on what the client needs or the
+/// server wants.
+#[derive(Debug, Deserialize, Serialize)]
+pub enum Cargo {
+ /// Client -> Server: Request to add an icon to the map
+ AddIcon(Icon),
+ /// Client -> Server: Request to add a room to the map
+ AddRoom(Room),
+ /// Client -> Server: Request to add a wall to the map
+ AddWall(Wall),
+ /// Client <-> Server: Update the info of the icon with the given id.
+ /// Server -> Client can also create an item with this id.
+ SetIcon((usize, Icon)),
+ /// Client <-> Server: Update the info of the room with the given id.
+ /// Server -> Client can also create an item with this id.
+ SetRoom((usize, Room)),
+ /// Client <-> Server: Update the info of the wall with the given id.
+ /// Server -> Client can also create an item with this id.
+ SetWall((usize, Wall)),
+ /// Client -> Server: Request to apply the given matrix to the item with the provided id.
+ /// If the matrix cannot be applied to an item with the given id, it will do nothing.
+ ApplyMatrix((usize, Matrix3<f64>)),
+ /// Client <-> Server: Clear all data from the world.
+ ClearAll,
+ /// Client <-> Server: Remove the item with the given id.
+ Remove(usize),
+ /// Server -> Client: Add all of the data additively to the map
+ AddMapData(World),
+ /// Server -> Client: Clear the current map data of the client and replace it with this.
+ UpdateMapData(World),
+}