## Public API Reference

- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iPcSpawn Struct Reference

Spawn property class. More...

`#include <propclass/spawn.h>`

List of all members.

## Public Member Functions

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 | ClearEntityList ()=0
| Clear the list of entities to create.
virtual bool | IsEnabled () const =0
| Is spawning enabled.
virtual void | Reset ()=0
| Reset timing.
virtual void | SetEnabled (bool e)=0
| Enable/disable spawning.
virtual void | SetTiming (bool repeat, bool random, csTicks mindelay, csTicks maxdelay)=0
| Set timing information.

## Detailed Description

Spawn property class.

This property class is responsible for creating other entities based on time related rules.

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 38 of file spawn.h.

## Member Function Documentation

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::ClearEntityList | ( |  | ) | `[pure virtual]`

| Clear the list of entities to create.

virtual bool iPcSpawn::IsEnabled | ( |  | ) | const`[pure virtual]`

| Is spawning enabled.

virtual void iPcSpawn::Reset | ( |  | ) | `[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::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 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.

The documentation for this struct was generated from the following file:

- propclass/spawn.h