Planeshift
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes

psNPCClient Class Reference

The main NPC Client class holding references to important superclient objects. More...

#include <npcclient.h>

List of all members.

Classes

struct  DeferredNPC
 Keep information about deferred NPCs during loading. More...

Public Member Functions

void Add (gemNPCObject *object)
bool AddNPCType (csString newType)
 Add an NPCType.
void AddRaceInfo (const psNPCRaceListMessage::NPCRaceInfo_t &raceInfo)
 Add a race info to the race info list.
void AttachNPC (gemNPCActor *actor, uint8_t DRcounter, EID ownerEID, PID masterID)
void AttachObject (iObject *object, gemNPCObject *gobject)
 Attach a server gemObject to a Crystal Space object.
virtual void CatchCommand (const char *cmd)
 Catch a command from the console.
bool CheckAttachTribes (NPC *npc)
 Loop through every tribe and check if this npc is a member.
void Disconnect ()
 Disconnect from server nicely, before quitting.
bool DumpNPC (const char *pattern)
 Find one npc and print its current state info.
bool DumpRace (const char *pattern)
 Dump all race infos.
void EnableDisableNPCs (const char *pattern, bool enable)
 Enable or disable NPCs.
gemNPCObjectFindAttachedObject (iObject *object)
 See if there is a gemObject attached to a given Crystal Space object.
gemNPCObjectFindCharacterID (PID pid)
csList< Edge * > FindEdgeRoute (Waypoint *start, Waypoint *end, const psPathNetwork::RouteFilter *filter)
 Find the shortest route between waypoint start and stop.
gemNPCObjectFindEntityByName (const char *name)
 Find named entity.
gemNPCObjectFindEntityID (EID eid)
LocationFindLocation (const char *loctype, const char *name)
 This function handles the searching for the specified object type and basically does the work for the <locate> script command.
LocationTypeFindLocation (const char *locname)
 Find a location with a given name.
csArray< gemNPCActor * > FindNearbyActors (iSector *sector, const csVector3 &pos, float radius, bool doInvisible=false)
 Create a list of all nearby gem actors.
csArray< gemNPCObject * > FindNearbyEntities (iSector *sector, const csVector3 &pos, float radius, bool doInvisible=false)
 Create a list of all nearby gem objects.
LocationFindNearestLocation (const char *loctype, csVector3 &pos, iSector *sector, float range=-1, float *found_range=NULL)
 This function handles the searching for the specified object type and basically does the work for the <locate> script command.
WaypointFindNearestWaypoint (const csVector3 &v, iSector *sector, float range=-1, float *found_range=NULL)
 This iterates over all waypoints and finds the nearest one.
WaypointFindNearestWaypoint (const char *group, csVector3 &v, iSector *sector, float range=-1, float *found_range=NULL)
 This iterates over all waypoints and finds the nearest one with the given group.
WaypointFindNearestWaypoint (gemNPCObject *entity, float range, float *found_range)
 Return the nearest waypoint to the entity.
NPCFindNPC (EID entid)
 Find the NPC* attached to the entity with the specified EID.
NPCFindNPCByPID (PID character_id)
 Find the NPC* attached to the entity with the specified character ID.
NPCTypeFindNPCType (const char *npctype_name)
 This function handles the searching for the specified NPCType name so that other NPCTypes can subclass an existing one.
psPathFindPath (const char *name)
 Find a given path.
LocationFindRandomLocation (const char *loctype, csVector3 &pos, iSector *sector, float range=-1, float *found_range=NULL)
 This function handles the searching for the specified object type and basically does the work for the <locate> script command.
WaypointFindRandomWaypoint (const csVector3 &v, iSector *sector, float range=-1, float *found_range=NULL)
 This iterates over all waypoints and finds the nearest one.
WaypointFindRandomWaypoint (const char *group, csVector3 &v, iSector *sector, float range=-1, float *found_range=NULL)
 This iterates over all waypoints and finds the nearest one with the given group.
