diff options
Diffstat (limited to 'src/net/cargo.rs')
| -rw-r--r-- | src/net/cargo.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/net/cargo.rs b/src/net/cargo.rs new file mode 100644 index 0000000..b05944c --- /dev/null +++ b/src/net/cargo.rs @@ -0,0 +1,33 @@ +//! 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. + UpdateIcon((usize, Icon)), + /// Client <-> Server: Update the info of the room with the given id. + UpdateRoom((usize, Room)), + /// Client <-> Server: Update the info of the wall with the given id. + UpdateWall((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 <-> 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), +} |
