|
Planeshift
|
Holds list of tribe members, position of tribe home Keeps resources and handles tribe perceptions. More...
#include <tribe.h>
Classes | |
| struct | Asset |
| struct | CyclicRecipe |
| struct | MemberID |
| struct | Memory |
| struct | Resource |
Public Types | |
| enum | AssetStatus { ASSET_STATUS_NOT_APPLICABLE, ASSET_STATUS_NOT_USED, ASSET_STATUS_INCONSTRUCTION, ASSET_STATUS_CONSTRUCTED } |
| enum | AssetType { ASSET_TYPE_ITEM, ASSET_TYPE_BUILDING, ASSET_TYPE_BUILDINGSPOT } |
| typedef csHash< csString, csString > | BufferHash |
Public Member Functions | |
| void | AddAsset (Tribe::AssetType type, csString name, gemNPCItem *item, int quantity, int id=-1) |
| Add an item asset. More... | |
| Tribe::Asset * | AddAsset (Tribe::AssetType type, csString name, csVector3 position, iSector *sector, Tribe::AssetStatus status) |
| Add an asset to the tribe. More... | |
| void | AddCyclicRecipe (Recipe *recipe, int time) |
| Add a cyclic recipe. More... | |
| void | AddKnowledge (csString knowHow) |
| Add a knowledge token. More... | |
| bool | AddMember (PID pid, const char *tribeMemberType) |
| Adds a new member to the tribe. More... | |
| void | AddMemory (csString name, const csVector3 &pos, iSector *sector, float radius, NPC *npc) |
| Add a new memory to the tribe. More... | |
| void | AddRecipe (Recipe *recipe, Recipe *parentRecipe, bool reqType=false) |
| Add a recipe. More... | |
| void | AddResource (csString resource, int amount, csString nick="") |
| Add a new resource to the tribe resource table. More... | |
| void | Advance (csTicks when, EventManager *eventmgr) |
| Advance the tribe. More... | |
| int | AliveCount () const |
| Count number of alive members. More... | |
| size_t | AssetQuantity (Tribe::AssetType type, csString name) |
| Return the quanitity of the given asset type matching the name. More... | |
| bool | AttachMember (NPC *npc, const char *tribeMemberType) |
| Attach a new member to the tribe. More... | |
| void | Build (NPC *npc, bool pickupable) |
| Build a building on the current NPC building spot. More... | |
| bool | CanGrow () const |
| Check if the tribe can grow by checking the tribes wealth. More... | |
| bool | CheckAsset (Tribe::AssetType type, csString name, int number) |
| Check to see if enough assets are available. More... | |
| bool | CheckAttach (NPC *npc) |
| Attach a new member to the tribe if the NPC is a member. More... | |
| bool | CheckKnowledge (csString knowHow) |
| Check if knowledge is known. More... | |
| bool | CheckMembers (const csString &type, int number) |
| Check to see if enough members are idle. More... | |
| bool | CheckResource (csString resource, int number) |
| Check to see if enough resources are available. More... | |
| bool | CheckWithinBoundsTribeHome (NPC *npc, const csVector3 &pos, const iSector *sector) |
| Check if the position is within the bounds of the tribe home. More... | |
| int | CountResource (csString resource) const |
| Return the amount of a given resource. More... | |
| void | DeleteAsset (csString name, int quantity) |
| Delete item assets. More... | |
| void | DeleteAsset (csString name, csVector3 pos) |
| Delete a building asset. More... | |
| void | DeleteCyclicRecipe (Recipe *recipe) |
| Delete a cyclic recipe. More... | |
| void | DumpAssets () |
| Dump Assets. More... | |
| void | DumpBuffers () |
| Dump Buffers. More... | |
| void | DumpKnowledge () |
| Dump knowledge to console. More... | |
| void | DumpRecipesToConsole () |
| Dumps all information about recipes to console. More... | |
| Memory * | FindMemory (csString name, const csVector3 &pos, iSector *sector, float radius) |
| Find a memory. More... | |
| Memory * | FindMemory (csString name) |
| Find a memory. More... | |
| Memory * | FindNearestMemory (const char *name, const csVector3 &pos, const iSector *sector, float range=-1.0, float *foundRange=NULL) |
| Find nearest memory to a position. More... | |
| Memory * | FindPrivMemory (csString name, const csVector3 &pos, iSector *sector, float radius, NPC *npc) |
| Find a privat memory. More... | |
| Memory * | FindRandomMemory (const char *name, const csVector3 &pos, const iSector *sector, float range=-1.0, float *foundRange=NULL) |
| Find a random memory within range to a position. More... | |
| void | ForgetMemories (NPC *npc) |
| Forget privat memories. More... | |
| Asset * | GetAsset (Tribe::AssetType type, csString name) |
| Get asset. More... | |
| Asset * | GetAsset (Tribe::AssetType type, csString name, Tribe::AssetStatus status) |
| Get asset. More... | |
| Asset * | GetAsset (Tribe::AssetType type, csString name, csVector3 where, iSector *sector) |
| Get an asset based on name and position. More... | |
| Asset * | GetAsset (gemNPCItem *item) |
| Get asset. More... | |
| Asset * | GetAsset (uint32_t itemUID) |
| Get asset. More... | |
| csString | GetBuffer (const csString &bufferName) |
| Return a named buffer from the NPC. More... | |
| float | GetDeathRate () |
| Retrive death rate average value from tribe. More... | |
| void | GetHome (csVector3 &pos, float &radius, iSector *§or) |
| Get home position for the tribe. More... | |
| csVector3 | GetHomePosition () |
| iSector * | GetHomeSector () |
| csString | GetHomeSectorName () |
| int | GetID () |
| int | GetMaxSize () const |
| Calculate the maximum number of members for the tribe. More... | |
| NPC * | GetMember (size_t i) |
| size_t | GetMemberCount () |
| size_t | GetMemberIDCount () |
| csList< Memory * >::Iterator | GetMemoryIterator () |
| gemNPCActor * | GetMostHated (NPC *npc, float range, bool includeOutsideRegion, bool includeInvisible, bool includeInvincible, float *hate=NULL) |
| Find the most hated entity for tribe within range. More... | |
| const char * | GetName () |
| Asset * | GetNearestAsset (Tribe::AssetType type, Tribe::AssetStatus status, csVector3 pos, iSector *sector, float range, float *locatedRange=NULL) |
| Get nearest asset. More... | |
| Asset * | GetNearestAsset (Tribe::AssetType type, csString name, Tribe::AssetStatus status, csVector3 pos, iSector *sector, float range, float *locatedRange=NULL) |
| Get an asset. More... | |
| const char * | GetNeededResource () |
| Get the most needed resource for this tribe. More... | |
| const char * | GetNeededResourceAreaType () |
| Get a area for the most needed resource for this tribe. More... | |
| const char * | GetNeededResourceNick () |
| Get the nick for the most needed resource for this tribe. More... | |
| csString | GetNPCIdleBehavior () |
| Asset * | GetRandomAsset (Tribe::AssetType type, Tribe::AssetStatus status, csVector3 pos, iSector *sector, float range) |
| Get a random asset. More... | |
| Asset * | GetRandomAsset (Tribe::AssetType type, csString name, Tribe::AssetStatus status, csVector3 pos, iSector *sector, float range) |
| Get an asset. More... | |
| int | GetReproductionCost () const |
| Return the reproduction cost for this tribe. More... | |
| const Resource & | GetResource (size_t n) |
| bool | GetResource (NPC *npc, csVector3 startPos, iSector *startSector, csVector3 &pos, iSector *§or, float range, bool random) |
| Get a memorized location for resources. More... | |
| Tribe::Memory * | GetResource (csString resourceName, NPC *npc) |
| Get the closest Memory regarding a resource or the closest non-prospected mine. More... | |
| size_t | GetResourceCount () |
| float | GetResourceRate () |
| Retrive resource rate average value from tribe. More... | |
| Recipe * | GetTribalRecipe () |
| Get the main recipe. More... | |
| float | GetWealthResourceGrowth () const |
| Get wealth resource growth rate. More... | |
| float | GetWealthResourceGrowthActive () const |
| Get wealth resource growth rate active. More... | |
| int | GetWealthResourceGrowthActiveLimit () const |
| Get wealth resource growth active limit. More... | |
| bool | HandleDeath (NPC *npc) |
| Remove members that die. More... | |
| void | HandlePerception (NPC *npc, Perception *perception) |
| Handled a perception given to this tribe. More... | |
| void | HandlePersistItem (gemNPCItem *item) |
| Handle persist items that should be assets. More... | |
| bool | Load (iResultRow &row) |
| Load the tribe object. More... | |
| void | LoadAsset (iResultRow &row) |
| Load an asset from an iResultRow. More... | |
| bool | LoadMember (iResultRow &row) |
| Load and add a new member to the tribe. More... | |
| bool | LoadMemory (iResultRow &row) |
| Load all stored memories from db. More... | |
| bool | LoadNPCMemoryBuffer (const char *name, csArray< NPC * > npcs) |
| Set npcs memory buffers. More... | |
| void | LoadNPCMemoryBuffer (Tribe::Memory *memory, csArray< NPC * > npcs) |
| Set npcs memory buffers - Using a memory. More... | |
| bool | LoadResource (iResultRow &row) |
| Load and add a new resource to the tribe. More... | |
| void | Memorize (NPC *npc, Perception *perception) |
| Memorize a perception. More... | |
| void | ModifyWait (Recipe *recipe, int delta) |
| Modify Wait Time for a recipe. More... | |
| void | ProspectMine (NPC *npc, csString resource, csString nick) |
| Assigned a resource to a prospect Mine. More... | |
| void | RemoveAsset (Tribe::Asset *asset) |
| Remove an asset. More... | |
| void | ReplaceBuffers (csString &result) |
| Replace $TBUFFER[x] with values from the NPC buffer. More... | |
| void | SaveAsset (Tribe::Asset *asset, bool deletion=false) |
| Save an asset to the db - responsable for deleting assets to. More... | |
| void | SaveKnowledge (csString knowHow) |
| Save a knowledge piece in the database. More... | |
| void | SaveMemory (Memory *memory) |
| Save a memory to the db. More... | |
| void | SaveResource (Resource *resource, bool newResource) |
| Save or update an resource in database. More... | |
| virtual void | ScopedTimerCallback (const ScopedTimer *timer) |
| Callback for debug of long time used in scopes. More... | |
| csArray< NPC * > | SelectNPCs (const csString &type, const char *number) |
| Returns pointers to required npcs for a task. More... | |
| void | SendPerception (const char *pcpt, csArray< NPC * > npcs) |
| Sends the given perception to the given list of npcs. More... | |
| void | SendPerception (const char *pcpt) |
| Sends the given perception to the tribe. More... | |
| void | SetBuffer (const csString &bufferName, const csString &value) |
| Set/Update the value of a named buffer. More... | |
| void | SetHome (const csVector3 &pos, float radius, iSector *sector) |
| Set home position for the tribe. More... | |
| void | SetRecipeManager (RecipeManager *rm) |
| Sets the tribe's recipe manager. More... | |
| void | ShareMemories (NPC *npc) |
| Share privat memories with the other npcs. More... | |
| bool | ShouldGrow () const |
| Check if the tribe should grow by checking number of members against max size. More... | |
| Tribe (EventManager *eventmngr, RecipeManager *rm) | |
| Construct a new tribe object. More... | |
| void | TriggerEvent (Perception *pcpt, float maxRange=-1.0, csVector3 *basePos=NULL, iSector *baseSector=NULL) |
| Send a perception to all members of the tribe. More... | |
| void | Unbuild (NPC *npc, gemNPCItem *building) |
| Tear down a building. More... | |
| void | UpdateRecipeData (int delta) |
| Updates recipe wait times. More... | |
| virtual | ~Tribe () |
| Destruct a tribe object. More... | |
Public Member Functions inherited from ScopedTimerCB | |
| virtual | ~ScopedTimerCB () |
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... | |
Static Public Attributes | |
| static const char * | AssetStatusStr [] |
| static const char * | AssetTypeStr [] |
Additional Inherited Members | |
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... | |
Holds list of tribe members, position of tribe home Keeps resources and handles tribe perceptions.
| typedef csHash<csString,csString> Tribe::BufferHash |
| enum Tribe::AssetStatus |
| enum Tribe::AssetType |
| Tribe::Tribe | ( | EventManager * | eventmngr, |
| RecipeManager * | rm | ||
| ) |
Construct a new tribe object.
|
virtual |
Destruct a tribe object.
| void Tribe::AddAsset | ( | Tribe::AssetType | type, |
| csString | name, | ||
| gemNPCItem * | item, | ||
| int | quantity, | ||
| int | id = -1 |
||
| ) |
Add an item asset.
| Tribe::Asset* Tribe::AddAsset | ( | Tribe::AssetType | type, |
| csString | name, | ||
| csVector3 | position, | ||
| iSector * | sector, | ||
| Tribe::AssetStatus | status | ||
| ) |
Add an asset to the tribe.
|
inline |
| bool Tribe::AddMember | ( | PID | pid, |
| const char * | tribeMemberType | ||
| ) |
Adds a new member to the tribe.
| void Tribe::AddMemory | ( | csString | name, |
| const csVector3 & | pos, | ||
| iSector * | sector, | ||
| float | radius, | ||
| NPC * | npc | ||
| ) |
Add a new memory to the tribe.
| void Tribe::AddResource | ( | csString | resource, |
| int | amount, | ||
| csString | nick = "" |
||
| ) |
Add a new resource to the tribe resource table.
| void Tribe::Advance | ( | csTicks | when, |
| EventManager * | eventmgr | ||
| ) |
Advance the tribe.
| int Tribe::AliveCount | ( | ) | const |
Count number of alive members.
| size_t Tribe::AssetQuantity | ( | Tribe::AssetType | type, |
| csString | name | ||
| ) |
Return the quanitity of the given asset type matching the name.
| bool Tribe::AttachMember | ( | NPC * | npc, |
| const char * | tribeMemberType | ||
| ) |
Attach a new member to the tribe.
| bool Tribe::CanGrow | ( | ) | const |
Check if the tribe can grow by checking the tribes wealth.
| bool Tribe::CheckAsset | ( | Tribe::AssetType | type, |
| csString | name, | ||
| int | number | ||
| ) |
Check to see if enough assets are available.
| bool Tribe::CheckKnowledge | ( | csString | knowHow | ) |
Check if knowledge is known.
| bool Tribe::CheckMembers | ( | const csString & | type, |
| int | number | ||
| ) |
Check to see if enough members are idle.
| bool Tribe::CheckResource | ( | csString | resource, |
| int | number | ||
| ) |
Check to see if enough resources are available.
| bool Tribe::CheckWithinBoundsTribeHome | ( | NPC * | npc, |
| const csVector3 & | pos, | ||
| const iSector * | sector | ||
| ) |
Check if the position is within the bounds of the tribe home.
| npc | The npc responsible for this checking |
| pos | The position to check |
| sector | The sector to check |
| int Tribe::CountResource | ( | csString | resource | ) | const |
Return the amount of a given resource.
| void Tribe::DeleteAsset | ( | csString | name, |
| int | quantity | ||
| ) |
Delete item assets.
| void Tribe::DeleteAsset | ( | csString | name, |
| csVector3 | pos | ||
| ) |
Delete a building asset.
| void Tribe::DeleteCyclicRecipe | ( | Recipe * | recipe | ) |
Delete a cyclic recipe.
| void Tribe::DumpAssets | ( | ) |
Dump Assets.
| void Tribe::DumpBuffers | ( | ) |
Dump Buffers.
| void Tribe::DumpKnowledge | ( | ) |
Dump knowledge to console.
| void Tribe::DumpRecipesToConsole | ( | ) |
Dumps all information about recipes to console.
Find a memory.
| Memory* Tribe::FindMemory | ( | csString | name | ) |
Find a memory.
| Memory* Tribe::FindNearestMemory | ( | const char * | name, |
| const csVector3 & | pos, | ||
| const iSector * | sector, | ||
| float | range = -1.0, |
||
| float * | foundRange = NULL |
||
| ) |
Find nearest memory to a position.
| Memory* Tribe::FindPrivMemory | ( | csString | name, |
| const csVector3 & | pos, | ||
| iSector * | sector, | ||
| float | radius, | ||
| NPC * | npc | ||
| ) |
Find a privat memory.
| Memory* Tribe::FindRandomMemory | ( | const char * | name, |
| const csVector3 & | pos, | ||
| const iSector * | sector, | ||
| float | range = -1.0, |
||
| float * | foundRange = NULL |
||
| ) |
Find a random memory within range to a position.
| void Tribe::ForgetMemories | ( | NPC * | npc | ) |
Forget privat memories.
Should be called when npc die.
| Asset* Tribe::GetAsset | ( | Tribe::AssetType | type, |
| csString | name | ||
| ) |
Get asset.
| Asset* Tribe::GetAsset | ( | Tribe::AssetType | type, |
| csString | name, | ||
| Tribe::AssetStatus | status | ||
| ) |
Get asset.
| Asset* Tribe::GetAsset | ( | Tribe::AssetType | type, |
| csString | name, | ||
| csVector3 | where, | ||
| iSector * | sector | ||
| ) |
Get an asset based on name and position.
| Asset* Tribe::GetAsset | ( | gemNPCItem * | item | ) |
Get asset.
| Asset* Tribe::GetAsset | ( | uint32_t | itemUID | ) |
Get asset.
| csString Tribe::GetBuffer | ( | const csString & | bufferName | ) |
Return a named buffer from the NPC.
Function used to get data from buffers containing information.
| bufferName | The name of the buffer to retrive. |
|
inline |
| void Tribe::GetHome | ( | csVector3 & | pos, |
| float & | radius, | ||
| iSector *& | sector | ||
| ) |
Get home position for the tribe.
| iSector* Tribe::GetHomeSector | ( | ) |
| int Tribe::GetMaxSize | ( | ) | const |
Calculate the maximum number of members for the tribe.
|
inline |
| gemNPCActor* Tribe::GetMostHated | ( | NPC * | npc, |
| float | range, | ||
| bool | includeOutsideRegion, | ||
| bool | includeInvisible, | ||
| bool | includeInvincible, | ||
| float * | hate = NULL |
||
| ) |
Find the most hated entity for tribe within range.
Check the hate list and retrive most hated entity within range of the given NPC.
| npc | The senter of the search. |
| range | The range to search for hated entities. |
| includeOutsideRegion | Include outside region entities in the search. |
| includeInvisible | Include invisible entities in the search. |
| includeInvincible | Include invincible entities in the search. |
| hate | If diffrent from NULL, set upon return to the hate of the hated. |
| Asset* Tribe::GetNearestAsset | ( | Tribe::AssetType | type, |
| Tribe::AssetStatus | status, | ||
| csVector3 | pos, | ||
| iSector * | sector, | ||
| float | range, | ||
| float * | locatedRange = NULL |
||
| ) |
Get nearest asset.
| Asset* Tribe::GetNearestAsset | ( | Tribe::AssetType | type, |
| csString | name, | ||
| Tribe::AssetStatus | status, | ||
| csVector3 | pos, | ||
| iSector * | sector, | ||
| float | range, | ||
| float * | locatedRange = NULL |
||
| ) |
Get an asset.
| const char* Tribe::GetNeededResource | ( | ) |
Get the most needed resource for this tribe.
| const char* Tribe::GetNeededResourceAreaType | ( | ) |
Get a area for the most needed resource for this tribe.
| const char* Tribe::GetNeededResourceNick | ( | ) |
Get the nick for the most needed resource for this tribe.
| Asset* Tribe::GetRandomAsset | ( | Tribe::AssetType | type, |
| Tribe::AssetStatus | status, | ||
| csVector3 | pos, | ||
| iSector * | sector, | ||
| float | range | ||
| ) |
Get a random asset.
| Asset* Tribe::GetRandomAsset | ( | Tribe::AssetType | type, |
| csString | name, | ||
| Tribe::AssetStatus | status, | ||
| csVector3 | pos, | ||
| iSector * | sector, | ||
| float | range | ||
| ) |
Get an asset.
| int Tribe::GetReproductionCost | ( | ) | const |
Return the reproduction cost for this tribe.
| bool Tribe::GetResource | ( | NPC * | npc, |
| csVector3 | startPos, | ||
| iSector * | startSector, | ||
| csVector3 & | pos, | ||
| iSector *& | sector, | ||
| float | range, | ||
| bool | random | ||
| ) |
Get a memorized location for resources.
| Tribe::Memory* Tribe::GetResource | ( | csString | resourceName, |
| NPC * | npc | ||
| ) |
Get the closest Memory regarding a resource or the closest non-prospected mine.
|
inline |
| Recipe* Tribe::GetTribalRecipe | ( | ) |
Get the main recipe.
| float Tribe::GetWealthResourceGrowth | ( | ) | const |
Get wealth resource growth rate.
Get the rate that the wealth will grow when all members are dead.
| float Tribe::GetWealthResourceGrowthActive | ( | ) | const |
Get wealth resource growth rate active.
Get the rate that the wealth will grow when there are alive members.
| int Tribe::GetWealthResourceGrowthActiveLimit | ( | ) | const |
Get wealth resource growth active limit.
Get the limit that the wealth will be capped at when there are alive members.
| bool Tribe::HandleDeath | ( | NPC * | npc | ) |
Remove members that die.
| void Tribe::HandlePerception | ( | NPC * | npc, |
| Perception * | perception | ||
| ) |
Handled a perception given to this tribe.
| void Tribe::HandlePersistItem | ( | gemNPCItem * | item | ) |
Handle persist items that should be assets.
| bool Tribe::Load | ( | iResultRow & | row | ) |
Load the tribe object.
| void Tribe::LoadAsset | ( | iResultRow & | row | ) |
Load an asset from an iResultRow.
| bool Tribe::LoadMember | ( | iResultRow & | row | ) |
Load and add a new member to the tribe.
| bool Tribe::LoadMemory | ( | iResultRow & | row | ) |
Load all stored memories from db.
| bool Tribe::LoadNPCMemoryBuffer | ( | const char * | name, |
| csArray< NPC * > | npcs | ||
| ) |
Set npcs memory buffers.
Loads locations into the Memory buffers of the npcs. Useful when assigning tasks to them.
| name | Name of the memory/resource to load. |
| npcs | Link to the npcs on which to load. |
| void Tribe::LoadNPCMemoryBuffer | ( | Tribe::Memory * | memory, |
| csArray< NPC * > | npcs | ||
| ) |
Set npcs memory buffers - Using a memory.
| bool Tribe::LoadResource | ( | iResultRow & | row | ) |
Load and add a new resource to the tribe.
| void Tribe::Memorize | ( | NPC * | npc, |
| Perception * | perception | ||
| ) |
| void Tribe::ProspectMine | ( | NPC * | npc, |
| csString | resource, | ||
| csString | nick | ||
| ) |
Assigned a resource to a prospect Mine.
Upon 'Explore' behavior, tribe members may find locations named 'mine'. After mining from an unkown deposit, the npcclient will receive a psWorkDoneMessage telling it what his npc just mined. This function renames the former 'mine' Memory with it's real deposit name.
| npc | The npc who prospected it to access his memoryBuffer. |
| resource | The resulted resource received from psServer. |
| nick | The nick name of the resource for this mine. |
| void Tribe::RemoveAsset | ( | Tribe::Asset * | asset | ) |
Remove an asset.
| void Tribe::ReplaceBuffers | ( | csString & | result | ) |
Replace $TBUFFER[x] with values from the NPC buffer.
| result | String to replace buffers in. |
| void Tribe::SaveAsset | ( | Tribe::Asset * | asset, |
| bool | deletion = false |
||
| ) |
Save an asset to the db - responsable for deleting assets to.
| void Tribe::SaveKnowledge | ( | csString | knowHow | ) |
Save a knowledge piece in the database.
| void Tribe::SaveMemory | ( | Memory * | memory | ) |
Save a memory to the db.
| void Tribe::SaveResource | ( | Resource * | resource, |
| bool | newResource | ||
| ) |
Save or update an resource in database.
|
virtual |
Callback for debug of long time used in scopes.
Implements ScopedTimerCB.
| csArray<NPC*> Tribe::SelectNPCs | ( | const csString & | type, |
| const char * | number | ||
| ) |
Returns pointers to required npcs for a task.
| void Tribe::SendPerception | ( | const char * | pcpt, |
| csArray< NPC * > | npcs | ||
| ) |
Sends the given perception to the given list of npcs.
Used by the recipe manager to send perceptions to tribe members selected by the active recipe.
| pcpt | The perception name to be sent |
| npcs | The list of npcs to send perception to. |
| void Tribe::SendPerception | ( | const char * | pcpt | ) |
Sends the given perception to the tribe.
Used to send perceptions to all tribe members.
| pcpt | The perception name to be sent |
| void Tribe::SetBuffer | ( | const csString & | bufferName, |
| const csString & | value | ||
| ) |
Set/Update the value of a named buffer.
| bufferName | The buffer name. |
| value | The value to put in the buffer. |
| void Tribe::SetHome | ( | const csVector3 & | pos, |
| float | radius, | ||
| iSector * | sector | ||
| ) |
Set home position for the tribe.
|
inline |
| void Tribe::ShareMemories | ( | NPC * | npc | ) |
Share privat memories with the other npcs.
Should be called when npc return to home.
| bool Tribe::ShouldGrow | ( | ) | const |
Check if the tribe should grow by checking number of members against max size.
| void Tribe::TriggerEvent | ( | Perception * | pcpt, |
| float | maxRange = -1.0, |
||
| csVector3 * | basePos = NULL, |
||
| iSector * | baseSector = NULL |
||
| ) |
Send a perception to all members of the tribe.
This will send the perception to all the members of the tribe. If the maxRange has been set to something greater than 0.0 a range check will be applied. Only members within the range from the base position and sector will be triggered.
| pcpt | Perception to be sent. |
| maxRange | If greater then 0.0 then max range apply |
| basePos | The base position for range checks. |
| baseSector | The base sector for range checks. |
| void Tribe::Unbuild | ( | NPC * | npc, |
| gemNPCItem * | building | ||
| ) |
Tear down a building.
| void Tribe::UpdateRecipeData | ( | int | delta | ) |
Updates recipe wait times.