Planeshift
NPC Class Reference

This object represents each NPC managed by this superclient. More...

#include <npc.h>

Classes

struct  Locate
 Structure to hold located positions. More...
 

Public Types

enum  {
  LOCATION_NONE = 0, LOCATION_POS = 1, LOCATION_SECTOR = 2, LOCATION_ANGLE = 4,
  LOCATION_WP = 8, LOCATION_RADIUS = 16, LOCATION_TARGET = 32, LOCATION_ALL = -1
}
 
typedef csHash< Locate *, csString > LocateHash
 

Public Member Functions

void AddAutoMemorize (csString types)
 Add new types to the autoMemorize store. More...
 
void AddToHateList (gemNPCActor *attacker, float delta)
 Change the hate list value for an attacker. More...
 
void CheckPosition ()
 
void ClearState ()
 Clear the NPCs state. More...
 
bool ContainAutoMemorizeType (const csString &type)
 Check if the type is contained in the NPC autoMemorize store. More...
 
bool CopyLocate (csString source, csString destination, unsigned int flags)
 Copy locates. More...
 
bool Delete ()
 Remove this NPC from npc_definitions. More...
 
void Disable (bool disable=true)
 
void Dump ()
 Dump all information for one NPC to the console. More...
 
void DumpBehaviorList (csString &output)
 Dump all behaviors for npc. More...
 
void DumpControlled (csString &output)
 Dump the controlled npcs for npc. More...
 
void DumpDebugLog (csString &output)
 Dump the debug log for npc. More...
 
void DumpHateList (csString &output)
 Dump all hated entities for npc. More...
 
void DumpHateList (NPC *npc)
 Dump all hated entities for npc. More...
 
void DumpMemory (csString &output)
 Dump the memory for npc. More...
 
void DumpReactionList (csString &output)
 Dump all reactions for npc. More...
 
void DumpState (csString &output)
 Dump all state information for npc. More...
 
void GetActiveLocate (csVector3 &pos, iSector *&sector, float &rot)
 Get the NPCs current active locate. More...
 
void GetActiveLocate (Waypoint *&wp)
 Return the wp of the current active locate. More...
 
float GetActiveLocateRadius () const
 Get the radius of the last locate operatoins. More...
 
gemNPCActorGetActor ()
 
float GetAngularVelocity ()
 Return the angular velocity of this NPC. More...
 
NPCTypeGetBrain ()
 
csString GetBuffer (const csString &bufferName)
 Return a named buffer from the NPC. More...
 
Tribe::MemoryGetBufferMemory ()
 Retrive the current buffer memory of the npc. More...
 
Tribe::AssetGetBuildingSpot ()
 Get the stored building spot for this NPC. More...
 
BehaviorGetCurrentBehavior ()
 
uint8_t GetDRCounter (csTicks when, const csVector3 &pos, float yRot, iSector *sector, const csVector3 &vel, float angVel)
 
EID GetEID ()
 Return the entity ID if an entity exist else 0. More...
 
float GetEntityHate (gemNPCActor *entity)
 Retrive the hate this NPC has to a given entity. More...
 
int GetFallCounter ()
 Return the fall counter. More...
 
float GetHP ()
 Get the npc HP. More...
 
float GetHPRate () const
 Get the npc HPRate. More...
 
PerceptionGetLastPerception ()
 
psLinearMovementGetLinMove ()
 
float GetMana ()
 Get the npc Mana. More...
 
float GetManaRate () const
 Get the npc ManaRate. More...
 
float GetMaxHP () const
 Get the npc MaxHP. More...
 
float GetMaxMana () const
 Get the npc MaxMana. More...
 
float GetMaxMenStamina () const
 Get the npc MaxMenStamina. More...
 
float GetMaxPysStamina () const
 Get the npc MaxPysStamina. More...
 
float GetMenStamina ()
 Get the npc MenStamina. More...
 
float GetMenStaminaRate () const
 Get the npc MenStaminaRate. More...
 
gemNPCActorGetMostHated (float range, bool includeOutsideRegion, bool includeInvisible, bool includeInvincible, float *hate=NULL)
 Find the most hated entity within range of the NPC. More...
 
