Fix move_area not updating AreaStore
This commit is contained in:
parent
10338cd5d1
commit
67507c7591
@ -306,13 +306,14 @@ minetest.register_chatcommand("move_area", {
|
|||||||
return false, "You need to select an area first."
|
return false, "You need to select an area first."
|
||||||
end
|
end
|
||||||
|
|
||||||
area.pos1 = pos1
|
areas:move(id, area, pos1, pos2)
|
||||||
area.pos2 = pos2
|
|
||||||
areas:save()
|
areas:save()
|
||||||
|
|
||||||
return true, "Area successfully moved."
|
return true, "Area successfully moved."
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_chatcommand("area_info", {
|
minetest.register_chatcommand("area_info", {
|
||||||
description = "Get information about area configuration and usage.",
|
description = "Get information about area configuration and usage.",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
14
internal.lua
14
internal.lua
@ -128,6 +128,20 @@ function areas:remove(id, recurse)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Move an area.
|
||||||
|
function areas:move(id, area, pos1, pos2)
|
||||||
|
area.pos1 = pos1
|
||||||
|
area.pos2 = pos2
|
||||||
|
|
||||||
|
if self.store then
|
||||||
|
self.store:remove_area(areas.store_ids[id])
|
||||||
|
local sid = self.store:insert_area(pos1, pos2, tostring(id))
|
||||||
|
if self:checkAreaStoreId(sid) then
|
||||||
|
self.store_ids[id] = sid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Checks if a area between two points is entirely contained by another area.
|
-- Checks if a area between two points is entirely contained by another area.
|
||||||
-- Positions must be sorted.
|
-- Positions must be sorted.
|
||||||
function areas:isSubarea(pos1, pos2, id)
|
function areas:isSubarea(pos1, pos2, id)
|
||||||
|
Loading…
Reference in New Issue
Block a user