From 815769ad69ea01e36d5aff669c49e6a4a3836296 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 10 Mar 2026 19:13:27 +0000 Subject: [PATCH] feat: add getCycleTicks() and getDayNumber() to GameLoop --- server/src/game/GameLoop.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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; + } }