Planeshift
gemContainer Class Reference

gemContainers are the public containers in the world for crafting, like forges or ovens. More...

#include <gem.h>

Classes

class  psContainerIterator
 

Public Member Functions

bool AddToContainer (psItem *item, Client *fromClient, int slot=-1)
 
bool CanAdd (unsigned short amountToAdd, psItem *item, int slot, csString &reason)
 Check if a item can be added to a container. More...
 
bool CanTake (Client *client, psItem *item)
 Checks if client is allowed to remove an item from the container. More...
 
void CleareWithoutDelete ()
 Clear list of items without delting them. More...
 
size_t CountItems ()
 
psItemFindItemInSlot (int slot, int stackCount=-1)
 
 gemContainer (GEMSupervisor *gemSupervisor, CacheManager *cachemanager, EntityManager *entitymanager, psItem *item, const char *factname, InstanceID myInstance, iSector *room, const csVector3 &pos, float xrotangle, float yrotangle, float zrotangle, int clientnum)
 
psItemGetIndexItem (size_t i)
 
bool RemoveFromContainer (psItem *item, Client *fromClient)
 
psItemRemoveFromContainer (psItem *itemStack, int fromSlot, Client *fromClient, int stackCount)
 Remove an item from the container. More...
 
int SlotCount ()
 
 ~gemContainer ()
 
- Public Member Functions inherited from gemItem
virtual void Broadcast (int clientnum, bool control)
 
void ClearItemData ()
 
 gemItem (GEMSupervisor *gemsupervisor, CacheManager *cachemanager, EntityManager *entitymanager, psItem *item, const char *factname, InstanceID myInstance, iSector *room, const csVector3 &pos, float xrotangle, float yrotangle, float zrotangle, int clientnum)
 
virtual float GetBaseAdvertiseRange ()
 This value indicates the range that this entity would become visible to other entities if no other modifiers were taken into consideration. More...
 
virtual bool GetCanTransform ()
 
psItemGetItemData ()
 
virtual const char * GetObjectType ()
 
virtual void GetRotation (float &xrotangle, float &yrotangle, float &zrotangle)
 Get the x,y and z axis rotations for the item. More...
 
uint32_t GetTribeID ()
 
virtual bool GetVisibility ()
 
virtual bool IsConstructible ()
 
virtual bool IsContainer ()
 
virtual bool IsLockable ()
 
virtual bool IsLocked ()
 
virtual bool IsPickupable ()
 Gets if the object can be picked up from anyone. More...
 
virtual bool IsPickupableStrong ()
 Gets if the object can be picked up from anyone according to strong rules. More...
 
virtual bool IsPickupableWeak ()
 Gets if the object can be picked up from anyone according to weak rules. More...
 
virtual bool IsSecurityLocked ()
 
virtual bool IsUsingCD ()
 
virtual bool Send (int clientnum, bool control, bool to_superclients, psPersistAllEntities *allEntities=NULL)
 Send this object to the given client. More...
 
virtual void SendBehaviorMessage (const csString &str, gemObject *obj)
 
virtual void SetPosition (const csVector3 &pos, float angle, iSector *sector, InstanceID instance)
 Set position of item in world. More...
 
virtual void SetRotation (float xrotangle, float yrotangle, float zrotangle)
 Set the x, y and z axis rotations for the item. More...
 
void SetTribeID (uint32_t id)
 
virtual ~gemItem ()
 
virtual double GetProperty (MathEnvironment *env, const char *ptr)
 
virtual double CalcFunction (MathEnvironment *env, const char *functionName, const double *params)
 
- Public Member Functions inherited from gemActiveObject
 gemActiveObject (GEMSupervisor *gemSupervisor, EntityManager *entitymanager, CacheManager *cachemanager, const char *name, const char *factname, InstanceID myInstance, iSector *room, const csVector3 &pos, float rotangle, int clientnum)
 
virtual csString GetDefaultBehavior (const csString &dfltBehaviors)
 
virtual bool IsSecutityLocked ()
 
- Public Member Functions inherited from gemObject
virtual void Disconnect ()
 Called when a client disconnects. More...
 
virtual void Dump ()
 Dump debug information. More...
 
gemActorGetActorPtr ()
 
gemActionLocationGetALPtr ()
 
virtual psCharacterGetCharacterData ()
 
virtual ClientGetClient () const
 
uint32_t GetClientID ()
 
EID GetEID ()
 
InstanceID GetInstance ()
 
psItemGetItem ()
 
gemItemGetItemPtr ()
 
const char * GetName ()
 
gemNPCGetNPCPtr ()
 
gemPetGetPetPtr ()
 
bool IsAlive () const
 Returns whether the object is alive. More...
 
virtual bool IsUpdateReq (csVector3 const &pos, csVector3 const &oldPos)
 
virtual bool IsValid (void)
 
float RangeTo (gemObject *obj, bool ignoreY=false, bool ignoreInstance=false)
 
void RegisterCallback (iDeleteObjectCallback *receiver)
 
void SetAlive (bool flag, bool queue=true)
 Set needed stats for alive or dead for object. More...
 
void SetInstance (InstanceID newInstance)
 
void SetName (const char *n)
 
void UnregisterCallback (iDeleteObjectCallback *receiver)
 
virtual ~gemObject ()
 
virtual const char * ToString ()
 
iMeshWrapper * GetMeshWrapper ()
 
csString GetMesh ()
 
void Move (const csVector3 &pos, float rotangle, iSector *room)
 
bool IsNear (gemObject *obj, float radius, bool ignoreY=false)
 
const csVector3 & GetPosition ()
 
void GetPosition (csVector3 &pos, float &yrot, iSector *&sector)
 
void GetPosition (csVector3 &pos, iSector *&sector)
 
float GetAngle ()
 Get rotation of entity as returned by psWorld::Matrix2YRot. More...
 
iSector * GetSector ()
 
virtual float GetVelocity ()
 Get the z velocity of the actor. More...
 
const char * GetSectorName ()
 
csArray< gemObject * > * GetObjectsInRange (float range)
 
ProximityListGetProxList ()
 
csArray< PublishDestination > & GetMulticastClients ()
 Returns all the clients which are inside our proxy list. More...
 
void UpdateProxList (bool force=false)
 Generates proxlist if needed (or forced). More...
 
void RemoveFromAllProx ()
 
void SetAlwaysWatching (bool w)
 
bool AlwaysWatching ()
 
virtual void SendGroupMessage (MsgEntry *me)
 Distribute this object to all members of a group. More...
 
virtual PID GetPID ()
 
virtual int GetGuildID ()
 
virtual psGuildInfoGetGuild ()
 
virtual bool UpdateDR ()
 
virtual void BroadcastTargetStatDR (ClientConnectionSet *clients)
 
virtual void SendTargetStatDR (Client *client)
 
virtual psNPCDialogGetNPCDialogPtr ()
 
virtual void GetLastSuperclientPos (csVector3 &pos, InstanceID &instance, csTicks &last) const
 
virtual void SetLastSuperclientPos (const csVector3 &pos, InstanceID instance, const csTicks &now)
 
virtual void AddLootablePlayer (PID playerID)
 
virtual void RemoveLootablePlayer (PID playerID)
 
virtual bool IsLootablePlayer (PID playerID)
 
virtual ClientGetRandomLootClient (int range)
 
virtual AccountID GetSuperclientID ()
 
virtual void SetSuperclientID (AccountID id)
 
virtual bool SeesObject (gemObject *object, float range)
 
virtual gemObjectGetOwner ()
 
virtual bool HasKillStealProtection ()
 Returns if the object has killsteal protection. More...
 
- Public Member Functions inherited from iDeleteNotificationObject
virtual ~iDeleteNotificationObject ()
 
- Public Member Functions inherited from iScriptableVar
virtual ~iScriptableVar ()
 

Protected Member Functions

bool AddToContainer (psItem *item, Client *fromClient, int slot, bool test)
 
- Protected Member Functions inherited from gemObject
 gemObject (GEMSupervisor *gemsupervisor, EntityManager *entitymanager, CacheManager *cachemanager, const char *name, const char *factname, InstanceID myinstance, iSector *room, const csVector3 &pos, float rotangle, int clientnum)
 
void InitMesh (const char *name, const csVector3 &pos, const float rotangle, iSector *room)
 
bool InitProximityList (float radius, int clientnum)
 

Protected Attributes

csArray< psItem * > itemlist
 
- Protected Attributes inherited from gemItem
psItemitemdata
 
csString itemType
 
uint32_t tribeID
 Holds the id of the tribe owning this item (0 if is not tribe-owned) More...
 
float xRot
 
float yRot
 
float zRot
 
- Protected Attributes inherited from gemObject
bool alwaysWatching
 True if this object always watches (proxlists) regardless of owner. More...
 
CacheManagercacheManager
 
EID eid
 Entity ID (unique identifier for object) More...
 
EntityManagerentityManager
 
csString factname
 Name of CS Mesh Factory used to create this object. More...
 
bool is_alive
 Flag indicating whether object is alive or not. More...
 
csString matname
 Name of base material used by this object. More...
 
csString name
 Name of this object, used mostly for debugging. More...
 
csRef< iMeshFactoryWrapper > nullfact
 Null factory for our mesh instances. More...
 
gemMeshpcmesh
 link to mesh class More...
 
float prox_distance_current
 What is the current actual range for proxlists (they adjust when the # of objects gets too high) More...
 
float prox_distance_desired
 What is the maximum range of proxlist we want. More...
 
ProximityListproxlist
 Proximity List for this object. More...
 
csArray< iDeleteObjectCallback * > receivers
 List of objects which are to be notified when this object is deleted. More...
 
bool valid
 Is object fully loaded. More...
 
InstanceID worldInstance
 Only objects which match instances can see each other. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from gemObject
static GEMSupervisorcel
 Static ptr back to main collection of all objects. More...
 

Detailed Description

gemContainers are the public containers in the world for crafting, like forges or ovens.

Regular containers in inventory, like sacks, are simulated by psCharInventory.

Definition at line 935 of file gem.h.

Constructor & Destructor Documentation

gemContainer::gemContainer ( GEMSupervisor gemSupervisor,
CacheManager cachemanager,
EntityManager entitymanager,
psItem item,
const char *  factname,
InstanceID  myInstance,
iSector *  room,
const csVector3 &  pos,
float  xrotangle,
float  yrotangle,
float  zrotangle,
int  clientnum 
)
gemContainer::~gemContainer ( )

Member Function Documentation

bool gemContainer::AddToContainer ( psItem item,
Client fromClient,
int  slot,
bool  test 
)
protected
bool gemContainer::AddToContainer ( psItem item,
Client fromClient,
int  slot = -1 
)
inline

Definition at line 967 of file gem.h.

bool gemContainer::CanAdd ( unsigned short  amountToAdd,
psItem item,
int  slot,
csString &  reason 
)

Check if a item can be added to a container.

bool gemContainer::CanTake ( Client client,
psItem item 
)

Checks if client is allowed to remove an item from the container.

Parameters
clientA pointer to the client viewing the container
itemItem being viewed or taken
Returns
boolean indicating if client is allowed to take the item
void gemContainer::CleareWithoutDelete ( )

Clear list of items without delting them.

Used when item is moved from world to inventory.

size_t gemContainer::CountItems ( )
inline

Definition at line 1001 of file gem.h.

psItem* gemContainer::FindItemInSlot ( int  slot,
int  stackCount = -1 
)
psItem* gemContainer::GetIndexItem ( size_t  i)
inline

Definition at line 1005 of file gem.h.

bool gemContainer::RemoveFromContainer ( psItem item,
Client fromClient 
)
psItem* gemContainer::RemoveFromContainer ( psItem itemStack,
int  fromSlot,
Client fromClient,
int  stackCount 
)

Remove an item from the container.

Parameters
itemStackA pointer to the complete stack of the items we are looking at.
fromSlotWhere in the container the items are removed from.
fromClientThe client that is removing the items.
stackCountThe amount of items we want to remove.
Returns
An item pointer that is the removed items from container. If itemStack == the item returned then the entire stack has been removed. Otherwise it will be a new item instance.
int gemContainer::SlotCount ( )
inline

Definition at line 997 of file gem.h.

Member Data Documentation

csArray<psItem*> gemContainer::itemlist
protected

Definition at line 938 of file gem.h.


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