Add offsetRuntimeClockState and formatRuntimeDayPhaseLabel functions

This commit is contained in:
2026-04-14 20:51:01 +02:00
parent 48661f8ee7
commit b49e87a1a0

View File

@@ -715,6 +715,28 @@ function createVec3Draft(vector: Vec3): Vec3Draft {
};
}
function offsetRuntimeClockState(
state: RuntimeClockState,
deltaHours: number
): RuntimeClockState {
const totalHours = Math.max(
0,
state.dayCount * HOURS_PER_DAY + state.timeOfDayHours + deltaHours
);
return {
timeOfDayHours: normalizeTimeOfDayHours(totalHours),
dayCount: Math.floor(totalHours / HOURS_PER_DAY),
dayLengthMinutes: state.dayLengthMinutes
};
}
function formatRuntimeDayPhaseLabel(
dayPhase: ReturnType<typeof resolveRuntimeTimeState>["dayPhase"]
): string {
return dayPhase.charAt(0).toUpperCase() + dayPhase.slice(1);
}
function createPlayerStartMovementTemplateNumberDraft(
template: PlayerStartMovementTemplate
): PlayerStartMovementTemplateNumberDraft {