LocationTypeFindRegion (const char *regname)
 Find a region with a given name.
WaypointFindWaypoint (gemNPCObject *entity)
 This iterates over all waypoints and finds the one the entity is at.
WaypointFindWaypoint (int id)
 This iterates over all waypoints and finds the one with the given id.
WaypointFindWaypoint (const char *name, WaypointAlias **alias)
 This iterates over all waypoints and finds the one with the given name.
csList< Waypoint * > FindWaypointRoute (Waypoint *start, Waypoint *end, const psPathNetwork::RouteFilter *filter)
 Find the shortest route between waypoint start and stop.
bool FirePerception (int NPCId, const char *perception)
 Fire perception.
iCollideSystem * GetCollDetSys ()
iEngine * GetEngine ()
EventManagerGetEventManager ()
 Returns the Event Manger.
LocationManagerGetLocationManager ()
 Return the location manager of the npcclient.
MathScriptEngineGetMathScriptEngine ()
 Returns the Math Scripting Engine.
iCelHNavStruct * GetNavStruct ()
psNetConnectionGetNetConnection ()
 Returns the network handler so script ops can invoke the network.
NetworkManagerGetNetworkMgr ()
 Returns the network handler so script ops can invoke the network.
size_t GetNpcListAmount ()
 List the amount of npc currently loaded.
iObjectRegistry * GetObjectReg ()
 Just make iObjectRegistry available to other classes.
psPathNetworkGetPathNetwork ()
 Return the path network of the npcclient.
psNPCRaceListMessage::NPCRaceInfo_tGetRaceInfo (const char *name)
 Get pointer to a race info to the given race name.
csPtr< iDocumentNode > GetRootNode (const char *xmlfile)
 Load and return the root node of an xml file.
float GetRunVelocity (csString &race)
 Find the run velocity for a given race.
unsigned int GetTickCounter () const
 Retrive the current tick counter.
TribeGetTribe (int id)
 Make a tribe pointer available - for the network manager.
iVFS * GetVFS ()
float GetWalkVelocity (csString &race)
 Find the walk velocity for a given race.
psWorldGetWorld ()
void HandleDeath (NPC *who)
 Special handling for death notifications from the server is required, to stop behavior scripting, delete hate lists, etc.
bool InfoNPC (const char *pattern)
 Find one npc and print its current info.
bool Initialize (iObjectRegistry *object_reg, const char *host, const char *user, const char *pass, int port)
 Initialize the superclient.
bool IsReady ()
 If a world is ready and loaded this returns true.
void ListAllEntities (const char *pattern, bool onlyCharacters=false)
 List all known entities on superclient.
void ListAllNPCs (const char *pattern)
 List all NPCs matching pattern to console.
void ListLocations (const char *pattern)
 List all locations matching pattern to console.
void ListPaths (const char *pattern)
 List all paths matching pattern to console.
void ListReactions (const char *pattern)
 List all the registered reactions.
void ListTribeRecipes (const char *tribeID)
 List all the active recipes in a tribe.
void ListTribes (const char *pattern)
 List all tribes matching pattern to console.
void ListWaypoints (const char *pattern)
 List all waypoints matching pattern to console.
void LoadCompleted ()
 To be called when the the load process is completed.
void LoadLogSettings ()
 Used to load the log settings.
bool LoadMap (const char *mapfile)
 Load a map into a region.
bool LoadNPCTypes (iDocumentNode *root)
 Decode a npc type from the XML definition.
bool LoadNPCTypes ()
 Load NPC Types from DB.
bool LoadPathNetwork ()
 made public for the networkmanager to call it
void MainLoop ()
 Load and fork off a new thread for the Server Console.
 psNPCClient ()
 Constructor.
NPCReadMasteredNPC (PID char_id, PID master_id)
 Clones a master npc to a new npc whith the passed PID.
NPCReadSingleNPC (PID char_id, PID master_id=0)
void RegisterReaction (NPC *npc, Reaction *reaction)
 Register a reaction for an NPC with the client.
