diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-07 15:58:17 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-07 15:58:17 +0200 |
commit | b73598f73360f3b5ace7415b535bbedbea8de35e (patch) | |
tree | 1880b4d64040dbc9edac62efb262d73096de7dfc | |
parent | 13ea66d8832fbede8563e66a4bc25e32b594ab30 (diff) | |
download | hurrycurry-b73598f73360f3b5ace7415b535bbedbea8de35e.tar hurrycurry-b73598f73360f3b5ace7415b535bbedbea8de35e.tar.bz2 hurrycurry-b73598f73360f3b5ace7415b535bbedbea8de35e.tar.zst |
send map names
-rw-r--r-- | server/src/data.rs | 6 | ||||
-rw-r--r-- | test-client/protocol.ts | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/server/src/data.rs b/server/src/data.rs index 62a7f5d8..a1c7e894 100644 --- a/server/src/data.rs +++ b/server/src/data.rs @@ -98,6 +98,7 @@ pub struct Gamedata { pub tile_names: Vec<String>, pub tile_collide: Vec<bool>, pub tile_interact: Vec<bool>, + pub map_names: HashSet<String>, #[serde(skip)] pub recipes: Vec<Recipe>, #[serde(skip)] pub demands: Vec<Demand>, #[serde(skip)] pub initial_map: HashMap<IVec2, (TileIndex, Option<ItemIndex>)>, @@ -153,7 +154,9 @@ impl DataIndex { File::open(recipes_path).context("opening recipes failed. are they generated yet?")?, )?; - Ok(Gamedata::build(map_in, demands_in, recipes_in)?) + let mut gd = Gamedata::build(map_in, demands_in, recipes_in)?; + gd.map_names = self.maps.clone(); + Ok(gd) } } @@ -259,6 +262,7 @@ impl Gamedata { tile_collide, tile_interact, recipes, + map_names: HashSet::new(), initial_map, item_names, entities: map_in.entities, diff --git a/test-client/protocol.ts b/test-client/protocol.ts index f3bb8acb..ebfd9232 100644 --- a/test-client/protocol.ts +++ b/test-client/protocol.ts @@ -26,6 +26,7 @@ export interface Gamedata { tile_collide: boolean[], // Look-up table for TileIndex to check tile collision with players tile_interact: boolean[], // Look-up table for TileIndex to check if a tile is interactable spawn: Vec2, // Where players spawn when they join. + map_names: string[], } export type PacketS = |