Browse Source

workaround areastore limitations

main
Hendrik Langer 5 years ago
parent
commit
e3275ebf7c
  1. 19
      chatcommands.lua

19
chatcommands.lua

@ -92,16 +92,25 @@ minetest.register_chatcommand("creative_region_rn", {
return false, "Syntax error" return false, "Syntax error"
end end
local astore_id = tonumber(string.sub(region_id, 2)) local astore_id = tonumber(string.sub(region_id, 2))
local astore_area = creative_regions.astore:get_area(astore_id, false, true) local astore_area = creative_regions.astore:get_area(astore_id, true, true)
if astore_area then if astore_area and astore_area.id == astore_id then
astore_area.data = tostring(region_name) local success = creative_regions.astore:remove_area(astore_id)
local edge1 = astore_area.min
local edge2 = astore_area.max
local data = tostring(region_name)
local new_id = creative_regions.astore:insert_area(edge1, edge2, data, astore_id)
if new_id == astore_id then
minetest.chat_send_player(name, "[creative_regions] Region " .. region_id .. " updated") minetest.chat_send_player(name, "[creative_regions] Region " .. region_id .. " updated")
creative_regions.save_regions() else
minetest.chat_send_player(name, "[creative_regions] Failed to update region " .. region_id)
minetest.log("warning", "[creative_regions] Failed to update region " .. region_id)
end
else else
minetest.chat_send_player(name, "Failed to update region " .. region_id) minetest.chat_send_player(name, "Failed to update region " .. region_id)
return false, "Region not found" return false, "Region not found"
end end
creative_regions.save_regions()
return true, "Done." return true, "Done."
end, end,
}) })

Loading…
Cancel
Save