summaryrefslogtreecommitdiff
path: root/src/serverobject.cpp
diff options
context:
space:
mode:
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;
+}