- /*
- If the object doesn't return an item, this will be called.
- Return value is tool wear.
- */
- virtual u16 punch(const std::string &toolname, v3f dir,
- const std::string &playername)
- {return 0;}
-
- /*
- */
- virtual void rightClick(Player *player){}
+ // 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; }
+ virtual void addToInventoryLater(InventoryItem *item)
+ {}
+ virtual void setHP(s16 hp)
+ {}
+ virtual s16 getHP()
+ { return 0; }