Skip to content
ct

Class

AgeService

Generated GDScript class reference for CalendarTime.AgeService.

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

AgeService — a Resource that advances an AgeState as game time progresses. Bound to a GameClock; the scene-tree AgeComponent reads its progress. Drive modes (see AgeSettings.UpdateTime):

  • GAME_TIME_ELAPSED — advance per clock.signal_bus.game_seconds_advanced (sum of game seconds the clock moved).
  • DATE_CHANGED — advance once per day boundary crossed, by the full day's game seconds (so day-aligned ageing doesn't drift from sub-day frames).
  • REAL_TIME_ELAPSED — not supported on a Resource service. A scene-tree wrapper would be required to drive a per-frame tick. Configuring this mode produces a validation error and the service stays idle. Use GAME_TIME_ELAPSED or DATE_CHANGED instead. Owned by the clock (clock.age_service). One age service per clock.

Source: addons/calendar_time/ageing/age_service.gd

Syntax

class AgeService extends Resource

Members

NameKindSummary
service_idPropertyUnique identifier for this service instance. Used for serialization (see Keys.SERVICE_ID) and for routing debug output. Setter re-registers the AgeState in `clock.age_registry` under the new key (and rebinds `main_age_id`) so changing the id post-construction keeps the registry in sync. Set BEFORE passing the service to consumers to avoid two services with the same default id colliding on a single clock's registry.
starting_agePropertyWhere the age service tells about changes to the age
age_settingsPropertyDefines how ageing operates inside the service
clockPropertyThe shared clock whose elapsed time and date changes drive ageing.
old_clockPropertyThe previously bound clock, for state migration.
old_statePropertyCached state from the old clock before migration.
new_registryPropertyRegistry on the new clock, used to re-register migrated state.
age_state_idPropertyIdentifier used to store and recover this service's age state during serialization.
progress_ageMethod
seconds_to_game_unitsMethod
validateMethod
to_dictMethod
from_dictMethod
SCHEMA_VERSIONFieldBumped when an on-disk key changes shape. v2 stored service identity under the key "id"; v3 stores it under "service_id".
SERVICE_IDFieldSchema v3 key. Written by to_dict().
AGE_STATE_IDFieldThis service's age state identifier is serialized under this key.
LEGACY_IDFieldLegacy v1/v2 key. Read-only — from_dict() auto-migrates it to SERVICE_ID when no SERVICE_ID is present. See MIGRATION.md §5.
get_keysMethod