Skip to content

Commit

Permalink
- Reldens - v4.0.0 - Include player updates logs in RoomEvents.
Browse files Browse the repository at this point in the history
  • Loading branch information
damian-pastorini committed Oct 2, 2024
1 parent 2e3a4b9 commit b76a0c5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/game/client/room-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class RoomEvents
}
for(let prop of stateProps){
player.state.listen(prop, (value) => {
Logger.debug('Updating state.', {prop, value});
player.state[prop] = value;
this.playersOnChange(player, key, 'playerChange');
});
Expand All @@ -74,10 +75,12 @@ class RoomEvents
// @TODO - BETA - Refactor, remove hardcoded "state", use a new method like hasSubProperties().
if(prop === 'state'){
for(let stateProp of stateProps){
Logger.debug('Updating state property.', {stateProp, newValue: value[stateProp]});
player.state[stateProp] = value[stateProp];
}
return;
}
Logger.debug('Updating player property.', {prop, value});
player[prop] = value;
}

Expand Down Expand Up @@ -167,7 +170,7 @@ class RoomEvents
}
let currentScene = this.getActiveScene();
if(!this.playerExists(currentScene, key)){
/* @NOTE: this is expected to happen when the player is created in the scene, so we don't log the error.
/* @NOTE: this is expected to happen when the player is being created in the scene.
Logger.info('Player not found in current scene.', {
player: currentScene?.player,
currentKeys: Object.keys(currentScene?.player?.players || {}),
Expand Down Expand Up @@ -670,7 +673,6 @@ class RoomEvents
Logger.warning('Missing previous scene instance.', previousSceneInstance);
return false;
}
// previousSceneInstance.scene.setVisible(false);
await previousSceneInstance.changeScene();
this.gameEngine.scene.stop(previousScene);
this.gameEngine.scene.start(player.state.scene);
Expand Down

0 comments on commit b76a0c5

Please sign in to comment.