gemNPCActorGetMostHated (csVector3 &pos, iSector *sector, float range, LocationType *region, bool includeOutsideRegion, bool includeInvisible, bool includeInvincible, float *hate)
 Find the most hated entity within range of a given position. More...
 
iMovable * GetMovable ()
 
const char * GetName ()
 
gemNPCActorGetNearestActor (float range, csVector3 &destPosition, iSector *&destSector, float &destRange)
 Return the nearest actor within the given range. More...
 
gemNPCActorGetNearestDeadActor (float range)
 
gemNPCActorGetNearestNPC (float range, csVector3 &destPosition, iSector *&destSector, float &destRange)
 Return the nearest NPC within the given range. More...
 
gemNPCActorGetNearestPlayer (float range, csVector3 &destPosition, iSector *&destSector, float &destRange)
 Return the nearest player within the given range. More...
 
gemNPCActorGetNearestVisibleFriend (float range)
 
const char * GetOrigBrainType ()
 
gemNPCObjectGetOwner ()
 
const char * GetOwnerName ()
 
PID GetPID ()
 
float GetPysStamina ()
 Get the npc PysStamina. More...
 
float GetPysStaminaRate () const
 Get the npc PysStaminaRate. More...
 
psNPCRaceListMessage::NPCRaceInfo_tGetRaceInfo ()
 Get the npc race info. More...
 
LocationTypeGetRegion ()
 
csString & GetRegionName ()
 
float GetRunVelocity ()
 Return the run velocity for this NPC. More...
 
const csVector3 & GetSpawnPosition () const
 Return the position part of the spawn position. More...
 
iSector * GetSpawnSector () const
 Return the sector part of the spawn position. More...
 
gemNPCObjectGetTarget ()
 
TribeGetTribe ()
 Get the tribe this npc belongs to. More...
 
const csString & GetTribeMemberType () const
 Return the type/class for this NPC's tribe membership if any. More...
 
float GetVelocity ()
 Return the ?override? velocity for this NPC. More...
 
float GetWalkVelocity ()
 Return the walk velocity for this NPC. More...
 
bool HasAutoMemorizeTypes () const
 Check if the NPC has anything to automemorize. More...
 
void IncrementFallCounter ()
 Increment the fall counter. More...
 
csString Info (const csString &infoRequestSubCmd)
 Provide info about the NPC. More...
 
bool InsertCopy (PID use_char_id, PID ownerPID)
 Insert a new copy of NPC into npc_definitions. More...
 
bool IsAlive () const
 
bool IsDisabled ()
 
bool IsInsideRegion ()
 Check the inside region state of the npc. More...
 
bool IsInsideTribeHome ()
 Check the inside tribe home state of the npc. More...
 
bool Load (iResultRow &row, csHash< NPCType *, const char * > &npctypes, EventManager *eventmanager, PID usePID)
 Loads an NPC from one row of sc_npc_definitions, it also loads the corresponding brain. More...
 
void Load (const char *name, PID pid, NPCType *type, const char *region_name, int debugging, bool disabled, EventManager *eventmanager)
 Loads an NPC base information and his brain. More...
 
 NPC (psNPCClient *npcclient, NetworkManager *networkmanager, psWorld *world, iEngine *engine, iCollideSystem *cdsys)
 
void ReleaseControl (gemNPCActor *actor)
 Release control of another controlled entity. More...
 
void RemoveAutoMemorize (csString types)
 Remove types from the autoMemorize store. More...
 
void RemoveFromHateList (EID who)
 Remove a entity from the hate list. More...
 
void ReplaceBuffers (csString &result)
 Replace $NBUFFER[x] with values from the NPC buffer. More...
 
void ReplaceLocations (csString &result)
 Replace a location. More...
 
void ScopedTimerCallback (const ScopedTimer *timer)
 Callback for debug scope timers. More...
 
void SetActor (gemNPCActor *actor)
 
void SetAlive (bool a)
 
void SetBrain (NPCType *type)
 Sets a new brain (npctype) to this npc. More...
 
