1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Allow overriding tool capabilities through itemstack metadata

This makes it possible to modify the tool capabilities of individual
itemstacks by calling a method on itemstack metadata references.
This commit is contained in:
raymoo 2017-04-18 16:30:27 -07:00 committed by paramat
parent 610ea6f216
commit a637107a4e
10 changed files with 206 additions and 14 deletions

View file

@ -1210,9 +1210,10 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
// If can't dig, try hand
if (!params.diggable) {
InventoryList *hlist = playersao->getInventory()->getList("hand");
const ItemDefinition &hand =
hlist ? hlist->getItem(0).getDefinition(m_itemdef) : m_itemdef->get("");
const ToolCapabilities *tp = hand.tool_capabilities;
const ToolCapabilities *tp = hlist
? &hlist->getItem(0).getToolCapabilities(m_itemdef)
: m_itemdef->get("").tool_capabilities;
if (tp)
params = getDigParams(m_nodedef->get(n).groups, tp);
}