mirror of
https://github.com/minetest-mods/digtron.git
synced 2024-12-22 20:32:22 +01:00
Fix digtron owner moving twice when standing in front of their digtron (#110)
This commit is contained in:
parent
321444b936
commit
9e6c2db897
21
util.lua
21
util.lua
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user