void SetBuffer (const csString &bufferName, const csString &value)
 Set/Update the value of a named buffer. More...
 
void SetBufferMemory (Tribe::Memory *memory)
 Set a new buffer memory for the NPC. More...
 
void SetBuildingSpot (Tribe::Asset *buildingSpot)
 Set a building spot for this NPC. More...
 
void SetDRCounter (uint8_t counter)
 
void SetInsideRegion (bool inside)
 Set the inside region state. More...
 
void SetInsideTribeHome (bool inside)
 Set the inside tribe home state. More...
 
void SetLastPerception (Perception *pcpt)
 
void SetLocate (const csString &destination, const NPC::Locate &locate)
 Set the NPCs locate. More...
 
void SetOwner (EID owner_EID)
 Sets the owner of this npc. More...
 
void SetTarget (gemNPCObject *t)
 
void SetTribe (Tribe *new_tribe)
 Set a new tribe for this npc. More...
 
void SetTribeMemberType (const char *tribeMemberType)
 Set the type/class for this npc in a tribe. More...
 
void StoreSpawnPosition ()
 Store the start position. More...
 
void TakeControl (gemNPCActor *actor)
 Take control of another entity. More...
 
void Tick ()
 
void TriggerEvent (Perception *pcpt, float maxRange=-1.0, csVector3 *basePos=NULL, iSector *baseSector=NULL, bool sameSector=false)
 Send a perception to this NPC. More...
 
void TriggerEvent (const char *pcpt)
 Send a perception to this NPC. More...
 
void UpdateControlled ()
 Update entities controlled by this NPC. More...
 
virtual ~NPC ()
 
- Public Member Functions inherited from iScriptableVar
virtual ~iScriptableVar ()
 
- Public Member Functions inherited from RemoteDebug
void AddDebugClient (uint clientNum, int debugLevel)
 Add a client to receive debug information. More...
 
int GetDebugging () const
 Get the local debugging level. More...
 
csString GetRemoteDebugClientsString () const
 Utility function to retrive a string with all remote debugging clients for debug outputs. More...
 
bool IsDebugging ()
 Check if debugging is enabled. More...
 
bool IsDebugging (int debugLevel)
 Check if this NPC is debugging at the given level. More...
 
void Printf (int debugLevel, const char *msg,...)
 Function to generate a debug print. More...
 
 RemoteDebug ()
 Constructor. More...
 
void RemoveDebugClient (uint clientNum)
 Remove client from list of debug receivers. More...
 
void SetDebugging (int debugLevel)
 Set a new debug level. More...
 
bool SwitchDebugging ()
 Switch the local debuging state. More...
 
virtual ~RemoteDebug ()
 Destructor. More...
 

Protected Types

typedef csHash< csString, csString > BufferHash
 

Protected Member Functions

void Advance (csTicks when)
 
void TickPostProcess (csTicks when)
 Handle post tick processing. More...
 

Protected Attributes

LocateactiveLocate
 The current "Active" locate. More...
 
bool alive
 
float ang_vel
 
csArray< csString > autoMemorizeTypes
 Used to store what types of perceptions to memorize without changing behaviors. More...
 
NPCTypebrain
 
bool checked
 
csVector3 checkedPos
 
bool checkedResult
 
iSector * checkedSector
 
csArray< csWeakRef< gemNPCActor > > controlledActors
 Actors that are dragged/pushed around by this NPC. More...
 
bool disabled
 
uint8_t DRcounter
 
int fallCounter
 
HateList hatelist
 
Stat hp
 
bool insideRegion
 State variable for inside outside region checks. More...
 
bool insideTribeHome
 State variable for inside outside tribe home checks. More...
 
Perceptionlast_perception
 
csTicks last_update
 
float lastDrAngVel
 
bool lastDrMoving
 
csVector3 lastDrPosition
 
iSector * lastDrSector
 
csTicks lastDrTime
 
csVector3 lastDrVel
 
float lastDrYRot
 
Stat mana
 
Stat menStamina
 
iMovable * movable
 
csString name
 
gemNPCActornpcActor
 
NPCTypeoldbrain
 delete at checkpoint More...
 
