summaryrefslogtreecommitdiff
path: root/src/inventory.h
diff options
context:
space:
mode:
authorNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-07-30 19:46:55 +0200
committerNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-07-30 19:47:55 +0200
commit96bee29e35f0790657fbd8bb67d2af79b498255c (patch)
tree0712c75629ab16fad84af11050ef94d8c8ac8137 /src/inventory.h
parent82ea53499710c9a4e92ec595d8c14c417bdd0ee6 (diff)
parentf2051c98223d087c8ba3d7e4514935781c93ed1c (diff)
downloadminetest-96bee29e35f0790657fbd8bb67d2af79b498255c.tar.gz
minetest-96bee29e35f0790657fbd8bb67d2af79b498255c.tar.bz2
minetest-96bee29e35f0790657fbd8bb67d2af79b498255c.zip
Merge branch 'upstream/master'
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
*/