From c53af0485f38a1f5bd843154eb27357a5c0aed11 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Thu, 4 Feb 2021 15:13:39 +0100 Subject: Add matrix transform capabilities back --- src/server/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/server/mod.rs') 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) -> (JoinHandle<()>, Arc 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"); } -- cgit v1.2.3-70-g09d2