From 9e6c2db897dd7f8ad4ac348b1592ec0ca56c0760 Mon Sep 17 00:00:00 2001 From: 1F616EMO~nya Date: Thu, 22 Aug 2024 12:30:59 +0800 Subject: [PATCH] Fix digtron owner moving twice when standing in front of their digtron (#110) --- util.lua | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/util.lua b/util.lua index f18997c..8f505a7 100644 --- a/util.lua +++ b/util.lua @@ -321,15 +321,18 @@ digtron.damage_creatures = function(player, source_pos, target_pos, amount, item } for _, obj in ipairs(objects) do if obj:is_player() then - -- See issue #2960 for status of a "set player velocity" method - -- instead, knock the player back - local newpos = { - x = target_pos.x + velocity.x, - y = target_pos.y + velocity.y, - z = target_pos.z + velocity.z, - } - obj:set_pos(newpos) - obj:punch(player, 1.0, damage_def, nil) + -- Digtron moving logic handles owner movement + if obj:get_player_name() ~= player:get_player_name() then + -- See issue #2960 for status of a "set player velocity" method + -- instead, knock the player back + local newpos = { + x = target_pos.x + velocity.x, + y = target_pos.y + velocity.y, + z = target_pos.z + velocity.z, + } + obj:set_pos(newpos) + obj:punch(player, 1.0, damage_def, nil) + end else local lua_entity = obj:get_luaentity() if lua_entity ~= nil then