Skip to content

Commit

Permalink
feat: added some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
djpiper28 committed May 5, 2024
1 parent 6091bd3 commit 83f2ed9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion backend/src/modify_gamestate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions backend/src/ws/gen_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 83f2ed9

Please sign in to comment.