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:
parent
610ea6f216
commit
a637107a4e
10 changed files with 206 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue