summaryrefslogtreecommitdiff
path: root/src/inventory.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-10 15:16:27 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-10 15:16:27 +0300
commit5a4d8ffad3b172eae67844deda6b65273b7c9757 (patch)
tree70b32f31eaf824fec947d890377bf1e40555225c /src/inventory.h
parent08bbf9687742c0b159cc1d963ab470796f74c6c8 (diff)
downloadminetest-5a4d8ffad3b172eae67844deda6b65273b7c9757.tar.gz
minetest-5a4d8ffad3b172eae67844deda6b65273b7c9757.tar.bz2
minetest-5a4d8ffad3b172eae67844deda6b65273b7c9757.zip
implemented rats in new system to verify that it works
Diffstat (limited to 'src/inventory.h')
-rw-r--r--src/inventory.h39
1 files changed, 14 insertions, 25 deletions
diff --git a/src/inventory.h b/src/inventory.h
index 761e664a9..3ba655880 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -35,6 +35,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define QUANTITY_ITEM_MAX_COUNT 99
+class ServerActiveObject;
+class ServerEnvironment;
+
class InventoryItem
{
public:
@@ -54,6 +57,12 @@ public:
#endif
// Shall return a text to show in the GUI
virtual std::string getText() { return ""; }
+ // Creates an object from the item, to be placed in the world.
+ virtual ServerActiveObject* createSAO(ServerEnvironment *env, u16 id, v3f pos);
+
+ /*
+ Quantity methods
+ */
// Shall return true if the item can be add()ed to the other
virtual bool addableTo(InventoryItem *other)
@@ -61,9 +70,6 @@ public:
return false;
}
- /*
- Quantity methods
- */
u16 getCount()
{
return m_count;
@@ -175,6 +181,7 @@ private:
u8 m_content;
};
+//TODO: Remove
class MapBlockObjectItem : public InventoryItem
{
public:
@@ -262,28 +269,7 @@ public:
return new CraftItem(m_subname, m_count);
}
#ifndef SERVER
- video::ITexture * getImage()
- {
- if(g_texturesource == NULL)
- return NULL;
-
- std::string name;
-
- if(m_subname == "Stick")
- name = "stick.png";
- else if(m_subname == "lump_of_coal")
- name = "lump_of_coal.png";
- else if(m_subname == "lump_of_iron")
- name = "lump_of_iron.png";
- else if(m_subname == "steel_ingot")
- name = "steel_ingot.png";
- else
- name = "cloud.png";
-
- // Get such a texture
- //return g_irrlicht->getTexture(name);
- return g_texturesource->getTextureRaw(name);
- }
+ video::ITexture * getImage();
#endif
std::string getText()
{
@@ -291,6 +277,9 @@ public:
os<<m_count;
return os.str();
}
+
+ ServerActiveObject* createSAO(ServerEnvironment *env, u16 id, v3f pos);
+
virtual bool addableTo(InventoryItem *other)
{
if(std::string(other->getName()) != "CraftItem")