component.dumbscriptcomponent - ICE 0.1 API documentation

ICE 0.1 API documentation

# 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;

    Using a placeholder dumbScript?

  uint instruction;

    Which script instruction are we at?

  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();

    Are we done with the script?

  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.
  this(Node yaml);

    Load a DumbScript from specified file.

  void control(ref ControllerComponent control, ref DumbScriptComponent script, const real timeStep);

    Control a ControllerComponent by this DumbScript.

    Parameters:

    ControllerComponent control | ControllerComponent of the entity to control.
    DumbScriptComponent script | DumbScriptComponent of the entity, containing current execution state of the script.
    real timeStep | Game time step.

Copyright © Ferdinand Majerech 2011. | Page generated by AutoDDoc and Ddoc.