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. | |
virtual bool | GetLocation (csVector3 &pos, iSector *§or) |
Get a location assosiated with the perception. | |
virtual const csString & | GetName () const |
Get the name of the perception. | |
virtual float | GetRadius () const |
Get the radius of the perception. | |
virtual gemNPCObject * | GetTarget () |
Some perception has a target/source. | |
const csString & | GetType () const |
Get the type of the perception. | |
virtual Perception * | MakeCopy () |
Make a copy of this perception. | |
Perception (const char *name) | |
Constructor. | |
Perception (const char *name, const char *type) | |
Constructor. | |
void | SetType (const char *type) |
Set the type of the perception. | |
virtual bool | ShouldReact (Reaction *reaction, NPC *npc) |
Check if this perception should react to a reaction. | |
virtual csString | ToString (NPC *npc) |
Get a text description of the perception. | |
virtual | ~Perception () |
Destructor. | |
Protected Attributes | |
csString | name |
The name of this perception. | |
csString | type |
Type used by perceptions. Usally they correspond to the same value in a reaction. |
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 58 of file perceptions.h.
Perception::Perception | ( | const char * | name | ) | [inline] |
Constructor.
name | The name of the perception. |
Definition at line 71 of file perceptions.h.
Perception::Perception | ( | const char * | name, |
const char * | type | ||
) | [inline] |
Constructor.
name | The name of the perception. |
type | The type for this perception. |
Definition at line 79 of file perceptions.h.
virtual Perception::~Perception | ( | ) | [inline, virtual] |
Destructor.
Definition at line 84 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 FactionPerception, AttackPerception, GroupAttackPerception, DamagePerception, SpellPerception, DeathPerception, OwnerCmdPerception, and OwnerActionPerception.
virtual bool Perception::GetLocation | ( | csVector3 & | pos, |
iSector *& | sector | ||
) | [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 LocationPerception, PositionPerception, and InventoryPerception.
virtual const csString& Perception::GetName | ( | ) | const [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.
virtual float Perception::GetRadius | ( | ) | const [inline, virtual] |
Get the radius of the perception.
Reimplemented in LocationPerception, PositionPerception, and InventoryPerception.
Definition at line 163 of file perceptions.h.
virtual gemNPCObject* Perception::GetTarget | ( | ) | [inline, virtual] |
Some perception has a target/source.
Reimplemented in FactionPerception, ItemPerception, AttackPerception, DamagePerception, SpellPerception, and OwnerCmdPerception.
Definition at line 118 of file perceptions.h.
const csString& Perception::GetType | ( | ) | const |
Get the type of the perception.
virtual Perception* Perception::MakeCopy | ( | ) | [virtual] |
Make a copy of this perception.
Reimplemented in TimePerception, FactionPerception, ItemPerception, LocationPerception, PositionPerception, AttackPerception, GroupAttackPerception, DamagePerception, SpellPerception, DeathPerception, InventoryPerception, OwnerCmdPerception, OwnerActionPerception, and NPCCmdPerception.
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 TimePerception, FactionPerception, SpellPerception, OwnerCmdPerception, OwnerActionPerception, and NPCCmdPerception.
virtual csString Perception::ToString | ( | NPC * | npc | ) | [virtual] |
Get a text description of the perception.
Reimplemented in TimePerception.
csString Perception::name [protected] |
The name of this perception.
Definition at line 61 of file perceptions.h.
csString Perception::type [protected] |
Type used by perceptions. Usally they correspond to the same value in a reaction.
Definition at line 63 of file perceptions.h.