Bitflinger Games docs

Variations

Variations is the one API a layer gets. It's always there: you don't need to load it. See The API for how the pieces fit.

A point is the name the runtime checks before a change, such as rules.player.speed, zones, items or slots.player.

Rules

CallGives backWhat it does
set_rule(key: String, value: Variant)boolSets the rule key. Guarded by rules.<key>. false if refused
rule(key: String, fallback: Variant = null)VariantThe rule's value, or fallback if nobody set it
rules()DictionaryA copy of every rule, by key

Zones

CallGives backWhat it does
register_zone(zone_name: String, build: Callable)boolAdds a zone, or replaces one with the same name. build returns the zone's node. Guarded by zones
zones()DictionaryEvery zone by name: {build, by}, where by is the slug of the layer that registered it

Items

CallGives backWhat it does
register_item(item_name: String, build: Callable)boolAdds an item, or replaces one with the same name. Guarded by items
items()DictionaryEvery item by name: {build, by}
make_item(item_name: String)Node3DBuilds one of the item. Any layer may place any item. For a 2D item, use items()[name].build.call()

Slots

CallGives backWhat it does
fill_slot(slot: String, build: Callable)boolFills the slot. Guarded by slots.<slot>
slot(slot_name: String)Dictionary{build, by}, or {} if the slot is empty

Events

CallGives backWhat it does
emit_event(event_name: String, payload: Dictionary = {})nothingSends the event to every layer, through the event signal

Asking

CallGives backWhat it does
allowed(point: String)boolWhether the layer being loaded may change point. The root may change anything
is_root_layer()boolWhether the layer being loaded is the root
credits()Array{slug, name, creator} for each layer, root first

Signals

SignalWhen
event(name: String, payload: Dictionary)Any layer, or the runtime, sends an event. The runtime sends start once every layer has loaded
rule_changed(key: String, value: Variant)A rule is set
Variations.event.connect(_on_event)
Variations.rule_changed.connect(_on_rule_changed)