Table of Contents

Class TimbnClock

Namespace
Timbn.GraveyardKeeperTwo.Core.Framework
Assembly
Timbn.GraveyardKeeperTwo.Core.dll

Reads the game's calendar and clock for the loaded save, so a mod can ask what day or time it is without digging through EnvironmentEngine and the save, and sets the time of day as a one shot change that needs no undo. Every member reads as zero or empty at the main menu. See the plugin's Clock property for holds on the clock that are undone, such as freezing it or running it faster.

public static class TimbnClock
Inheritance
TimbnClock
Inherited Members

Properties

Day

The day of the save, counting up from 1, the same number NewDayStarted hands its handlers.

public static int Day { get; }

Property Value

int

IsPaused

Whether the game's clock is stopped, as it is during some cutscenes or while a plugin holds Clock.Freeze.

public static bool IsPaused { get; }

Property Value

bool

Minutes

The game clock in minutes since the save began, counting whole days and the part of today. Use it for waits that follow game time, so they stop while the game is paused and speed up with it, and are never real seconds.

public static double Minutes { get; }

Property Value

double

Examples

_leaveAt = TimbnClock.Minutes + 30;
// later
if (TimbnClock.Minutes >= _leaveAt)
    herm.WalkTo("npc_sim_village_right_side_road_34");

TimeOfDay

The time of day, running from 0 at midnight through 0.25 at dawn, 0.5 at noon and 0.75 at dusk, back to 1 at the next midnight.

public static float TimeOfDay { get; }

Property Value

float

TimeText

The time of day as a 24 hour clock, such as 06:30.

public static string TimeText { get; }

Property Value

string

Weekday

Today's name in the game's six day week, such as Gluttony, or null at the main menu.

public static TimbnWeekday? Weekday { get; }

Property Value

TimbnWeekday?

Examples

if (TimbnClock.Weekday == TimbnWeekday.Pride)
    Logger.LogInfo("Town orders can be accepted today.");

WeekdayNumber

The day's place in the game's six day week, from 1 to 6. See Weekday for its name.

public static int WeekdayNumber { get; }

Property Value

int

Methods

DayFractionBetween(float, float)

How far the clock moved from from to to, as a fraction of a day. It counts across midnight, so 0.9 to 0.1 is 0.2. Useful with TimeOfDayChanged to work out how much game time passed since the last tick.

public static float DayFractionBetween(float from, float to)

Parameters

from float

The earlier time of day.

to float

The later time of day.

Returns

float

The part of a day between the two, from 0 up to but not including 1.

SetTime(float)

Sets the time of day, the way the game does when a cutscene jumps the clock. The lighting and everything that follows the clock update at once. The day does not change, so setting a time earlier than now turns the clock back within the same day.

public static bool SetTime(float timeOfDay)

Parameters

timeOfDay float

The new time, from 0 at midnight to 1 at the next midnight. Values outside wrap around.

Returns

bool

False at the main menu, when there is no clock to set.

Examples

TimbnClock.SetTime(0.25f);