aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/customer.rs4
-rw-r--r--server/src/game.rs6
-rw-r--r--server/src/protocol.rs1
3 files changed, 9 insertions, 2 deletions
diff --git a/server/src/customer.rs b/server/src/customer.rs
index ea63f93a..8d843fda 100644
--- a/server/src/customer.rs
+++ b/server/src/customer.rs
@@ -4,7 +4,7 @@ use crate::{
protocol::{PacketC, PacketS, PlayerID},
};
use glam::{IVec2, Vec2};
-use log::{error, info};
+use log::error;
use std::{
cmp::Ordering,
collections::{BinaryHeap, HashMap, HashSet, VecDeque},
@@ -49,7 +49,7 @@ pub async fn customer(game: Arc<RwLock<Game>>, mut grx: broadcast::Receiver<Pack
PacketC::Init { data, .. } => {
state.data = data;
}
- PacketC::UpdateMap { pos, tile } => {
+ PacketC::UpdateMap { pos, tile, .. } => {
let tilename = &state.data.tile_names[tile];
if tilename == "floor" || tilename == "door" {
state.walkable.insert(pos);
diff --git a/server/src/game.rs b/server/src/game.rs
index 9c1bdd29..228d7048 100644
--- a/server/src/game.rs
+++ b/server/src/game.rs
@@ -85,6 +85,12 @@ impl Game {
for (&tile, tdata) in &self.tiles {
out.push(PacketC::UpdateMap {
pos: tile,
+ neighbours: [
+ self.tiles.get(&(tile + IVec2::NEG_Y)).map(|e| e.kind),
+ self.tiles.get(&(tile + IVec2::NEG_X)).map(|e| e.kind),
+ self.tiles.get(&(tile + IVec2::Y)).map(|e| e.kind),
+ self.tiles.get(&(tile + IVec2::X)).map(|e| e.kind),
+ ],
tile: tdata.kind.clone(),
});
if let Some(item) = &tdata.item {
diff --git a/server/src/protocol.rs b/server/src/protocol.rs
index 34442263..18b5f6fa 100644
--- a/server/src/protocol.rs
+++ b/server/src/protocol.rs
@@ -61,6 +61,7 @@ pub enum PacketC {
UpdateMap {
pos: IVec2,
tile: TileIndex,
+ neighbours: [Option<TileIndex>; 4],
},
Collide {
player: PlayerID,