feat: add getCycleTicks() and getDayNumber() to GameLoop

This commit is contained in:
root
2026-03-10 19:13:27 +00:00
parent c810c99a89
commit 815769ad69
+10 -2
View File
@@ -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;
}
}