csString origtype
 Name of NPCType for 'reload'. More...
 
EID owner_id
 
PID pid
 
Stat pysStamina
 
psNPCRaceListMessage::NPCRaceInfo_traceInfo
 
LocationTyperegion
 Cached pointer to the region. More...
 
csString region_name
 Region name as loaded from db. More...
 
float runVelocity
 
float scale
 Model scale value. More...
 
csVector3 spawnPosition
 The stored position that this NPC where spawned. More...
 
iSector * spawnSector
 The stored sector that this NPC where spawned. More...
 
LocateHash storedLocates
 List of stored locate locations. More...
 
EID target_id
 
Tribetribe
 
csString tribeMemberType
 What type/class is this NPC in the tribe. More...
 
csString type
 
float vel
 
float walkVelocity
 
- Protected Attributes inherited from RemoteDebug
csArray< csString > debugLog
 Local debug log of last n print statments. More...
 
int nextDebugLogEntry
 The next entry to use. More...
 

Detailed Description

This object represents each NPC managed by this superclient.

Definition at line 126 of file npc.h.

Member Typedef Documentation

typedef csHash<csString,csString> NPC::BufferHash
protected

Definition at line 157 of file npc.h.

typedef csHash<Locate*,csString> NPC::LocateHash

Definition at line 141 of file npc.h.

Member Enumeration Documentation

anonymous enum
Enumerator
LOCATION_NONE 
LOCATION_POS 
LOCATION_SECTOR 
LOCATION_ANGLE 
LOCATION_WP 
LOCATION_RADIUS 
LOCATION_TARGET 
LOCATION_ALL 

Definition at line 143 of file npc.h.

Constructor & Destructor Documentation

NPC::NPC ( psNPCClient npcclient,
NetworkManager networkmanager,
psWorld world,
iEngine *  engine,
iCollideSystem *  cdsys 
)
virtual NPC::~NPC ( )
virtual

Member Function Documentation

void NPC::AddAutoMemorize ( csString  types)

Add new types to the autoMemorize store.

They should be "," seperated.

void NPC::AddToHateList ( gemNPCActor attacker,
float  delta 
)

Change the hate list value for an attacker.

Parameters
attackerThe entity that should be adjusted.
deltaThe change in hate to apply to the attacker.
void NPC::Advance ( csTicks  when)
protected
void NPC::CheckPosition ( )
void NPC::ClearState ( )

Clear the NPCs state.

Brain, hatelist, etc. is cleared.

bool NPC::ContainAutoMemorizeType ( const csString &  type)

Check if the type is contained in the NPC autoMemorize store.

bool NPC::CopyLocate ( csString  source,
csString  destination,
unsigned int  flags 
)

Copy locates.

Typically used to take backups of "Active" locate.

bool NPC::Delete ( )

Remove this NPC from npc_definitions.

void NPC::Disable ( bool  disable = true)
void NPC::Dump ( )

Dump all information for one NPC to the console.

The main use of this fuction is the "print \<pid\>" npcclient console command.

void NPC::DumpBehaviorList ( csString &  output)

Dump all behaviors for npc.

void NPC::DumpControlled ( csString &  output)

Dump the controlled npcs for npc.

void NPC::DumpDebugLog ( csString &  output)

Dump the debug log for npc.

void NPC::DumpHateList ( csString &  output)

Dump all hated entities for npc.

void NPC::DumpHateList ( NPC npc)

Dump all hated entities for npc.

Using debug prints at level 5.

void NPC::DumpMemory ( csString &  output)

Dump the memory for npc.

void NPC::DumpReactionList ( csString &  output)

Dump all reactions for npc.

void NPC::DumpState ( csString &  output)

Dump all state information for npc.

void NPC::GetActiveLocate ( csVector3 &  pos,
iSector *&  sector,
float rot 
)

Get the NPCs current active locate.

void NPC::GetActiveLocate ( Waypoint *&  wp)

Return the wp of the current active locate.

Parameters
wpwill be set with the wp currently in the active locate.
float NPC::GetActiveLocateRadius ( ) const

Get the radius of the last locate operatoins.

