aboutsummaryrefslogtreecommitdiff
path: root/src/content_sao.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2019-09-21 11:44:24 +0200
committerGitHub <noreply@github.com>2019-09-21 11:44:24 +0200
commit5fa614d97e13af64be490336392abe2a54fdcbc1 (patch)
tree32a0856d971d850081c1a7e748ab3f96a103ea19 /src/content_sao.cpp
parent47da640d7763ee1e00badb7476ac5afc4f864367 (diff)
downloadhax-minetest-server-5fa614d97e13af64be490336392abe2a54fdcbc1.tar.gz
hax-minetest-server-5fa614d97e13af64be490336392abe2a54fdcbc1.zip
Wieldhand: Specify which ItemStack to use (#8961)
Makes 'get_wield_item' to return the "main" ItemStack
Diffstat (limited to '')
-rw-r--r--src/content_sao.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 800c74859..90240e267 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -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)