From cbb23a0534f85acf873c10d204bd7fd68fa99cc5 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Tue, 26 May 2020 16:03:53 +0200 Subject: [PATCH] don't explicitly save default_privs --- init.lua | 9 +++++++-- settingtypes.txt | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 5d2786a..515f0a8 100644 --- a/init.lua +++ b/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 diff --git a/settingtypes.txt b/settingtypes.txt index c49a48d..f3f375c 100644 --- a/settingtypes.txt +++ b/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"