component.dumbscriptcomponent
Component that provides a simple script to control an entity.
- struct DumbScriptComponent;
Component that provides a simple script (in YAML) to control an entity.
Used by ControllerSystem (there is no DumbScriptSystem)
- alias DumbScriptIndex;
Alias for readability.
- DumbScriptIndex scriptIndex;
Index to the script in ControllerSystem.
- bool placeholder;
- uint instruction;
- float instructionTime;
Time we've been executing this instruction for.
- this(ref Node yaml);
Load from a YAML node. Throws YAMLException on error.
- const pure nothrow @property bool done();
- pure nothrow void finish();
Set the script to done, i.e. finished.
- pure nothrow void nextInstruction(const size_t instructionCount);
Move to the next instruction in script.
Parameters:size_t instructionCount Instruction count. If we get to this number of instructions, the script is done.
- struct DumbScript;
Simple script in YAML.
DumbScripts have no flow control and they are composed from a sequence of simple instructions. They are started when the entity is created.
The script is composed from pairs of instructions with their parameters.Example:
!!pairs - for 0.25: move-direction: 0.5 - for 0.5: move-direction: -0.5 move-speed: 0.5 - for 0.5: fire: [0, 1] - die:
Current DumbScript instructions:
for time:Example:
- for 1.0: #For duration of one second move-direction: 0.5 #move in direction of 0.5 radians relative to current rotation move-speed: 0.5 #move at 50% speed fire [0, 2] #fire weapons 0 and 2
Perform an action for specified time (in seconds): Parameters:fire Fire weapons specified in the sequence. As there are only 256 weapon slots, the values must be between >= 0 and <= 255 . die:
Example:
- die: #Kill the entity.
Kill the entity. Any instructions after this are not executed.