Planeshift
WanderOperation Class Reference

Wander auto-navigates randomly between a network of waypoints specified in the DB. More...

#include <npcoperations.h>

Classes

class  WanderRouteFilter
 

Public Member Functions

virtual OperationResult Advance (float timedelta, NPC *npc)
 
void EdgeListClear ()
 Clear list of edges. More...
 
psPathPointGetCurrentPathPoint (NPC *npc)
 Return the current path point. More...
 
EdgeGetNextEdge (NPC *npc)
 Get the next edge for local destination. More...
 
psPathPointGetNextPathPoint (NPC *npc, bool &teleport)
 Get the next path point to use for local destination. More...
 
virtual void InterruptOperation (NPC *npc)
 
virtual bool Load (iDocumentNode *node)
 
virtual ScriptOperationMakeCopy ()
 
virtual OperationResult Run (NPC *npc, bool interrupted)
 
 WanderOperation ()
 
 WanderOperation (const WanderOperation *other)
 
virtual ~WanderOperation ()
 
- Public Member Functions inherited from ScriptOperation
void AddRandomRange (csVector3 &dest, float radius, float margin=0.0)
 Move a point somwhere random within radius of the orignial point. More...
 
virtual bool AtInterruptedAngle (const csVector3 &pos, const iSector *sector, float angle)
 
virtual bool AtInterruptedAngle (NPC *npc)
 
virtual bool AtInterruptedPosition (const csVector3 &pos, const iSector *sector)
 
virtual bool AtInterruptedPosition (NPC *npc)
 
virtual bool CheckEndPointOk (NPC *npc, const csVector3 &myPos, iSector *mySector, const csVector3 &endPos, iSector *endSector)
 Check if the end point where ok. More...
 
virtual bool CheckMoveOk (NPC *npc, csVector3 oldPos, iSector *oldSector, const csVector3 &newPos, iSector *newSector, int resultFromExtrapolate)
 Check if the move where ok. More...
 
void CopyCheckMoveOk (ScriptOperation *source)
 Copy CheckMoveOk paramters from the source script. More...
 
virtual void Failure (NPC *npc)
 Called when the run operation return OPERATION_FAILED. More...
 
virtual float GetAngularVelocity (NPC *npc)
 
virtual const csString & GetCollisionPerception (NPC *npc)
 Return the Collision perception event name. More...
 
virtual const csString & GetFallingPerception (NPC *npc)
 Return the Falling perception event name. More...
 
virtual const csString & GetInBoundsPerception (NPC *npc)
 Return the In Bounds perception event name. More...
 
virtual const char * GetName () const
 
virtual const csString & GetOutOfBoundsPerception (NPC *npc)
 Return the Out of Bounds perception event name. More...
 
virtual State GetState () const
 
virtual float GetVelocity (NPC *npc)
 Return the velocity for the npc. More...
 
bool LoadCheckMoveOk (iDocumentNode *node)
 Load attributes for the CheckMoveOk check. More...
 
bool LoadVelocity (iDocumentNode *node)
 
 ScriptOperation (const char *sciptName)
 
 ScriptOperation (const ScriptOperation *other)
 
void SetAnimation (NPC *npc, const char *name)
 This function will set an animation for the NPC, the animation will play once. More...
 
void SetParent (Behavior *behavior)
 Set the parent behavior for this operation. More...
 
virtual void SetState (State state)
 
virtual ~ScriptOperation ()
 

Static Public Member Functions

static float DistanceToDestPoint (NPC *npc, const csVector3 &destPos, const iSector *destSector)
 

Protected Member Functions

OperationResult CalculateEdgeList (NPC *npc)
 Calculate the edgeList to be used by wander. More...
 
bool MoveTo (NPC *npc, psPathPoint *point)
 Teleport to point. More...
 
void SetPathPointIterator (Edge::Iterator *iterator)
 Set the current path point iterator. More...
 
bool StartMoveTo (NPC *npc, psPathPoint *point)
 Start move to point. More...
 
