YarnPromise
A completion object for the presenter system.
class_name YarnPromise
extends RefCountedInherits from RefCounted
Raw signals are broadcasts: one that fires while nobody is awaiting it is lost, and awaiting it after the fact hangs. A promise reembers being settled, so wait resumes immediately when called on an already-settled promise, and completion can never be lost to ordering. This is Paris' GDScript stand-in for an awaitable task! Idempotent (thanks, Tim): only the first settle wins, later calls are no-ops. The dialogue runner uses one promise per presenter per piece of content ("this presenter has finished this line"), and a shared promise for option selection ("the first valid selection wins").
#Properties
#is_settled
var is_settled: bool = falseType bool
#value
var value: Variant = nullType Variant
#Signals
#completed
Fired on settlement carrying the settled value. Prefer wait over awaiting this directly.
signal completed(value: Variant)Parameters
valueVariant
#Methods
#settle(Variant)
Settles the promise with
result. First call wins; later calls are no-ops.func settle(result: Variant = null) -> voidParameters
resultVariant
#wait()
Awaitable: resumes when the promise settles immediately if it already has and returns the settled value.
func wait() -> VariantReturns Variant
Generated from Yarn Spinner for Godot GDScript 3.3.