Returns
The radius of the last locate
gemNPCActor* NPC::GetActor ( )
inline

Definition at line 289 of file npc.h.

float NPC::GetAngularVelocity ( )

Return the angular velocity of this NPC.

NPCType* NPC::GetBrain ( )
csString NPC::GetBuffer ( const csString &  bufferName)

Return a named buffer from the NPC.

Function used to get data from buffers containing information.

Parameters
bufferNameThe buffer name.
Returns
The content of the named buffer.
Tribe::Memory* NPC::GetBufferMemory ( )
inline

Retrive the current buffer memory of the npc.

Definition at line 843 of file npc.h.

Tribe::Asset* NPC::GetBuildingSpot ( )

Get the stored building spot for this NPC.

Behavior* NPC::GetCurrentBehavior ( )
uint8_t NPC::GetDRCounter ( csTicks  when,
const csVector3 &  pos,
float  yRot,
iSector *  sector,
const csVector3 &  vel,
float  angVel 
)
inline

Definition at line 252 of file npc.h.

EID NPC::GetEID ( )

Return the entity ID if an entity exist else 0.

float NPC::GetEntityHate ( gemNPCActor entity)

Retrive the hate this NPC has to a given entity.

Parameters
entityThe entity to check for hate.
Returns
the hate value
int NPC::GetFallCounter ( )
inline

Return the fall counter.

Fall counter is used for debugging.

Definition at line 810 of file npc.h.

float NPC::GetHP ( )

Get the npc HP.

float NPC::GetHPRate ( ) const

Get the npc HPRate.

Perception* NPC::GetLastPerception ( )
inline

Definition at line 418 of file npc.h.

psLinearMovement* NPC::GetLinMove ( )
float NPC::GetMana ( )

Get the npc Mana.

float NPC::GetManaRate ( ) const

Get the npc ManaRate.

float NPC::GetMaxHP ( ) const

Get the npc MaxHP.

float NPC::GetMaxMana ( ) const

Get the npc MaxMana.

float NPC::GetMaxMenStamina ( ) const

Get the npc MaxMenStamina.

float NPC::GetMaxPysStamina ( ) const

Get the npc MaxPysStamina.

float NPC::GetMenStamina ( )

Get the npc MenStamina.

float NPC::GetMenStaminaRate ( ) const

Get the npc MenStaminaRate.

gemNPCActor* NPC::GetMostHated ( float  range,
bool  includeOutsideRegion,
bool  includeInvisible,
bool  includeInvincible,
float hate = NULL 
)

Find the most hated entity within range of the NPC.

Check the hate list and retrive most hated entity within range.

Parameters
rangeThe range to search for hated entities.
includeOutsideRegionInclude enties outside region in the search.
includeInvisibleInclude invisible entities in the search.
includeInvincibleInclude invincible entities in the search.
hateIf diffrent from NULL, set upon return to the hate of the hated.
Returns
The hated entity
gemNPCActor* NPC::GetMostHated ( csVector3 &  pos,
iSector *  sector,
float  range,
LocationType region,
bool  includeOutsideRegion,
bool  includeInvisible,
bool  includeInvincible,
float hate 
)

Find the most hated entity within range of a given position.

Check the hate list and retrive most hated entity within range.

Parameters
posThe position
sectorThe sector of the position
rangeThe range to search for hated entities.
regionThe region to search for hated entities within.
includeOutsideRegionInclude enties outside region in the search.
includeInvisibleInclude invisible entities in the search.
includeInvincibleInclude invincible entities in the search.
hateIf diffrent from NULL, set upon return to the hate of the hated.
Returns
The hated entity
iMovable* NPC::GetMovable ( )
inline

Definition at line 246 of file npc.h.

const char* NPC::GetName ( )
inline

Definition at line 293 of file npc.h.

gemNPCActor* NPC::GetNearestActor ( float  range,
csVector3 &  destPosition,
iSector *&  destSector,
float destRange 
)

Return the nearest actor within the given range.

