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,15 +321,18 @@ 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
-- See issue #2960 for status of a "set player velocity" method -- Digtron moving logic handles owner movement
-- instead, knock the player back if obj:get_player_name() ~= player:get_player_name() then
local newpos = { -- See issue #2960 for status of a "set player velocity" method
x = target_pos.x + velocity.x, -- instead, knock the player back
y = target_pos.y + velocity.y, local newpos = {
z = target_pos.z + velocity.z, x = target_pos.x + velocity.x,
} y = target_pos.y + velocity.y,
obj:set_pos(newpos) z = target_pos.z + velocity.z,
obj:punch(player, 1.0, damage_def, nil) }
obj:set_pos(newpos)
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