Skip to content
ct

Class

DayNightCycleService

Generated GDScript class reference for CalendarTime.DayNightCycleService.

Status
Current
Version
v2.0.4
Updated
2026-08-09

DayNightCycleService — derives time-of-day transitions from a clock and emits time_of_day_changed / day_night_transition_progress_changed on the clock's bus. Instantiated at runtime by TimeHost per clock. Reads times_of_day from clock.calendar.times_of_day — does NOT own its own list. The calendar is the schema; TODs are part of the schema; clocks inherit the schema from the calendar they bind.

Source: addons/calendar_time/day_night_cycle/service/day_night_cycle_service.gd

Syntax

class DayNightCycleService extends RefCounted

Members

NameKindSummary
DayNightCycleServiceLogicFieldThe clock this service derives time-of-day from. Subscribes to the bus for `date_time_changed` / `clock_state_loaded` and emits `time_of_day_changed` / `day_night_transition_progress_changed` back on the same bus. Set on construction by the host; the service doesn't pick its clock — the consumer does. `DayNightCycleServiceLogic` is preloaded here, holding the cycle math this service uses.
ClockValidatorField`ClockValidator` is preloaded here to validate the service's bound clock.
clockPropertyThis clock's date and time drive the day-night cycle.
time_of_dayPropertyThe current time-of-day for the clock's current instant. `null` when the clock is unbound or has no calendar TODs.
last_time_of_dayPropertyMost recently entered time-of-day stage, used to detect transitions.
transition_progressPropertyTracks progress through the active time-of-day lighting transition.
resetMethod
get_previous_time_of_dayMethod
calculate_time_of_dayMethod
calculate_time_of_day_with_hours_timeMethod
get_last_enter_timeMethod
validateMethod