aboutsummaryrefslogtreecommitdiff
path: root/server/protocol/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-09-30 01:19:01 +0200
committermetamuffin <metamuffin@disroot.org>2025-09-30 01:19:09 +0200
commit5033c326094edc1ff4234b994e95d987cb937fc4 (patch)
tree5fa426a77109722df163c15ce8d647170cd8fcea /server/protocol/src
parent727752b87bbe7146adb0f9e9e27d6e64b785ec2f (diff)
downloadhurrycurry-5033c326094edc1ff4234b994e95d987cb937fc4.tar
hurrycurry-5033c326094edc1ff4234b994e95d987cb937fc4.tar.bz2
hurrycurry-5033c326094edc1ff4234b994e95d987cb937fc4.tar.zst
Implement tile placeable items for server-side (#433)
Diffstat (limited to 'server/protocol/src')
-rw-r--r--server/protocol/src/helpers.rs6
-rw-r--r--server/protocol/src/lib.rs11
2 files changed, 7 insertions, 10 deletions
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<String>,
pub tile_names: Vec<String>,
- pub tile_collide: Vec<bool>,
- pub tile_interact: Vec<bool>,
+ pub tile_walkable: HashSet<TileIndex>,
+ pub tile_placeable_items: BTreeMap<TileIndex, HashSet<ItemIndex>>,
pub maps: Vec<(String, MapMetadata)>,
pub bot_algos: Vec<String>,
pub recipes: Vec<Recipe>,