diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2019-09-21 11:44:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-21 11:44:24 +0200 |
commit | 5fa614d97e13af64be490336392abe2a54fdcbc1 (patch) | |
tree | 32a0856d971d850081c1a7e748ab3f96a103ea19 /src/content_sao.cpp | |
parent | 47da640d7763ee1e00badb7476ac5afc4f864367 (diff) | |
download | minetest-5fa614d97e13af64be490336392abe2a54fdcbc1.tar.gz minetest-5fa614d97e13af64be490336392abe2a54fdcbc1.tar.bz2 minetest-5fa614d97e13af64be490336392abe2a54fdcbc1.zip |
Wieldhand: Specify which ItemStack to use (#8961)
Makes 'get_wield_item' to return the "main" ItemStack
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r-- | src/content_sao.cpp | 10 |
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) |