iPcSpawn Struct Reference
Spawn property class. More...
#include <propclass/spawn.h>
Public Member Functions | |
virtual void | AddEntityTemplateType (float chance, const char *templ, const char *name, const char *msg_id, iCelParameterBlock *params)=0 |
Add an entry to the list of entities that can be created by this property class. | |
virtual void | AddEntityType (float chance, const char *name, iCelBlLayer *bl, const char *behaviour, const char *msg_id, iCelParameterBlock *params,...)=0 |
Add an entry to the list of entities that can be created by this property class. | |
virtual void | AddSpawnPosition (const csVector3 &pos, float yrot, const char *sector)=0 |
Set positional information about where to spawn. | |
virtual void | AddSpawnPosition (const char *node, float yrot, const char *sector)=0 |
Set positional information about where to spawn. | |
virtual void | ClearEntityList ()=0 |
Clear the list of entities to create. | |
virtual void | EnableSpawnUnique (bool en)=0 |
This is useful in combination with a disabled entity name counter (SetEntityNameCounter(false)). | |
virtual void | InhibitCount (int number)=0 |
Inhibit respawn in case count will reach given number. | |
virtual bool | IsEnabled () const =0 |
Is spawning enabled. | |
virtual bool | IsEntityNameCounterCounter () const =0 |
Return true if the unique entity name counter is enabled. | |
virtual bool | IsSpawnUniqueEnabled () const =0 |
Return true if spawn unique is enabled. | |
virtual void | ResetTiming ()=0 |
Reset timing. | |
virtual void | SetEnabled (bool e)=0 |
Enable/disable spawning. | |
virtual void | SetEntityNameCounter (bool en)=0 |
Enable/disable entity name counter. | |
virtual void | SetTiming (bool repeat, bool random, csTicks mindelay, csTicks maxdelay)=0 |
Set timing information. | |
virtual void | Spawn ()=0 |
Spawn at this moment any random entity from a list. |
Detailed Description
Spawn property class.This property class is responsible for creating other entities based on time related rules.
This property class supports the following actions (add prefix 'cel.action.' to get the ID of the action and add prefix 'cel.parameter.' to get the ID of the parameter):
- AddEntityType: parameters 'chance' (float), 'entity' (string), 'behaviour' (string), 'layer' (string), 'call' (string)
- AddEntityTemplateType: parameters 'chance' (float), 'entity' (string), 'template' (string), 'call' (string)
- SetTiming: parameters 'repeat' (bool), 'random' (bool), 'mindelay' (long), 'maxdelay' (long)
- ResetTiming
- SetEnabled: parameters 'enabled' (bool)
- ClearEntityList
- Inhibit: parameters 'count' (long)
- Spawn
- AddSpawnPosition: parameters 'sector' (string), 'yrot' (float), 'position' (vector or name of the node)
This property class supports the following properties (add prefix 'cel.property.' to get the ID of the property:
- namecounter (bool, read/write): enable/disable unique name counter (default true).
- spawnunique (bool, read/write): enable/disable prevention of spawning of entities with same name (default false).
This property class can send out the following messages to the behaviour (add prefix 'cel.parameter.' to get the ID for parameters):
- pcspawn_newentity: new entity has been created (entity,behaviour)
Definition at line 60 of file spawn.h.
Member Function Documentation
virtual void iPcSpawn::AddEntityTemplateType | ( | float | chance, | |
const char * | templ, | |||
const char * | name, | |||
const char * | msg_id, | |||
iCelParameterBlock * | params | |||
) | [pure virtual] |
Add an entry to the list of entities that can be created by this property class.
This version works with templates.
- Parameters:
-
chance is a number indicating the chance of this entity being selected (only relevant if 'random' selection is being used). templ is the name of the template from which to create entity. name is the name of the entity that will be created. (can be 0 then got template name) msg_id if not 0 then we immediatelly send this message to the behaviour of the new entity after creating it. params is the parameter block that is used to send the message (can be 0).
virtual void iPcSpawn::AddEntityType | ( | float | chance, | |
const char * | name, | |||
iCelBlLayer * | bl, | |||
const char * | behaviour, | |||
const char * | msg_id, | |||
iCelParameterBlock * | params, | |||
... | ||||
) | [pure virtual] |
Add an entry to the list of entities that can be created by this property class.
- Parameters:
-
chance is a number indicating the chance of this entity being selected (only relevant if 'random' selection is being used). name is the name of the entity that will be created. bl is the behaviour layer (can be 0). behaviour is the name of the behaviour (can be 0). msg_id if not 0 then we immediatelly send this message to the behaviour of the new entity after creating it. params is the parameter block that is used to send the message (can be 0). ... is a list of property class names.
virtual void iPcSpawn::AddSpawnPosition | ( | const csVector3 & | pos, | |
float | yrot, | |||
const char * | sector | |||
) | [pure virtual] |
Set positional information about where to spawn.
This version accepts position vector
virtual void iPcSpawn::AddSpawnPosition | ( | const char * | node, | |
float | yrot, | |||
const char * | sector | |||
) | [pure virtual] |
Set positional information about where to spawn.
This version accepts name of the node
virtual void iPcSpawn::ClearEntityList | ( | ) | [pure virtual] |
Clear the list of entities to create.
virtual void iPcSpawn::EnableSpawnUnique | ( | bool | en | ) | [pure virtual] |
This is useful in combination with a disabled entity name counter (SetEntityNameCounter(false)).
In spawn unique is true then spawning will not occur if the entity with that name is already in existance. By default this is false.
virtual void iPcSpawn::InhibitCount | ( | int | number | ) | [pure virtual] |
Inhibit respawn in case count will reach given number.
virtual bool iPcSpawn::IsEnabled | ( | ) | const [pure virtual] |
Is spawning enabled.
virtual bool iPcSpawn::IsEntityNameCounterCounter | ( | ) | const [pure virtual] |
Return true if the unique entity name counter is enabled.
virtual bool iPcSpawn::IsSpawnUniqueEnabled | ( | ) | const [pure virtual] |
Return true if spawn unique is enabled.
virtual void iPcSpawn::ResetTiming | ( | ) | [pure virtual] |
Reset timing.
In case of a non repeating spawner this will enable the spawn again so that it will do a new spawn in the specified time. In case of a repeating spawner it will simply reset the time to zero. In case of non random selection this function will also set the sequence of entities back to the first one.
virtual void iPcSpawn::SetEnabled | ( | bool | e | ) | [pure virtual] |
Enable/disable spawning.
Enabled by default although the spawner will only start working after the first SetTiming() call.
virtual void iPcSpawn::SetEntityNameCounter | ( | bool | en | ) | [pure virtual] |
Enable/disable entity name counter.
With this enabled (default) every entity will get a unique name formed by the name given in AddEntityTemplateType() and a unique number. With this disabled this will not occur.
virtual void iPcSpawn::SetTiming | ( | bool | repeat, | |
bool | random, | |||
csTicks | mindelay, | |||
csTicks | maxdelay | |||
) | [pure virtual] |
Set timing information.
- Parameters:
-
repeat if true then this spawner will keep spawning. Otherwise it spawns only once unless Reset() is called. random if true then we will select a random entity and random position from our list. Otherwise we select sequentially. mindelay is the minimum delay to wait before spawning. maxdelay is the maximum delay to wait before spawning.
virtual void iPcSpawn::Spawn | ( | ) | [pure virtual] |
Spawn at this moment any random entity from a list.
The documentation for this struct was generated from the following file:
- propclass/spawn.h
Generated for CEL: Crystal Entity Layer by doxygen 1.4.7