Skip to content

Commit

Permalink
Keep area marker when running '/area_posX' twice
Browse files Browse the repository at this point in the history
Regression from c9f1cf2
  • Loading branch information
SmallJoker committed Feb 17, 2025
1 parent 01c261c commit 8cb684d
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions pos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,6 @@ function areas:setPos1(name, pos)
pos = posLimit(pos)
areas.pos1[name] = pos

local entity = minetest.add_entity(pos, "areas:pos1")
if entity then
local luaentity = entity:get_luaentity()
if luaentity then
luaentity.player = name
end
end

if old_pos then
-- TODO: use `core.objects_inside_radius` after Luanti 5.10.0 is well established.
for _, object in ipairs(core.get_objects_inside_radius(old_pos, 0.01)) do
Expand All @@ -201,20 +193,20 @@ function areas:setPos1(name, pos)
end
end
end
end

function areas:setPos2(name, pos)
local old_pos = areas.pos2[name]
pos = posLimit(pos)
areas.pos2[name] = pos

local entity = minetest.add_entity(pos, "areas:pos2")
local entity = core.add_entity(pos, "areas:pos1")
if entity then
local luaentity = entity:get_luaentity()
if luaentity then
luaentity.player = name
end
end
end

function areas:setPos2(name, pos)
local old_pos = areas.pos2[name]
pos = posLimit(pos)
areas.pos2[name] = pos

if old_pos then
-- TODO: use `core.objects_inside_radius` after Luanti 5.10.0 is well established.
Expand All @@ -225,6 +217,14 @@ function areas:setPos2(name, pos)
end
end
end

local entity = core.add_entity(pos, "areas:pos2")
if entity then
local luaentity = entity:get_luaentity()
if luaentity then
luaentity.player = name
end
end
end

minetest.register_on_punchnode(function(pos, node, puncher)
Expand Down

0 comments on commit 8cb684d

Please sign in to comment.