From 83f2ed98c804e9b3989d0e632a6ae78ad5d5c07f Mon Sep 17 00:00:00 2001 From: Danny Piper Date: Sun, 5 May 2024 21:57:57 +0100 Subject: [PATCH] feat: added some logging --- backend/src/modify_gamestate.rs | 1 - backend/src/ws/gen_json.rs | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/src/modify_gamestate.rs b/backend/src/modify_gamestate.rs index 67e5cc6..bfc2aec 100644 --- a/backend/src/modify_gamestate.rs +++ b/backend/src/modify_gamestate.rs @@ -73,7 +73,6 @@ pub async fn perform_action(action: Action) { } pub async fn move_player(old_pos: Option<[u64; 2]>, new_pos: [u64; 2], player: Player) { - let player_key = player.uuid.to_string(); //remove the players old location in the world, if provided diff --git a/backend/src/ws/gen_json.rs b/backend/src/ws/gen_json.rs index 3becd0e..810f7d1 100644 --- a/backend/src/ws/gen_json.rs +++ b/backend/src/ws/gen_json.rs @@ -23,6 +23,7 @@ async fn recalculate_game(state: PlayerInfo, id: &str) -> String { let player_initialised = state.initialised; let player_location = state.coordinates; + println!("Generating new game state for {id}"); modify_gamestate(state).await; // The dereferencing looks a little weird. Here's what's going on: @@ -34,11 +35,13 @@ async fn recalculate_game(state: PlayerInfo, id: &str) -> String { let resp: Value; if player_initialised { + println!("Continuing game loop for {id}"); // if the player is not new to the game, continue game loop resp = json!({ "grid" : new_grid, }); } else { + println!("Issuing join data for {id}"); resp = json!({ "coordinates" : player_location, "uuid" : id