From 5033c326094edc1ff4234b994e95d987cb937fc4 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 30 Sep 2025 01:19:01 +0200 Subject: Implement tile placeable items for server-side (#433) --- server/protocol/src/helpers.rs | 6 ------ server/protocol/src/lib.rs | 11 +++++++---- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'server/protocol/src') diff --git a/server/protocol/src/helpers.rs b/server/protocol/src/helpers.rs index b5c0e82b..92668df4 100644 --- a/server/protocol/src/helpers.rs +++ b/server/protocol/src/helpers.rs @@ -5,12 +5,6 @@ impl Gamedata { pub fn tile_name(&self, index: TileIndex) -> &str { &self.tile_names[index.0] } - pub fn is_tile_colliding(&self, index: TileIndex) -> bool { - self.tile_collide[index.0] - } - pub fn is_tile_interactable(&self, index: TileIndex) -> bool { - self.tile_interact[index.0] - } pub fn item_name(&self, index: ItemIndex) -> &str { &self.item_names[index.0] } diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs index c32bff39..00ef62d7 100644 --- a/server/protocol/src/lib.rs +++ b/server/protocol/src/lib.rs @@ -17,7 +17,10 @@ */ use glam::{IVec2, Vec2}; use serde::{Deserialize, Deserializer, Serialize}; -use std::{collections::HashSet, sync::LazyLock}; +use std::{ + collections::{BTreeMap, HashSet}, + sync::LazyLock, +}; pub use glam; @@ -76,14 +79,14 @@ pub struct Demand { pub points: i64, } -#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[derive(Debug, Clone, Serialize, Deserialize, Default)] #[rustfmt::skip] pub struct Gamedata { pub current_map: String, pub item_names: Vec, pub tile_names: Vec, - pub tile_collide: Vec, - pub tile_interact: Vec, + pub tile_walkable: HashSet, + pub tile_placeable_items: BTreeMap>, pub maps: Vec<(String, MapMetadata)>, pub bot_algos: Vec, pub recipes: Vec, -- cgit v1.2.3-70-g09d2