Skip to content

Commit 9e6c2db

Browse files
authored
Fix digtron owner moving twice when standing in front of their digtron (#110)
1 parent 321444b commit 9e6c2db

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

util.lua

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,18 @@ digtron.damage_creatures = function(player, source_pos, target_pos, amount, item
321321
}
322322
for _, obj in ipairs(objects) do
323323
if obj:is_player() then
324-
-- See issue #2960 for status of a "set player velocity" method
325-
-- instead, knock the player back
326-
local newpos = {
327-
x = target_pos.x + velocity.x,
328-
y = target_pos.y + velocity.y,
329-
z = target_pos.z + velocity.z,
330-
}
331-
obj:set_pos(newpos)
332-
obj:punch(player, 1.0, damage_def, nil)
324+
-- Digtron moving logic handles owner movement
325+
if obj:get_player_name() ~= player:get_player_name() then
326+
-- See issue #2960 for status of a "set player velocity" method
327+
-- instead, knock the player back
328+
local newpos = {
329+
x = target_pos.x + velocity.x,
330+
y = target_pos.y + velocity.y,
331+
z = target_pos.z + velocity.z,
332+
}
333+
obj:set_pos(newpos)
334+
obj:punch(player, 1.0, damage_def, nil)
335+
end
333336
else
334337
local lua_entity = obj:get_luaentity()
335338
if lua_entity ~= nil then

0 commit comments

Comments
 (0)