void Remove (gemNPCObject *object)
void Remove (NPC *npc)
 Remove NPC from NPC Client.
void RemoveAll ()
void SaveLogSettings ()
 Used to save the log settings.
void SetEntityPos (EID id, csVector3 &pos, iSector *sector, InstanceID instance, bool force=false)
 SetEntityPos finds the given ID entity, and updates its position in mesh and linmove.
iCelHPath * ShortestPath (NPC *npc, const csVector3 &from, iSector *fromSector, const csVector3 &goal, iSector *goalSector)
void Tick ()
 This does 1 AI calc per Tribe then returns.
void TriggerEvent (Perception *pcpt, float maxRange=-1.0, csVector3 *basePos=NULL, iSector *baseSector=NULL, bool sameSector=false)
 Sends a perception to all npcs.
void UnattachObject (iObject *object, gemNPCObject *gobject)
 Unattach a gemObject from a Crystal Space object.
void UpdateTime (int minute, int hour, int day, int month, int year)
 Update with time from server in order to start timed events.
 ~psNPCClient ()
 Cleans up all allocated memory and removes all the players from the world.
Game time

Functions to retrive the game time.

int GetGameTODMinute ()
 Get the minute of the game time of day.
int GetGameTODHour ()
 Get the hour of the game time of day.
int GetGameTODDay ()
 Get the day of the game time of day.
int GetGameTODMonth ()
 Get the month of the game time of day.
int GetGameTODYear ()
 Get the year of the game time of day.
iScriptableVar implementation

Functions that implement the iScriptableVar interface.

virtual double GetProperty (MathEnvironment *env, const char *ptr)
virtual double CalcFunction (MathEnvironment *env, const char *functionName, const double *params)
virtual const char * ToString ()

Static Public Attributes

static psNPCClientnpcclient

Protected Member Functions

bool LoadLocations ()
 Load locations from the DB.
bool LoadTribes ()
 Load Tribes from the DB.
void PerceptProximityItems ()
 Find all items that are close to NPC's and percept the NPC.
void PerceptProximityLocations ()
 Find all locations that are close to NPC's and percept the NPC.
void PerceptProximityTribeHome ()
 Find all actors that are in a tribe home and percept tribe and actor if it is an NPC.
bool ReadNPCsFromDatabase ()
 Read NPCs from the DB.

Protected Attributes

csArray< gemNPCActor * > all_gem_actors
csArray< gemNPCItem * > all_gem_items
csPDelArray< gemNPCObjectall_gem_objects
csHash< gemNPCObject *, EID > all_gem_objects_by_eid
csHash< gemNPCObject *, PID > all_gem_objects_by_pid
csHash< NPC *, csString > allReactions
 Hash of all registered reactions.
csRef< iCollideSystem > cdsys
csRef< iConfigManager > configmanager
psNetConnectionconnection
int current_long_range_perception_index
 Counters used to distribute load regarding perception generation.
int current_long_range_perception_loc_index
int current_tribe_home_perception_index
psDatabasedatabase
csRef< iEngine > engine
EventManagereventmanager
int gameDay
int gameHour
int gameMinute
int gameMonth
csTicks gameTimeUpdated
int gameYear
LocationManagerlocationManager
 The manager for location.
MathScriptEnginemathScriptEngine
csRef< MsgHandlermsghandler
csRef< iCelHNavStruct > navStruct
NetworkManagernetwork
csArray< csString > notUsedReactions
 List of not matched reactions.
csPDelArray< NPCnpcs
csArray< DeferredNPCnpcsDeferred
csHash< NPCType *, const char * > npctypes
iObjectRegistry * objreg
psPathNetworkpathNetwork
csHash
< psNPCRaceListMessage::NPCRaceInfo_t,
csString > 
raceInfos
 Information about all the races.
RecipeManagerrecipemanager
ServerConsoleserverconsole
unsigned int tick_counter
 Counter used to start events at every nth client tick.
