1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Wieldhand: Specify which ItemStack to use (#8961)

Makes 'get_wield_item' to return the "main" ItemStack
This commit is contained in:
SmallJoker 2019-09-21 11:44:24 +02:00 committed by GitHub
parent 47da640d77
commit 5fa614d97e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 41 deletions

View file

@ -638,12 +638,13 @@ int LuaEntitySAO::punch(v3f dir,
FATAL_ERROR_IF(!puncher, "Punch action called without SAO");
s32 old_hp = getHP();
const ItemStack &punchitem = puncher->getWieldedItem();
ItemStack selected_item, hand_item;
ItemStack tool_item = puncher->getWieldedItem(&selected_item, &hand_item);
PunchDamageResult result = getPunchDamage(
m_armor_groups,
toolcap,
&punchitem,
&tool_item,
time_from_last_punch);
bool damage_handled = m_env->getScriptIface()->luaentity_Punch(m_id, puncher,
@ -1376,10 +1377,9 @@ u16 PlayerSAO::getWieldIndex() const
return m_player->getWieldIndex();
}
ItemStack PlayerSAO::getWieldedItem() const
ItemStack PlayerSAO::getWieldedItem(ItemStack *selected, ItemStack *hand) const
{
ItemStack selected_item, hand_item;
return m_player->getWieldedItem(&selected_item, &hand_item);
return m_player->getWieldedItem(selected, hand);
}
bool PlayerSAO::setWieldedItem(const ItemStack &item)