1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Players are more like objects + related stuff

This commit is contained in:
Perttu Ahola 2011-12-01 23:33:48 +02:00
parent ee0d3bacbc
commit af32240545
15 changed files with 622 additions and 599 deletions

View file

@ -43,6 +43,7 @@ Some planning
class ServerEnvironment;
class InventoryItem;
class Player;
struct ToolDiggingProperties;
class ServerActiveObject : public ActiveObject
{
@ -128,23 +129,24 @@ public:
virtual bool isStaticAllowed() const
{return true;}
virtual void punch(ServerActiveObject *puncher){}
virtual void rightClick(ServerActiveObject *clicker){}
// Returns a reference
virtual InventoryItem* getWieldedItem()
{ return NULL; }
// time_from_last_punch is used for lessening damage if punching fast
virtual void punch(ServerActiveObject *puncher,
float time_from_last_punch=1000000)
{}
virtual void rightClick(ServerActiveObject *clicker)
{}
virtual void getWieldDiggingProperties(ToolDiggingProperties *dst);
virtual void damageWieldedItem(u16 amount)
{}
{}
// If all fits, eats item and returns true. Otherwise returns false.
virtual bool addToInventory(InventoryItem *item)
{return false;}
{ return false; }
virtual void addToInventoryLater(InventoryItem *item)
{}
{}
virtual void setHP(s16 hp)
{}
{}
virtual s16 getHP()
{return 0;}
{ return 0; }
/*
Number of players which know about this object. Object won't be