- Protected Member Functions inherited from ScriptOperation
int StartMoveTo (NPC *npc, const csVector3 &dest, iSector *sector, float vel, const char *action, float &angle)
 This function is used by MoveTo AND Navigate operations. More...
 
void TurnTo (NPC *npc, const csVector3 &dest, iSector *destsect, csVector3 &forward, float &angle)
 

Protected Attributes

csString action
 
bool city
 
bool cityValid
 
float currentDistance
 The distance to the current local destination. More...
 
EdgecurrentEdge
 The current edge. More...
 
psPathPointcurrentPathPoint
 The current local destination. More...
 
Edge::IteratorcurrentPathPointIterator
 The current iterator for path points. More...
 
csVector3 currentPointOffset
 The offset used for current local dest. More...
 
csList< Edge * >::Iterator edgeIterator
 
csList< Edge * > edgeList
 
bool ground
 
bool groundValid
 
bool indoor
 
bool indoorValid
 
bool path
 
bool pathValid
 
bool priv
 
bool privValid
 
bool pub
 
bool pubValid
 
bool random
 
bool road
 
bool roadValid
 
bool underground
 
bool undergroundValid
 
bool underwater
 
bool underwaterValid
 
WanderRouteFilter wanderRouteFilter
 
- Protected Attributes inherited from ScriptOperation
float ang_vel
 Shared angular velocity, used by all that rotates. More...
 
bool checkTribeHome
 Set to true if the tribe home should be checked by CheckMoveOk. More...
 
csString collision
 Perception names to use for collision detected by CheckMoveOk. More...
 
int consecCollisions
 Shared by move functions. Used by CheckMoveOk to detect collisions. More...
 
csString failurePerception
 The Perception to fire when a operation return OPERATION_FAILED. More...
 
csString falling
 Perception names to use for fall detected by CheckMoveOk. More...
 
csString inBounds
 Perception names to use for in bounds detected by CheckMoveOk. More...
 
float interrupted_angle
 
csVector3 interrupted_position
 
iSector * interrupted_sector
 
csString name
 
csString outOfBounds
 Perception names to use for out of bounds detected by CheckMoveOk. More...
 
Behaviorparent
 
State state
 
float vel
 Shared linear velocity, used by all that moves. More...
 
VelSource velSource
 Source used for velocity. More...
 

Additional Inherited Members

- Public Types inherited from ScriptOperation
enum  OperationResult { OPERATION_NOT_COMPLETED, OPERATION_COMPLETED, OPERATION_FAILED }
 
enum  State { READY_TO_RUN, RUNNING, INTERRUPTED, COMPLETED }
 
enum  VelSource { VEL_DEFAULT, VEL_USER, VEL_WALK, VEL_RUN }
 
- Static Protected Member Functions inherited from ScriptOperation
static void StopMovement (NPC *npc)
 Utility function used by many operation to stop movement of an NPC. More...
 

Detailed Description

Wander auto-navigates randomly between a network of waypoints specified in the DB.

Definition at line 1720 of file npcoperations.h.

Constructor & Destructor Documentation

WanderOperation::WanderOperation ( )
WanderOperation::WanderOperation ( const WanderOperation other)
virtual WanderOperation::~WanderOperation ( )
virtual

Member Function Documentation

virtual OperationResult WanderOperation::Advance ( float  timedelta,
NPC npc 
)
virtual

Reimplemented from ScriptOperation.

OperationResult WanderOperation::CalculateEdgeList ( NPC npc)
protected

Calculate the edgeList to be used by wander.

Will calculate a list of edges between start and end for wander. For random wander the list is empty but still returning true.

static float WanderOperation::DistanceToDestPoint ( NPC npc,
const csVector3 &  destPos,
const iSector *  destSector 
)
static
void WanderOperation::EdgeListClear ( )
inline

Clear list of edges.

Definition at line 1801 of file npcoperations.h.

psPathPoint* WanderOperation::GetCurrentPathPoint ( NPC npc)

Return the current path point.

Edge* WanderOperation::GetNextEdge ( NPC npc)

Get the next edge for local destination.

