summaryrefslogtreecommitdiff
path: root/src/serverobject.cpp
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2012-01-12 06:10:39 +0100
committerKahrl <kahrl@gmx.net>2012-01-12 06:10:39 +0100
commit6a76c226e10e92c3e3339096f07f8ab065e2098b (patch)
tree396d9083f5f76ebb5ba96df113ba68046c2487df /src/serverobject.cpp
parent569156b01302ea4ba45d11ff5524b62dbc6a9aa0 (diff)
downloadminetest-6a76c226e10e92c3e3339096f07f8ab065e2098b.tar.gz
minetest-6a76c226e10e92c3e3339096f07f8ab065e2098b.tar.bz2
minetest-6a76c226e10e92c3e3339096f07f8ab065e2098b.zip
The huge item definition and item namespace unification patch (itemdef), see http://c55.me/minetest/wiki/doku.php?id=changes:itemdef
Diffstat (limited to 'src/serverobject.cpp')
-rw-r--r--src/serverobject.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/serverobject.cpp b/src/serverobject.cpp
index ca3d2c3b9..2609e3015 100644
--- a/src/serverobject.cpp
+++ b/src/serverobject.cpp
@@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serverobject.h"
#include <fstream>
#include "inventory.h"
-#include "tooldef.h"
+#include "materials.h"
ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
ActiveObject(0),
@@ -67,10 +67,31 @@ void ServerActiveObject::registerType(u16 type, Factory f)
m_types.insert(type, f);
}
-void ServerActiveObject::getWieldDiggingProperties(ToolDiggingProperties *dst)
+ItemStack ServerActiveObject::getWieldedItem() const
{
- *dst = ToolDiggingProperties();
+ const Inventory *inv = getInventory();
+ if(inv)
+ {
+ const InventoryList *list = inv->getList(getWieldList());
+ if(list)
+ return list->getItem(getWieldIndex());
+ }
+ return ItemStack();
}
-
+bool ServerActiveObject::setWieldedItem(const ItemStack &item)
+{
+ Inventory *inv = getInventory();
+ if(inv)
+ {
+ InventoryList *list = inv->getList(getWieldList());
+ if (list)
+ {
+ list->changeItem(getWieldIndex(), item);
+ setInventoryModified();
+ return true;
+ }
+ }
+ return false;
+}