mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
The huge item definition and item namespace unification patch (itemdef), see http://c55.me/minetest/wiki/doku.php?id=changes:itemdef
This commit is contained in:
parent
569156b013
commit
6a76c226e1
65 changed files with 7232 additions and 7282 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue