From e435e7219740244752ebe7e566c3c949450e3886 Mon Sep 17 00:00:00 2001 From: Steph Flower Date: Sun, 3 Mar 2024 10:39:07 +0000 Subject: [PATCH] stores player in global grid --- backend/src/lib.rs | 1 - backend/src/ws/gen_json.rs | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/lib.rs b/backend/src/lib.rs index b48b270..b5cf746 100644 --- a/backend/src/lib.rs +++ b/backend/src/lib.rs @@ -6,7 +6,6 @@ pub mod grid; pub mod space; pub mod kube; pub mod player; -pub mod llm; pub mod local_grid; pub mod cache_client; pub mod recipe; diff --git a/backend/src/ws/gen_json.rs b/backend/src/ws/gen_json.rs index ea771db..68982a8 100644 --- a/backend/src/ws/gen_json.rs +++ b/backend/src/ws/gen_json.rs @@ -73,14 +73,17 @@ fn debug_message(state: &PlayerInfo) { fn recalculate_game(state: PlayerInfo) -> String { debug_message(&state); //debug + // store the players location in the world + let playerspace: Space = Space::new(state.coordinates, SpaceKind::Player(state.player)); + let mut grid = WORLD.lock().unwrap(); + grid.insert(playerspace); + // then we want to update the grid by performing action match state.action { Some(p) => perform_action(p), _ => (), } - //store new_grid_to_send in the database - let new_grid: LocalGrid = LocalGrid::from_grid_and_coord(&WORLD.lock().unwrap(), state.coordinates, 48); let resp: Value;