diff options
Diffstat (limited to 'src/server/mod.rs')
| -rw-r--r-- | src/server/mod.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/server/mod.rs b/src/server/mod.rs index 4f95378..d25b799 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -2,7 +2,7 @@ use crate::net::server::ConnectionManager; use crate::net::Cargo; -use crate::world::World; +use crate::world::{Component, World}; use std::io; use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr}; use std::sync::atomic::{AtomicBool, Ordering}; @@ -105,7 +105,15 @@ fn start(conn_man: ConnectionManager<Cargo>) -> (JoinHandle<()>, Arc<AtomicBool> error!("Unable to remove item. No item with id `{}` found.", id); } } - Cargo::ApplyMatrix((_id, _matrix)) => unimplemented!(), + Cargo::ApplyMatrix((id, matrix)) => { + if let Some(room) = world.get_room_mut(id) { + room.as_non_rigid_mut().unwrap().apply_matrix(&matrix); + conn_man.broadcast(Cargo::SetRoom((id, room.clone()))); + } else if let Some(wall) = world.get_wall_mut(id) { + wall.as_non_rigid_mut().unwrap().apply_matrix(&matrix); + conn_man.broadcast(Cargo::SetWall((id, wall.clone()))); + } + } Cargo::AddMapData(_) | Cargo::UpdateMapData(_) => { error!("This packet is not allowed in the client -> server direction"); } |
