Fix digtron owner moving twice when standing in front of their digtron (#110)

This commit is contained in:
1F616EMO~nya 2024-08-22 12:30:59 +08:00 committed by GitHub
parent 321444b936
commit 9e6c2db897
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -321,6 +321,8 @@ digtron.damage_creatures = function(player, source_pos, target_pos, amount, item
} }
for _, obj in ipairs(objects) do for _, obj in ipairs(objects) do
if obj:is_player() then if obj:is_player() then
-- 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 -- See issue #2960 for status of a "set player velocity" method
-- instead, knock the player back -- instead, knock the player back
local newpos = { local newpos = {
@ -330,6 +332,7 @@ digtron.damage_creatures = function(player, source_pos, target_pos, amount, item
} }
obj:set_pos(newpos) obj:set_pos(newpos)
obj:punch(player, 1.0, damage_def, nil) obj:punch(player, 1.0, damage_def, nil)
end
else else
local lua_entity = obj:get_luaentity() local lua_entity = obj:get_luaentity()
if lua_entity ~= nil then if lua_entity ~= nil then