Planeshift
NPCType Class Reference

A collection of behaviors and reactions will represent a type of npc. More...

#include <npcbehave.h>

Public Member Functions

void Advance (csTicks delta, NPC *npc)
 
void ClearState (NPC *npc)
 
void DeepCopy (NPCType &other)
 
void DumpBehaviorList (csString &output, NPC *npc)
 
void DumpReactionList (csString &output, NPC *npc)
 Dump the reaction list for this NPC. More...
 
BehaviorFind (const char *name)
 Find a behavior in the set. More...
 
void FirePerception (NPC *npc, Perception *pcpt)
 
float GetAngularVelocity (NPC *npc)
 Return the angular velociy of the NPC. More...
 
const csString & GetCollisionPerception () const
 Return the percpetion to fire for collisions. More...
 
BehaviorGetCurrentBehavior ()
 
const csString & GetFallingPerception () const
 Return the percpetion to fire for falling. More...
 
float GetHighestNeed (NPC *npc)
 Return hight current or new need. More...
 
const csString & GetInBoundsPerception () const
 Return the percpetion to fire for InBound. More...
 
const char * GetName ()
 
const csString & GetOutOfBoundsPerception () const
 Return the percpetion to fire for OutOfBounds. More...
 
float GetVelocity (NPC *npc)
 Return the velociy of the NPC. More...
 
csString InfoBehaviors (NPC *npc)
 
csString InfoReactions (NPC *npc)
 Info about the reaction list for debug. More...
 
void Interrupt (NPC *npc)
 
bool Load (iDocumentNode *node)
 
bool Load (iResultRow &node)
 
 NPCType ()
 
 NPCType (NPCType &other, NPC *npc)
 
void SetVelSource (ScriptOperation::VelSource velSource, float vel)
 Set a new velocity source. More...
 
 ~NPCType ()
 

Protected Attributes

float ang_vel
 Default ang_vel for this NPCType. < Will be used for all behaviors unless overriden < by each behavior. More...
 
BehaviorSet behaviors
 The set of behaviors available for this NPCType. More...
 
csString collisionPerception
 Global perception value for falling. More...
 
csString fallingPerception
 Global perception value for falling. More...
 
csString inBoundsPerception
 Global perception value for falling. More...
 
csString name
 The name of this NPC type. More...
 
NPCnpc
 Pointer to the NPC for this brain. More...
 
csString outOfBoundsPerception
 Global perception value for falling. More...
 
csPDelArray< Reactionreactions
 The reactions available for this NPCType. More...
 
float vel
 Default vel for this NPCType. < Will be used for all behaviors unless overriden < by each behavior. More...
 
ScriptOperation::VelSource velSource
 

Detailed Description

A collection of behaviors and reactions will represent a type of npc.

Each npc will be assigned one of these types. This lets us reuse the same script for many mobs at once–each one keeping its own state information.

Definition at line 197 of file npcbehave.h.

Constructor & Destructor Documentation

NPCType::NPCType ( )
NPCType::NPCType ( NPCType other,
NPC npc 
)
NPCType::~NPCType ( )

Member Function Documentation

void NPCType::Advance ( csTicks  delta,
NPC npc 
)
void NPCType::ClearState ( NPC npc)
void NPCType::DeepCopy ( NPCType other)
void NPCType::DumpBehaviorList ( csString &  output,
NPC npc 
)
inline

Definition at line 248 of file npcbehave.h.

void NPCType::DumpReactionList ( csString &  output,
NPC npc 
)

Dump the reaction list for this NPC.

Parameters
npcThe NPC that own this BehaviorSet.
Behavior* NPCType::Find ( const char *  name)
inline

Find a behavior in the set.

Search the set for a behavior maching the given name.

Parameters
nameThe name to search for.
Returns
The behavior or NULL if no behavior is found.

Definition at line 239 of file npcbehave.h.

void NPCType::FirePerception ( NPC npc,
Perception pcpt 
)
float NPCType::GetAngularVelocity ( NPC npc)

Return the angular velociy of the NPC.

Parameters
npcThe NPC that own this BehaviorSet.
const csString& NPCType::GetCollisionPerception ( ) const

Return the percpetion to fire for collisions.

Behavior* NPCType::GetCurrentBehavior ( )
inline

Definition at line 269 of file npcbehave.h.

const csString& NPCType::GetFallingPerception ( ) const

Return the percpetion to fire for falling.

float NPCType::GetHighestNeed ( NPC npc)

Return hight current or new need.

Parameters
npcThe NPC that own this BehaviorSet.
const csString& NPCType::GetInBoundsPerception ( ) const

Return the percpetion to fire for InBound.

The percepton to fire when a NPC with a region move back inside the region.

const char* NPCType::GetName ( )
inline

Definition at line 227 of file npcbehave.h.

const csString& NPCType::GetOutOfBoundsPerception ( ) const

Return the percpetion to fire for OutOfBounds.

The percepton to fire when a NPC with a region is moving outside the region.

float NPCType::GetVelocity ( NPC npc)

Return the velociy of the NPC.

Parameters
npcThe NPC that own this BehaviorSet.
csString NPCType::InfoBehaviors ( NPC npc)
inline

Definition at line 252 of file npcbehave.h.

csString NPCType::InfoReactions ( NPC npc)

Info about the reaction list for debug.

Parameters
npcThe NPC that own this BehaviorSet.
void NPCType::Interrupt ( NPC npc)
bool NPCType::Load ( iDocumentNode *  node)
bool NPCType::Load ( iResultRow &  node)
void NPCType::SetVelSource ( ScriptOperation::VelSource  velSource,
float  vel 
)

Set a new velocity source.

Member Data Documentation

float NPCType::ang_vel
protected

Default ang_vel for this NPCType. < Will be used for all behaviors unless overriden < by each behavior.

Definition at line 204 of file npcbehave.h.

BehaviorSet NPCType::behaviors
protected

The set of behaviors available for this NPCType.

Definition at line 203 of file npcbehave.h.

csString NPCType::collisionPerception
protected

Global perception value for falling.

Definition at line 212 of file npcbehave.h.

csString NPCType::fallingPerception
protected

Global perception value for falling.

Definition at line 215 of file npcbehave.h.

csString NPCType::inBoundsPerception
protected

Global perception value for falling.

Definition at line 214 of file npcbehave.h.

csString NPCType::name
protected

The name of this NPC type.

Definition at line 201 of file npcbehave.h.

NPC* NPCType::npc
protected

Pointer to the NPC for this brain.

Definition at line 200 of file npcbehave.h.

csString NPCType::outOfBoundsPerception
protected

Global perception value for falling.

Definition at line 213 of file npcbehave.h.

csPDelArray<Reaction> NPCType::reactions
protected

The reactions available for this NPCType.

Definition at line 202 of file npcbehave.h.

float NPCType::vel
protected

Default vel for this NPCType. < Will be used for all behaviors unless overriden < by each behavior.

Definition at line 207 of file npcbehave.h.

ScriptOperation::VelSource NPCType::velSource
protected

Definition at line 210 of file npcbehave.h.


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