Parameters
rangeThe search range to look for players
destPositionReturn the position of the target
destSectorReturn the sector of the target
destRangeReturn the range to the target
Returns
The actor of the nearest player or NPC or NULL if none within range
gemNPCActor* NPC::GetNearestDeadActor ( float  range)
gemNPCActor* NPC::GetNearestNPC ( float  range,
csVector3 &  destPosition,
iSector *&  destSector,
float destRange 
)

Return the nearest NPC within the given range.

Parameters
rangeThe search range to look for players
destPositionReturn the position of the target
destSectorReturn the sector of the target
destRangeReturn the range to the target
Returns
The actor of the nearest NPC or NULL if none within range
gemNPCActor* NPC::GetNearestPlayer ( float  range,
csVector3 &  destPosition,
iSector *&  destSector,
float destRange 
)

Return the nearest player within the given range.

Parameters
rangeThe search range to look for players
destPositionReturn the position of the target
destSectorReturn the sector of the target
destRangeReturn the range to the target
Returns
The actor of the nearest player or NULL if none within range
gemNPCActor* NPC::GetNearestVisibleFriend ( float  range)
const char* NPC::GetOrigBrainType ( )
inline

Definition at line 310 of file npc.h.

gemNPCObject* NPC::GetOwner ( )
const char* NPC::GetOwnerName ( )
PID NPC::GetPID ( )
inline

Definition at line 238 of file npc.h.

float NPC::GetPysStamina ( )

Get the npc PysStamina.

float NPC::GetPysStaminaRate ( ) const

Get the npc PysStaminaRate.

psNPCRaceListMessage::NPCRaceInfo_t* NPC::GetRaceInfo ( )

Get the npc race info.

LocationType* NPC::GetRegion ( )
csString& NPC::GetRegionName ( )
inline

Definition at line 536 of file npc.h.

float NPC::GetRunVelocity ( )

Return the run velocity for this NPC.

const csVector3& NPC::GetSpawnPosition ( ) const

Return the position part of the spawn position.

iSector* NPC::GetSpawnSector ( ) const

Return the sector part of the spawn position.

gemNPCObject* NPC::GetTarget ( )
Tribe* NPC::GetTribe ( )

Get the tribe this npc belongs to.

Returns
Null if not part of a tribe
const csString& NPC::GetTribeMemberType ( ) const

Return the type/class for this NPC's tribe membership if any.

float NPC::GetVelocity ( )

Return the ?override? velocity for this NPC.

float NPC::GetWalkVelocity ( )

Return the walk velocity for this NPC.

bool NPC::HasAutoMemorizeTypes ( ) const
inline

Check if the NPC has anything to automemorize.

Definition at line 612 of file npc.h.

void NPC::IncrementFallCounter ( )
inline

Increment the fall counter.

Fall counter is used for debugging.

Definition at line 800 of file npc.h.

csString NPC::Info ( const csString &  infoRequestSubCmd)

Provide info about the NPC.

This funcion is both used by the "/info" in the client and the "info <pid> npcclient console command.

bool NPC::InsertCopy ( PID  use_char_id,
PID  ownerPID 
)

Insert a new copy of NPC into npc_definitions.

bool NPC::IsAlive ( ) const
inline

Definition at line 298 of file npc.h.

bool NPC::IsDisabled ( )
inline

Definition at line 303 of file npc.h.

bool NPC::IsInsideRegion ( )
inline

Check the inside region state of the npc.

Definition at line 546 of file npc.h.

bool NPC::IsInsideTribeHome ( )
inline

Check the inside tribe home state of the npc.

Definition at line 675 of file npc.h.

bool NPC::Load ( iResultRow &  row,
csHash< NPCType *, const char * > &  npctypes,
EventManager eventmanager,
PID  usePID 
)

Loads an NPC from one row of sc_npc_definitions, it also loads the corresponding brain.

Used at boot time

void NPC::Load ( const char *  name,
PID  pid,
NPCType type,
const char *  region_name,
int  debugging,
bool  disabled,
EventManager eventmanager 
)

Loads an NPC base information and his brain.

void NPC::ReleaseControl ( gemNPCActor actor)

Release control of another controlled entity.

void NPC::RemoveAutoMemorize ( csString  types)

Remove types from the autoMemorize store.