csPDelArray< Tribetribes
csRef< iVFS > vfs
psWorldworld

Detailed Description

The main NPC Client class holding references to important superclient objects.

Definition at line 81 of file npcclient.h.


Constructor & Destructor Documentation

psNPCClient::psNPCClient ( )

Constructor.

Create the NPC Client application class.

psNPCClient::~psNPCClient ( )

Cleans up all allocated memory and removes all the players from the world.


Member Function Documentation

void psNPCClient::Add ( gemNPCObject object)
bool psNPCClient::AddNPCType ( csString  newType)

Add an NPCType.

Upon loading a tribe, the Recipe Manager creates a NPCType and uses this method to Put the assembled npctype into the npctypes map.

Parameters:
newTypeString containing the npctype in xml format.
Returns:
False if any error is encountered, true otherwise.
void psNPCClient::AddRaceInfo ( const psNPCRaceListMessage::NPCRaceInfo_t raceInfo)

Add a race info to the race info list.

void psNPCClient::AttachNPC ( gemNPCActor actor,
uint8_t  DRcounter,
EID  ownerEID,
PID  masterID 
)
void psNPCClient::AttachObject ( iObject *  object,
gemNPCObject gobject 
)

Attach a server gemObject to a Crystal Space object.

In most cases this will be a mesh wrapper.

Parameters:
objectThe Crystal Space object we want to attach our gemObject to.
gobjectThe PlaneShift object that we want to attach.
virtual double psNPCClient::CalcFunction ( MathEnvironment env,
const char *  functionName,
const double *  params 
) [virtual]

Implements iScriptableVar.

virtual void psNPCClient::CatchCommand ( const char *  cmd) [virtual]

Catch a command from the console.

Parameters:
cmdThe command.

Implements iCommandCatcher.

bool psNPCClient::CheckAttachTribes ( NPC npc)

Loop through every tribe and check if this npc is a member.

Returns:
false if tribe member and failed to attach, otherwise true
void psNPCClient::Disconnect ( )

Disconnect from server nicely, before quitting.

bool psNPCClient::DumpNPC ( const char *  pattern)

Find one npc and print its current state info.

bool psNPCClient::DumpRace ( const char *  pattern)

Dump all race infos.

void psNPCClient::EnableDisableNPCs ( const char *  pattern,
bool  enable 
)

Enable or disable NPCs.

Alter the Disabled state of NPCs.

Parameters:
patternUsed to mach NPC(s) to enable or disable.
enableSet to true if the NPC should be enabled.
gemNPCObject* psNPCClient::FindAttachedObject ( iObject *  object)

See if there is a gemObject attached to a given Crystal Space object.

Parameters:
objectThe Cyrstal Space object we want to see if there is an object attached to.
Returns:
A gemNPCObject if it exists that is attached to the Crystal Space object.
gemNPCObject* psNPCClient::FindCharacterID ( PID  pid)
csList<Edge*> psNPCClient::FindEdgeRoute ( Waypoint start,
Waypoint end,
const psPathNetwork::RouteFilter filter 
)

Find the shortest route between waypoint start and stop.

gemNPCObject* psNPCClient::FindEntityByName ( const char *  name)

Find named entity.

Return first entity that macht the given name.

gemNPCObject* psNPCClient::FindEntityID ( EID  eid)
LocationType* psNPCClient::FindLocation ( const char *  locname)

Find a location with a given name.

This function handles the searching for the specified location type so that other functions can refer to the location type directly.

Location* psNPCClient::FindLocation ( const char *  loctype,
const char *  name 
)

This function handles the searching for the specified object type and basically does the work for the <locate> script command.

csArray<gemNPCActor*> psNPCClient::FindNearbyActors ( iSector *  sector,
const csVector3 &  pos,
float  radius,
bool  doInvisible = false 
)

Create a list of all nearby gem actors.

