diff --git a/server/src/game/GameLoop.ts b/server/src/game/GameLoop.ts index 4d5738d..6b12ccb 100644 --- a/server/src/game/GameLoop.ts +++ b/server/src/game/GameLoop.ts @@ -339,10 +339,18 @@ export class GameLoop { return this.tick; } - getGameTime(): number { + private getCycleTicks(): number { const dayTicks = 100 / this.runtimeConstants.get('ENERGY_DECAY_PER_TICK'); const nightTicks = dayTicks / this.runtimeConstants.get('DAY_NIGHT_RATIO'); - const cycleTicks = Math.round(dayTicks + nightTicks); + return Math.round(dayTicks + nightTicks); + } + + getGameTime(): number { + const cycleTicks = this.getCycleTicks(); return (this.tick % cycleTicks) / cycleTicks; } + + getDayNumber(): number { + return Math.floor(this.tick / this.getCycleTicks()) + 1; + } }