They should be "," seperated.

void NPC::RemoveFromHateList ( EID  who)

Remove a entity from the hate list.

void NPC::ReplaceBuffers ( csString &  result)

Replace $NBUFFER[x] with values from the NPC buffer.

Parameters
resultString to replace buffers in.
void NPC::ReplaceLocations ( csString &  result)

Replace a location.

This replace $LOCATION[<location>.<attribute>].

void NPC::ScopedTimerCallback ( const ScopedTimer timer)
virtual

Callback for debug scope timers.

Implements ScopedTimerCB.

void NPC::SetActor ( gemNPCActor actor)
void NPC::SetAlive ( bool  a)
void NPC::SetBrain ( NPCType type)

Sets a new brain (npctype) to this npc.

Parameters
typeThe new type to assign to this npc.
void NPC::SetBuffer ( const csString &  bufferName,
const csString &  value 
)

Set/Update the value of a named buffer.

Parameters
bufferNameThe buffer name.
valueThe value to put in the buffer.
void NPC::SetBufferMemory ( Tribe::Memory memory)

Set a new buffer memory for the NPC.

Parameters
memoryThe new memory to store in the NPC.
void NPC::SetBuildingSpot ( Tribe::Asset buildingSpot)

Set a building spot for this NPC.

Parameters
buildingSpotThe building spot to set.
void NPC::SetDRCounter ( uint8_t  counter)
inline

Definition at line 263 of file npc.h.

void NPC::SetInsideRegion ( bool  inside)
inline

Set the inside region state.

Keep track of last perception for inbound our, outbound

Definition at line 556 of file npc.h.

void NPC::SetInsideTribeHome ( bool  inside)
inline

Set the inside tribe home state.

Keep track of last perception for inbound our, outbound

Definition at line 685 of file npc.h.

void NPC::SetLastPerception ( Perception pcpt)
void NPC::SetLocate ( const csString &  destination,
const NPC::Locate locate 
)

Set the NPCs locate.

void NPC::SetOwner ( EID  owner_EID)

Sets the owner of this npc.

The server will send us the owner of the entity connected to it so we can follow it's directions.

Parameters
owner_EIDthe eid of the entity who owns this npc.
void NPC::SetTarget ( gemNPCObject t)
void NPC::SetTribe ( Tribe new_tribe)

Set a new tribe for this npc.

void NPC::SetTribeMemberType ( const char *  tribeMemberType)

Set the type/class for this npc in a tribe.

void NPC::StoreSpawnPosition ( )

Store the start position.

Store the current position as spawn position so that NPCs can locate spawn position.

void NPC::TakeControl ( gemNPCActor actor)

Take control of another entity.

void NPC::Tick ( )
void NPC::TickPostProcess ( csTicks  when)
protected

Handle post tick processing.

void NPC::TriggerEvent ( Perception pcpt,
float  maxRange = -1.0,
csVector3 *  basePos = NULL,
iSector *  baseSector = NULL,
bool  sameSector = false 
)

Send a perception to this NPC.

This will send the perception to this npc. If the maxRange has been set to something greater than 0.0 a range check will be applied. Only if within the range from the base position and sector will this perception be triggered.

Parameters
pcptPerception to be sent.
maxRangeIf greater then 0.0 then max range apply
basePosThe base position for range checks.
baseSectorThe base sector for range checks.
sameSectorOnly trigger if in same sector
void NPC::TriggerEvent ( const char *  pcpt)

Send a perception to this NPC.

Uses the above method, but acts as a wrapper. Receives only the name of the perception and uses default values for the rest of the arguments

void NPC::UpdateControlled ( )

Update entities controlled by this NPC.

Member Data Documentation

Locate* NPC::activeLocate
protected

The current "Active" locate.

Definition at line 178 of file npc.h.

bool NPC::alive
protected

Definition at line 189 of file npc.h.

float NPC::ang_vel
protected

Definition at line 181 of file npc.h.

csArray<csString> NPC::autoMemorizeTypes
protected

Used to store what types of perceptions to memorize without changing behaviors.

Definition at line 193 of file npc.h.

NPCType* NPC::brain
protected