Parameters:
sectorThe sector to check in.
posThe starting position
radiusThe distance around the starting point to check.
doInvisibleIf true check invisible meshes otherwise ignore them.
Returns:
A csArray<> of all the objects in the given radius.
csArray<gemNPCObject*> psNPCClient::FindNearbyEntities ( iSector *  sector,
const csVector3 &  pos,
float  radius,
bool  doInvisible = false 
)

Create a list of all nearby gem objects.

Parameters:
sectorThe sector to check in.
posThe starting position
radiusThe distance around the starting point to check.
doInvisibleIf true check invisible meshes otherwise ignore them.
Returns:
A csArray<> of all the objects in the given radius.
Location* psNPCClient::FindNearestLocation ( const char *  loctype,
csVector3 &  pos,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This function handles the searching for the specified object type and basically does the work for the <locate> script command.

Waypoint* psNPCClient::FindNearestWaypoint ( const csVector3 &  v,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This iterates over all waypoints and finds the nearest one.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindNearestWaypoint ( const char *  group,
csVector3 &  v,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This iterates over all waypoints and finds the nearest one with the given group.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindNearestWaypoint ( gemNPCObject entity,
float  range,
float found_range 
)

Return the nearest waypoint to the entity.

NPC* psNPCClient::FindNPC ( EID  entid)

Find the NPC* attached to the entity with the specified EID.

Parameters:
entidThe EID of the NPC to find.
Returns:
The NPC or NULL if no NPC with this EID was found.
NPC* psNPCClient::FindNPCByPID ( PID  character_id)

Find the NPC* attached to the entity with the specified character ID.

Parameters:
character_idThe PID of the NPC to find.
Returns:
The NPC or NULL if no NPC with this PID was found.
NPCType* psNPCClient::FindNPCType ( const char *  npctype_name)

This function handles the searching for the specified NPCType name so that other NPCTypes can subclass an existing one.

psPath* psNPCClient::FindPath ( const char *  name)

Find a given path.

Parameters:
nameThe name of the path.
Returns:
The path or NULL if no path was found.
Location* psNPCClient::FindRandomLocation ( const char *  loctype,
csVector3 &  pos,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This function handles the searching for the specified object type and basically does the work for the <locate> script command.

Waypoint* psNPCClient::FindRandomWaypoint ( const csVector3 &  v,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This iterates over all waypoints and finds the nearest one.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindRandomWaypoint ( const char *  group,
csVector3 &  v,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This iterates over all waypoints and finds the nearest one with the given group.

There is probably a more efficient structure to accomplish this.

LocationType* psNPCClient::FindRegion ( const char *  regname)

Find a region with a given name.

This function handles the searching for the specified region name so that other functions can refer to the region directly.

Waypoint* psNPCClient::FindWaypoint ( gemNPCObject entity)

This iterates over all waypoints and finds the one the entity is at.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindWaypoint ( int  id)

This iterates over all waypoints and finds the one with the given id.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindWaypoint ( const char *  name,
WaypointAlias **  alias 
)

This iterates over all waypoints and finds the one with the given name.

There is probably a more efficient structure to accomplish this.

csList<Waypoint*> psNPCClient::FindWaypointRoute ( Waypoint start,
Waypoint end,
const psPathNetwork::RouteFilter filter 
)

Find the shortest route between waypoint start and stop.

bool psNPCClient::FirePerception ( int  NPCId,
const char *  perception 
)

Fire perception.

Method used by the console command 'fireperc'. It fires a perception on the given npc.

Parameters:
NPCIdNPC on which to fire perc
perceptionThe perception to fire
Returns:
True if npc is found and perception is sent. False otherwise (doh!)
iCollideSystem* psNPCClient::GetCollDetSys ( ) [inline]

Definition at line 508 of file npcclient.h.

iEngine* psNPCClient::GetEngine ( ) [inline]

Definition at line 550 of file npcclient.h.

EventManager* psNPCClient::GetEventManager ( ) [inline]

Returns the Event Manger.

Returns:
Returns a ptr to the event manager.

Definition at line 342 of file npcclient.h.

int psNPCClient::GetGameTODDay ( ) [inline]

Get the day of the game time of day.

Definition at line 584 of file npcclient.h.

int psNPCClient::GetGameTODHour ( ) [inline]

Get the hour of the game time of day.

Definition at line 576 of file npcclient.h.

int psNPCClient::GetGameTODMinute ( ) [inline]

Get the minute of the game time of day.

Definition at line 568 of file npcclient.h.

int psNPCClient::GetGameTODMonth ( ) [inline]

Get the month of the game time of day.

Definition at line 592 of file npcclient.h.

int psNPCClient::GetGameTODYear ( ) [inline]

Get the year of the game time of day.

Definition at line 600 of file npcclient.h.

LocationManager* psNPCClient::GetLocationManager ( ) [inline]

Return the location manager of the npcclient.

Definition at line 718 of file npcclient.h.

MathScriptEngine* psNPCClient::GetMathScriptEngine ( ) [inline]

Returns the Math Scripting Engine.

Returns:
Returns a ptr to the math script engine.

Definition at line 352 of file npcclient.h.

iCelHNavStruct* psNPCClient::GetNavStruct ( ) [inline]

Definition at line 538 of file npcclient.h.

psNetConnection* psNPCClient::GetNetConnection ( ) [inline]

Returns the network handler so script ops can invoke the network.

Definition at line 309 of file npcclient.h.

NetworkManager* psNPCClient::GetNetworkMgr ( ) [inline]

Returns the network handler so script ops can invoke the network.

Definition at line 301 of file npcclient.h.

size_t psNPCClient::GetNpcListAmount ( ) [inline]

List the amount of npc currently loaded.

Definition at line 416 of file npcclient.h.

iObjectRegistry* psNPCClient::GetObjectReg ( ) [inline]

Just make iObjectRegistry available to other classes.

Definition at line 123 of file npcclient.h.

psPathNetwork* psNPCClient::GetPathNetwork ( ) [inline]

Return the path network of the npcclient.

Definition at line 710 of file npcclient.h.

virtual double psNPCClient::GetProperty ( MathEnvironment env,
const char *  ptr 
) [virtual]

Implements iScriptableVar.

psNPCRaceListMessage::NPCRaceInfo_t* psNPCClient::GetRaceInfo ( const char *  name)

Get pointer to a race info to the given race name.

csPtr<iDocumentNode> psNPCClient::GetRootNode ( const char *  xmlfile)

Load and return the root node of an xml file.

Parameters:
xmlfileName of the xml file to find the root node of.
float psNPCClient::GetRunVelocity ( csString &  race)

Find the run velocity for a given race.

unsigned int psNPCClient::GetTickCounter ( ) const [inline]

Retrive the current tick counter.

Definition at line 424 of file npcclient.h.

Tribe* psNPCClient::GetTribe ( int  id)

Make a tribe pointer available - for the network manager.

iVFS* psNPCClient::GetVFS ( ) [inline]

Definition at line 555 of file npcclient.h.

float psNPCClient::GetWalkVelocity ( csString &  race)

Find the walk velocity for a given race.

psWorld* psNPCClient::GetWorld ( ) [inline]

Definition at line 545 of file npcclient.h.

void psNPCClient::HandleDeath ( NPC who)

Special handling for death notifications from the server is required, to stop behavior scripting, delete hate lists, etc.

bool psNPCClient::InfoNPC ( const char *  pattern)

Find one npc and print its current info.

bool psNPCClient::Initialize ( iObjectRegistry *  object_reg,
const char *  host,
const char *  user,
const char *  pass,
int  port 
)

Initialize the superclient.

Starts a thread for the Network, Message Handler. Also binds the status socket for the network.

Parameters:
object_regThe object registry
hostThe host that keeps the DB.
userThe user for the DB.
passThe password for the DB.
portThe port for the DB.
Returns:
True if the initialization went ok.
bool psNPCClient::IsReady ( )

If a world is ready and loaded this returns true.

void psNPCClient::ListAllEntities ( const char *  pattern,
bool  onlyCharacters = false 
)

List all known entities on superclient.

void psNPCClient::ListAllNPCs ( const char *  pattern)

List all NPCs matching pattern to console.

void psNPCClient::ListLocations ( const char *  pattern)

List all locations matching pattern to console.

void psNPCClient::ListPaths ( const char *  pattern)

List all paths matching pattern to console.

void psNPCClient::ListReactions ( const char *  pattern)

List all the registered reactions.

void psNPCClient::ListTribeRecipes ( const char *  tribeID)

List all the active recipes in a tribe.

void psNPCClient::ListTribes ( const char *  pattern)

List all tribes matching pattern to console.

void psNPCClient::ListWaypoints ( const char *  pattern)

List all waypoints matching pattern to console.

void psNPCClient::LoadCompleted ( )

To be called when the the load process is completed.

bool psNPCClient::LoadLocations ( ) [protected]

Load locations from the DB.

void psNPCClient::LoadLogSettings ( )

Used to load the log settings.

bool psNPCClient::LoadMap ( const char *  mapfile)

Load a map into a region.

This is a copy of code from entitymanager->CreateRoom().

Parameters:
mapfileA file with maps to load.
bool psNPCClient::LoadNPCTypes ( iDocumentNode *  root)

Decode a npc type from the XML definition.

Parameters:
rootThe document node that containts a NPC type.
bool psNPCClient::LoadNPCTypes ( )

Load NPC Types from DB.

bool psNPCClient::LoadPathNetwork ( )

made public for the networkmanager to call it

bool psNPCClient::LoadTribes ( ) [protected]

Load Tribes from the DB.

void psNPCClient::MainLoop ( )

Load and fork off a new thread for the Server Console.

Then start EventManager's main loop, processing all network and server events.

void psNPCClient::PerceptProximityItems ( ) [protected]

Find all items that are close to NPC's and percept the NPC.

void psNPCClient::PerceptProximityLocations ( ) [protected]

Find all locations that are close to NPC's and percept the NPC.

void psNPCClient::PerceptProximityTribeHome ( ) [protected]

Find all actors that are in a tribe home and percept tribe and actor if it is an NPC.

NPC* psNPCClient::ReadMasteredNPC ( PID  char_id,
PID  master_id 
)

Clones a master npc to a new npc whith the passed PID.

Used to inheredit behaviours from other npc.

Note:
this is used as last shore scenario. This way the npc even if mastered can override the entry of it's master. The master PID comes from psserver.
Parameters:
char_idA valid PID of the character which is taking it's attributes from the master npc.
master_idA valid PID of the master npc from which we will copy the attributes.
Returns:
A pointer to the newly created NPC. NULL if the arguments where invalid or the master wasn't found.
bool psNPCClient::ReadNPCsFromDatabase ( ) [protected]

Read NPCs from the DB.

NPC* psNPCClient::ReadSingleNPC ( PID  char_id,
PID  master_id = 0 
)
void psNPCClient::RegisterReaction ( NPC npc,
Reaction reaction 
)

Register a reaction for an NPC with the client.

Used to speed up FirePerception.

void psNPCClient::Remove ( NPC npc)

Remove NPC from NPC Client.

void psNPCClient::Remove ( gemNPCObject object)
void psNPCClient::RemoveAll ( )
void psNPCClient::SaveLogSettings ( )

Used to save the log settings.

void psNPCClient::SetEntityPos ( EID  id,
csVector3 &  pos,
iSector *  sector,
InstanceID  instance,
bool  force = false 
)

SetEntityPos finds the given ID entity, and updates its position in mesh and linmove.

Parameters:
idThe EID of the entity.
posThe new position.
sectorThe new sector.
instanceThe new instance.
forceApplies the entity reposition also on npc. Useful with teleport slide and other operations.
iCelHPath* psNPCClient::ShortestPath ( NPC npc,
const csVector3 &  from,
iSector *  fromSector,
const csVector3 &  goal,
iSector *  goalSector 
)
void psNPCClient::Tick ( )

This does 1 AI calc per Tribe then returns.

virtual const char* psNPCClient::ToString ( ) [virtual]

Implements iScriptableVar.

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

Sends a perception to all npcs.

If macRange is greather than 0.0 only npcs within that range of the base position will be triggered.

See also:
NPC::TriggerEvent Tribe::TriggerEvent
Parameters:
pcptThe perception
maxRangeIf greater than 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 psNPCClient::UnattachObject ( iObject *  object,
gemNPCObject gobject 
)

Unattach a gemObject from a Crystal Space object.

In most cases the Crystal Space object is a meshwrapper.

Parameters:
objectThe Crystal Space object we want to unattach our object from.
gobjectThe gem object we want to unattach.
void psNPCClient::UpdateTime ( int  minute,
int  hour,
int  day,
int  month,
int  year 
)

Update with time from server in order to start timed events.


Member Data Documentation

Definition at line 792 of file npcclient.h.

Definition at line 791 of file npcclient.h.

csPDelArray<gemNPCObject> psNPCClient::all_gem_objects [protected]

Definition at line 790 of file npcclient.h.

Definition at line 788 of file npcclient.h.

Definition at line 789 of file npcclient.h.

csHash<NPC*,csString> psNPCClient::allReactions [protected]

Hash of all registered reactions.

Definition at line 796 of file npcclient.h.

csRef<iCollideSystem> psNPCClient::cdsys [protected]

Definition at line 799 of file npcclient.h.

csRef<iConfigManager > psNPCClient::configmanager [protected]

Definition at line 771 of file npcclient.h.

Definition at line 768 of file npcclient.h.

Counters used to distribute load regarding perception generation.

Definition at line 809 of file npcclient.h.

Definition at line 810 of file npcclient.h.

Definition at line 811 of file npcclient.h.

Definition at line 777 of file npcclient.h.

csRef<iEngine> psNPCClient::engine [protected]

Definition at line 770 of file npcclient.h.

Definition at line 774 of file npcclient.h.

Definition at line 816 of file npcclient.h.

Definition at line 815 of file npcclient.h.

Definition at line 814 of file npcclient.h.

Definition at line 817 of file npcclient.h.

csTicks psNPCClient::gameTimeUpdated [protected]

Definition at line 819 of file npcclient.h.

Definition at line 818 of file npcclient.h.

The manager for location.

Definition at line 781 of file npcclient.h.

Definition at line 782 of file npcclient.h.

csRef<MsgHandler> psNPCClient::msghandler [protected]

Definition at line 772 of file npcclient.h.

csRef<iCelHNavStruct> psNPCClient::navStruct [protected]

Definition at line 784 of file npcclient.h.

Definition at line 776 of file npcclient.h.

csArray<csString> psNPCClient::notUsedReactions [protected]

List of not matched reactions.

Definition at line 797 of file npcclient.h.

Definition at line 766 of file npcclient.h.

csPDelArray<NPC> psNPCClient::npcs [protected]

Definition at line 785 of file npcclient.h.

Definition at line 786 of file npcclient.h.

csHash<NPCType*, const char*> psNPCClient::npctypes [protected]

Definition at line 780 of file npcclient.h.

iObjectRegistry* psNPCClient::objreg [protected]

Definition at line 769 of file npcclient.h.

Definition at line 783 of file npcclient.h.

Information about all the races.

Definition at line 794 of file npcclient.h.

Definition at line 775 of file npcclient.h.

Definition at line 773 of file npcclient.h.

Counter used to start events at every nth client tick.

Definition at line 806 of file npcclient.h.

csPDelArray<Tribe> psNPCClient::tribes [protected]

Definition at line 787 of file npcclient.h.

csRef<iVFS> psNPCClient::vfs [protected]

Definition at line 778 of file npcclient.h.

Definition at line 801 of file npcclient.h.


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