summaryrefslogtreecommitdiff
path: root/src/inventory.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-07-30 18:51:15 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-07-30 18:51:15 +0300
commitd62ae0e18bc570033ada07454b1642f696fe17b1 (patch)
tree69564fe33c88a90e74ccf0da356e9664ecc32817 /src/inventory.h
parent4556c212dba726271352b05a9299564e05abb218 (diff)
downloadminetest-d62ae0e18bc570033ada07454b1642f696fe17b1.tar.gz
minetest-d62ae0e18bc570033ada07454b1642f696fe17b1.tar.bz2
minetest-d62ae0e18bc570033ada07454b1642f696fe17b1.zip
Rats are now eatable. Also made their selection box move smoothly.
Diffstat (limited to 'src/inventory.h')
-rw-r--r--src/inventory.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/inventory.h b/src/inventory.h
index 5c64f89bb..66b1cd1f0 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class ServerActiveObject;
class ServerEnvironment;
+class Player;
class InventoryItem
{
@@ -99,12 +100,19 @@ public:
/*
Other properties
*/
+
// Whether it can be cooked
virtual bool isCookable(){return false;}
// Time of cooking
virtual float getCookTime(){return 3.0;}
- // Result of cooking
+ // Result of cooking (can randomize)
virtual InventoryItem *createCookResult(){return NULL;}
+
+ // Eat, press, activate, whatever.
+ // Called when item is right-clicked when lying on ground.
+ // If returns true, item shall be deleted.
+ virtual bool use(ServerEnvironment *env,
+ Player *player){return false;}
protected:
u16 m_count;
@@ -298,11 +306,16 @@ public:
return 0;
return QUANTITY_ITEM_MAX_COUNT - m_count;
}
+
/*
Other properties
*/
+
bool isCookable();
InventoryItem *createCookResult();
+
+ bool use(ServerEnvironment *env, Player *player);
+
/*
Special methods
*/