Definition at line 160 of file npc.h.

bool NPC::checked
protected

Definition at line 215 of file npc.h.

csVector3 NPC::checkedPos
protected

Definition at line 213 of file npc.h.

bool NPC::checkedResult
protected

Definition at line 216 of file npc.h.

iSector* NPC::checkedSector
protected

Definition at line 214 of file npc.h.

csArray< csWeakRef<gemNPCActor> > NPC::controlledActors
protected

Actors that are dragged/pushed around by this NPC.

Definition at line 210 of file npc.h.

bool NPC::disabled
protected

Definition at line 217 of file npc.h.

uint8_t NPC::DRcounter
protected

Definition at line 169 of file npc.h.

int NPC::fallCounter
protected

Definition at line 219 of file npc.h.

HateList NPC::hatelist
protected

Definition at line 228 of file npc.h.

Stat NPC::hp
protected

Definition at line 205 of file npc.h.

bool NPC::insideRegion
protected

State variable for inside outside region checks.

Definition at line 187 of file npc.h.

bool NPC::insideTribeHome
protected

State variable for inside outside tribe home checks.

Definition at line 197 of file npc.h.

Perception* NPC::last_perception
protected

Definition at line 188 of file npc.h.

csTicks NPC::last_update
protected

Definition at line 165 of file npc.h.

float NPC::lastDrAngVel
protected

Definition at line 176 of file npc.h.

bool NPC::lastDrMoving
protected

Definition at line 173 of file npc.h.

csVector3 NPC::lastDrPosition
protected

Definition at line 170 of file npc.h.

iSector* NPC::lastDrSector
protected

Definition at line 171 of file npc.h.

csTicks NPC::lastDrTime
protected

Definition at line 172 of file npc.h.

csVector3 NPC::lastDrVel
protected

Definition at line 175 of file npc.h.

float NPC::lastDrYRot
protected

Definition at line 174 of file npc.h.

Stat NPC::mana
protected

Definition at line 206 of file npc.h.

Stat NPC::menStamina
protected

Definition at line 208 of file npc.h.

iMovable* NPC::movable
protected

Definition at line 167 of file npc.h.

csString NPC::name
protected

Definition at line 164 of file npc.h.

gemNPCActor* NPC::npcActor
protected

Definition at line 166 of file npc.h.

NPCType* NPC::oldbrain
protected

delete at checkpoint

Definition at line 159 of file npc.h.

csString NPC::origtype
protected

Name of NPCType for 'reload'.

Definition at line 161 of file npc.h.

EID NPC::owner_id
protected

Definition at line 190 of file npc.h.

PID NPC::pid
protected

Definition at line 163 of file npc.h.

Stat NPC::pysStamina
protected

Definition at line 207 of file npc.h.

psNPCRaceListMessage::NPCRaceInfo_t* NPC::raceInfo
protected

Definition at line 202 of file npc.h.

LocationType* NPC::region
protected

Cached pointer to the region.

Definition at line 186 of file npc.h.

csString NPC::region_name
protected

Region name as loaded from db.

Definition at line 185 of file npc.h.

float NPC::runVelocity
protected

Definition at line 183 of file npc.h.

float NPC::scale
protected

Model scale value.

Definition at line 184 of file npc.h.

csVector3 NPC::spawnPosition
protected

The stored position that this NPC where spawned.

Definition at line 199 of file npc.h.

iSector* NPC::spawnSector
protected

The stored sector that this NPC where spawned.

Definition at line 200 of file npc.h.

LocateHash NPC::storedLocates
protected

List of stored locate locations.

Definition at line 179 of file npc.h.

EID NPC::target_id
protected

Definition at line 191 of file npc.h.

Tribe* NPC::tribe
protected

Definition at line 195 of file npc.h.

csString NPC::tribeMemberType
protected

What type/class is this NPC in the tribe.

Definition at line 196 of file npc.h.

csString NPC::type
protected

Definition at line 162 of file npc.h.

float NPC::vel
protected

Definition at line 181 of file npc.h.

float NPC::walkVelocity
protected

Definition at line 182 of file npc.h.


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