Planeshift
|
This embodies any perception an NPC might have, or any game event of interest. More...
#include <perceptions.h>
Public Member Functions | |
virtual void | ExecutePerception (NPC *npc, float weight) |
All preconditions has been checked, now excecute the perception. More... | |
virtual bool | GetLocation (csVector3 &pos, iSector *§or) |
Get a location assosiated with the perception. More... | |
virtual const csString & | GetName () const |
Get the name of the perception. More... | |
virtual float | GetRadius () const |
Get the radius of the perception. More... | |
virtual gemNPCObject * | GetTarget () |
Some perception has a target/source. More... | |
const csString & | GetType () const |
Get the type of the perception. More... | |
virtual Perception * | MakeCopy () |
Make a copy of this perception. More... | |
Perception (const char *name) | |
Constructor. More... | |
Perception (const char *name, const char *type) | |
Constructor. More... | |
void | SetType (const char *type) |
Set the type of the perception. More... | |
virtual bool | ShouldReact (Reaction *reaction, NPC *npc) |
Check if this perception should react to a reaction. More... | |
virtual csString | ToString (NPC *npc) |
Get a text description of the perception. More... | |
virtual | ~Perception () |
Destructor. More... | |
Protected Attributes | |
csString | name |
The name of this perception. More... | |
csString | type |
Type used by perceptions. Usally they correspond to the same value in a reaction. More... | |
This embodies any perception an NPC might have, or any game event of interest.
Reaction objects below will subscribe to these events, and the networking system will publish them. Examples would be "attacked", "collided", "talked to", "hear cry".
Definition at line 55 of file perceptions.h.
|
inline |
Constructor.
name | The name of the perception. |
Definition at line 68 of file perceptions.h.
|
inline |
Constructor.
name | The name of the perception. |
type | The type for this perception. |
Definition at line 76 of file perceptions.h.
|
inlinevirtual |
Destructor.
Definition at line 81 of file perceptions.h.
All preconditions has been checked, now excecute the perception.
npc | The target of the percpetion. |
weight | Indicate how much the HateList of the npc should be changed. Value comes from the reaction. |
Reimplemented in OwnerActionPerception, OwnerCmdPerception, DeathPerception, SpellPerception, DamagePerception, GroupAttackPerception, AttackPerception, and FactionPerception.
|
virtual |
Get a location assosiated with the perception.
Some perception might hold a location. Default impl get location from target if there is one.
pos | The position of the location. |
sector | The sector of the location. |
Reimplemented in InventoryPerception, PositionPerception, and LocationPerception.
|
virtual |
Get the name of the perception.
This name has to be const since it is used in the registered reaction chache to find the reactions and npcs that should have this perception.
|
inlinevirtual |
Get the radius of the perception.
Reimplemented in InventoryPerception, PositionPerception, and LocationPerception.
Definition at line 160 of file perceptions.h.
|
inlinevirtual |
Some perception has a target/source.
Reimplemented in OwnerCmdPerception, SpellPerception, DamagePerception, AttackPerception, ItemPerception, and FactionPerception.
Definition at line 115 of file perceptions.h.
const csString& Perception::GetType | ( | ) | const |
Get the type of the perception.
|
virtual |
Make a copy of this perception.
Reimplemented in NPCCmdPerception, OwnerActionPerception, OwnerCmdPerception, InventoryPerception, DeathPerception, SpellPerception, DamagePerception, GroupAttackPerception, AttackPerception, PositionPerception, LocationPerception, ItemPerception, FactionPerception, and TimePerception.
void Perception::SetType | ( | const char * | type | ) |
Set the type of the perception.
In most cases this can be done through the constructor Perception::Perception(const char*,const char*).
Check if this perception should react to a reaction.
reaction | The reaction to check for. |
npc | The NPC that might receive this. |
Reimplemented in NPCCmdPerception, OwnerActionPerception, OwnerCmdPerception, SpellPerception, FactionPerception, and TimePerception.
|
virtual |
Get a text description of the perception.
Reimplemented in TimePerception.
|
protected |
The name of this perception.
Definition at line 58 of file perceptions.h.
|
protected |
Type used by perceptions. Usally they correspond to the same value in a reaction.
Definition at line 60 of file perceptions.h.