Browse Source

don't explicitly save default_privs

main
Hendrik Langer 4 years ago
parent
commit
cbb23a0534
  1. 9
      init.lua
  2. 3
      settingtypes.txt

9
init.lua

@ -10,6 +10,7 @@ switch_creative.area_privs = {}
areas_owner_privs = minetest.settings:get("switch_creative.owner_privs") or "+creative, +fast, +fly"
areas_guest_privs = minetest.settings:get("switch_creative.guest_privs") or "-fly, -fast"
noarea_privs = minetest.settings:get("switch_creative.noarea_privs") or "-creative, +fast, -fly"
default_privs = minetest.settings:get("switch_creative.default_privs") or "+creative, +fast, +fly"
function switch_creative:load_areas()
self.astore:from_file(minetest.get_worldpath().."/switch_creative_areas")
@ -54,7 +55,7 @@ minetest.register_chatcommand("creative_area", {
local edge2 = { x=tonumber(x2), y=tonumber(y2), z=tonumber(z2) }
local data = area_name
local astore_id = switch_creative.astore:insert_area(edge1, edge2, tostring(data))
switch_creative:set_area_privs(astore_id, "+creative, +fast, +fly")
switch_creative:set_area_privs(astore_id, nil)
minetest.chat_send_player(name, "[creative_area] New area set. ID: " .. astore_id)
switch_creative:save_areas()
return true, "Done."
@ -301,7 +302,11 @@ function switch_creative:update_player(player)
local privstring = noarea_privs
if smallest_area.id and switch_creative.area_privs[smallest_area.id] then
privstring = switch_creative.area_privs[smallest_area.id]
if switch_creative.area_privs[smallest_area.id] then
privstring = switch_creative.area_privs[smallest_area.id]
else
privstring = default_privs
end
end
if areas_owner or areas_open then
privstring = privstring .. ", " .. areas_owner_privs

3
settingtypes.txt

@ -6,3 +6,6 @@ switch_creative.guest_privs (Guest privs) string "-fly, -fast"
# Default privs when not in an area
switch_creative.noarea_privs (Default privs) string "-creative, -fast, -fly"
# Default privs for a new area
switch_creative.default_privs (Default privs) string "+creative, +fast, +fly"

Loading…
Cancel
Save