Skip to content

ZoneLookup ​

Inherits: RefCounted

What is known about the zones from the database alone: who is whose parent, the chain of a zone, its full name. The parents are read from ZoneDefinition.parent_zone_id; a loop of parents (A inside B inside A) is cut where it closes, so a mistake in the data never hangs the game.

Methods ​

ZoneDefinitionget_zone( zone_id: int ) static
Array[int]get_chain( zone_id: int ) static
ZoneDefinitionget_look_owner( zone_id: int, kind: String ) static
ZoneDefinitionget_screen_owner( zone_id: int ) static
ZoneDefinitionget_weather_owner( zone_id: int ) static
ZoneDefinitionget_music_owner( zone_id: int ) static
ZoneDefinitionget_ambience_owner( zone_id: int ) static
ZoneDefinitionget_combat_owner( zone_id: int ) static
intget_look_id( zone_id: int, kind: String ) static
boolis_inside( zone_id: int, ancestor_id: int ) static
intget_top( zone_id: int ) static
Stringget_full_name( zone_id: int, separator: String = " > " ) static
Array[ZoneDefinition]get_children( zone_id: int, only_ids: Variant = null ) static
Array[Dictionary]get_tree_list( only_ids: Variant = null ) static

Constants ​

  • String LOOK_SKY = "sky" - The two looks a zone can have
  • String LOOK_ENVIRONMENT = "environment"
  • int MAX_DEPTH = 16 - The longest chain of parents that is followed

Method descriptions ​

ZoneDefinition get_zone( zone_id: int ) ​

No description yet.

Array[int] get_chain( zone_id: int ) ​

The zone, then its parent, then the parent of that, up to the top: [zone id, parent id, ...]. Empty for 0 or an unknown zone.

ZoneDefinition get_look_owner( zone_id: int, kind: String ) ​

The zone that gives the look of a place: the zone itself if it has a config of that kind, else its parent, up to the top. Null when none of them has one (the world's look shows). kind is LOOK_SKY or LOOK_ENVIRONMENT; the two kinds are looked for one by one.

ZoneDefinition get_screen_owner( zone_id: int ) ​

The zone that gives the screen of a place: the zone itself if it changes the screen, else its parent, up to the top. Null when none does.

ZoneDefinition get_weather_owner( zone_id: int ) ​

The zone that gives the weather of a place: the zone itself if its weather rule is not Inherit, else its parent, up to the top. Null when none has a rule (the weather of the world shows)

ZoneDefinition get_music_owner( zone_id: int ) ​

The zone that gives the music of a place: the zone itself if it has music tracks, else its parent, up to the top. Null when none has (the music of the world plays)

ZoneDefinition get_ambience_owner( zone_id: int ) ​

The zone that gives the ambient sound of a place (the same way)

ZoneDefinition get_combat_owner( zone_id: int ) ​

The zone that gives the combat music of a place (the same way)

int get_look_id( zone_id: int, kind: String ) ​

The id of the config a place's look comes from (0 = the world's)

bool is_inside( zone_id: int, ancestor_id: int ) ​

Is zone_id the zone ancestor_id or a part of it (a sub-zone, or a sub-zone of a sub-zone)?

int get_top( zone_id: int ) ​

The zone above this one that has no parent (the zone itself when it has none).

String get_full_name( zone_id: int, separator: String = " > " ) ​

The name of the zone with its parents: "Elderwood > The Old Mill".

Array[ZoneDefinition] get_children( zone_id: int, only_ids: Variant = null ) ​

The zones whose parent is this one (0 = the zones with no parent), sorted by name. only_ids (null = every zone) limits it to a list of zones, for example the zones of one world: a zone whose parent is not in the list counts as having none.

Array[Dictionary] get_tree_list( only_ids: Variant = null ) ​

Every zone (or the zones of only_ids) as a flat list in tree order (a zone, then its sub-zones indented one more level): [{"id", "depth", "zone"}]. A parent that does not exist counts as no parent.