feat: broadcast dayNumber in state updates

This commit is contained in:
root
2026-03-10 19:13:38 +00:00
parent 815769ad69
commit c71640fd3b
2 changed files with 3 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ export class SocketServer {
private setupBroadcast(): void {
this.gameLoop.setBroadcastHandler(() => {
const update = serializeStateUpdate(this.gameLoop.world, this.gameLoop.getTick(), this.gameLoop.getGameTime());
const update = serializeStateUpdate(this.gameLoop.world, this.gameLoop.getTick(), this.gameLoop.getGameTime(), this.gameLoop.getDayNumber());
this.io.emit('state-update', update);
});

View File

@@ -97,7 +97,7 @@ export function serializeWorldState(world: World, map: GameMap): WorldState {
};
}
export function serializeStateUpdate(world: World, tick: number, gameTime: number): StateUpdate {
export function serializeStateUpdate(world: World, tick: number, gameTime: number, dayNumber: number): StateUpdate {
const entities = world.query('position').map(id => serializeEntity(world, id));
return { entities, tick, gameTime };
return { entities, tick, gameTime, dayNumber };
}