CapGdlrCommandBus.Command¶
Inherits: RefCounted < Object
Base class for commands.
Description¶
Subclass it in its own script file, not in an inner class, so that deserialize() can load it by path. Implement _to_dict() with the command inputs:
class_name AddPointsCommand
extends CapGdlrCommandBus.Command
var amount := 0
func _to_dict() -> Dictionary:
return {"amount": amount}
Optional members that Godular reads from a command class:
static func from_dict(inputs: Dictionary) -> Command: custom restore. Without it, deserialize() creates the command and sets each input as a property.An inner class
Payloadwithstatic func from_dict(data: Dictionary): typed result payload for CapGdlrCommandBus.CommandResult.from_dict().
Methods¶
_to_dict() abstract |
|
to_dict() |
|
deserialize(serialized: Dictionary) static |
Method Descriptions¶
Dictionary _to_dict() abstract 🔗
Returns the inputs of the command as a dictionary.
Returns the name used in log output. Override it.
Dictionary to_dict() 🔗
Serializes the command with its script path and its inputs. See deserialize().
CapGdlrCommandBus.Command deserialize(serialized: Dictionary) static 🔗
Restores a command from the output of to_dict(). The method loads the command script, then uses its static from_dict when the class defines one.