Will return the next edge from the edge list or find a new radom edge for random wander.

psPathPoint* WanderOperation::GetNextPathPoint ( NPC npc,
bool &  teleport 
)

Get the next path point to use for local destination.

Will return the next path point from the active edge. It will get next edge when at end of path. This include random edge if operation is random.

virtual void WanderOperation::InterruptOperation ( NPC npc)
virtual

Reimplemented from ScriptOperation.

virtual bool WanderOperation::Load ( iDocumentNode *  node)
virtual

Reimplemented from ScriptOperation.

virtual ScriptOperation* WanderOperation::MakeCopy ( )
virtual

Implements ScriptOperation.

bool WanderOperation::MoveTo ( NPC npc,
psPathPoint point 
)
protected

Teleport to point.

Teleport from current position to next local dest point.

virtual OperationResult WanderOperation::Run ( NPC npc,
bool  interrupted 
)
virtual

Implements ScriptOperation.

void WanderOperation::SetPathPointIterator ( Edge::Iterator iterator)
protected

Set the current path point iterator.

bool WanderOperation::StartMoveTo ( NPC npc,
psPathPoint point 
)
protected

Start move to point.

Set up a movement from current position to next local dest point.

Member Data Documentation

csString WanderOperation::action
protected

Definition at line 1752 of file npcoperations.h.

bool WanderOperation::city
protected

Definition at line 1758 of file npcoperations.h.

bool WanderOperation::cityValid
protected

Definition at line 1758 of file npcoperations.h.

float WanderOperation::currentDistance
protected

The distance to the current local destination.

Definition at line 1744 of file npcoperations.h.

Edge* WanderOperation::currentEdge
protected

The current edge.

Definition at line 1740 of file npcoperations.h.

psPathPoint* WanderOperation::currentPathPoint
protected

The current local destination.

Definition at line 1742 of file npcoperations.h.

Edge::Iterator* WanderOperation::currentPathPointIterator
protected

The current iterator for path points.

Definition at line 1741 of file npcoperations.h.

csVector3 WanderOperation::currentPointOffset
protected

The offset used for current local dest.

Definition at line 1743 of file npcoperations.h.

csList<Edge*>::Iterator WanderOperation::edgeIterator
protected

Definition at line 1739 of file npcoperations.h.

csList<Edge*> WanderOperation::edgeList
protected

Definition at line 1737 of file npcoperations.h.

bool WanderOperation::ground
protected

Definition at line 1762 of file npcoperations.h.

bool WanderOperation::groundValid
protected

Definition at line 1762 of file npcoperations.h.

bool WanderOperation::indoor
protected

Definition at line 1759 of file npcoperations.h.

bool WanderOperation::indoorValid
protected

Definition at line 1759 of file npcoperations.h.

bool WanderOperation::path
protected

Definition at line 1760 of file npcoperations.h.

bool WanderOperation::pathValid
protected

Definition at line 1760 of file npcoperations.h.

bool WanderOperation::priv
protected

Definition at line 1756 of file npcoperations.h.

bool WanderOperation::privValid
protected

Definition at line 1756 of file npcoperations.h.

bool WanderOperation::pub
protected

Definition at line 1757 of file npcoperations.h.

bool WanderOperation::pubValid
protected

Definition at line 1757 of file npcoperations.h.

bool WanderOperation::random
protected

Definition at line 1753 of file npcoperations.h.

bool WanderOperation::road
protected

Definition at line 1761 of file npcoperations.h.

bool WanderOperation::roadValid
protected

Definition at line 1761 of file npcoperations.h.

bool WanderOperation::underground
protected

Definition at line 1754 of file npcoperations.h.

bool WanderOperation::undergroundValid
protected

Definition at line 1754 of file npcoperations.h.

bool WanderOperation::underwater
protected

Definition at line 1755 of file npcoperations.h.

bool WanderOperation::underwaterValid
protected

Definition at line 1755 of file npcoperations.h.

WanderRouteFilter WanderOperation::wanderRouteFilter
protected

Definition at line 1735 of file npcoperations.h.


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