From 055f9b0536752b7e368dea3351ab123da596b87f Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Wed, 27 May 2020 16:53:47 +0200 Subject: [PATCH] working --- init.lua | 2 +- items.lua | 9 +++++++-- settingtypes.txt | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 0aa0024..a51ac24 100644 --- a/init.lua +++ b/init.lua @@ -4,7 +4,7 @@ creative_regions = {} areas_owner_privs = minetest.settings:get("creative_regions.owner_privs") or "+creative, +fast, +fly" -areas_guest_privs = minetest.settings:get("creative_regions.guest_privs") or "-fly, -fast" +areas_guest_privs = minetest.settings:get("creative_regions.guest_privs") or "" noregion_privs = minetest.settings:get("creative_regions.noregion_privs") or "-creative, +fast, -fly" default_privs = minetest.settings:get("creative_regions.default_privs") or "+creative, +fast, +fly" diff --git a/items.lua b/items.lua index 842174a..4c480d2 100644 --- a/items.lua +++ b/items.lua @@ -17,7 +17,7 @@ if minetest.get_modpath("areas") then end if player_owns_id then - meta:set_string("infotext", string.format("No-Fly-Zone Protector for area %s owned by %s", player_owns_id, name) + meta:set_string("infotext", string.format("No-Fly-Zone Protector for area %s owned by %s", player_owns_id, name)) meta:set_string("area_id", player_owns_id) meta:set_string("owner", name) @@ -25,6 +25,7 @@ if minetest.get_modpath("areas") then minetest.chat_send_player(name, "[creative_regions] No-Fly-Zone set for region " .. player_owns_id) creative_regions.save_regions() else + minetest.chat_send_player(name, "[creative_regions] You need to be inside an area to set a No-Fly-Zone") minetest.after(0.2, function(pos) minetest.remove_node(pos) end, pos) @@ -40,9 +41,13 @@ if minetest.get_modpath("areas") then local meta = minetest.get_meta(pos) local id = meta:get_string("area_id") local owner = meta:get_string("owner") - local player_owns_id = nil + -- allow for players with areas privilege + if minetest.check_player_privs(name, { areas=true }) then + return true + end + local current_areas = areas:getAreasAtPos(pos) for areas_id, areas_area in pairs( current_areas ) do if areas_area.owner == name then diff --git a/settingtypes.txt b/settingtypes.txt index 25f261c..4a40bc6 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -2,7 +2,7 @@ creative_regions.owner_privs (Owner privs) string "+creative, +fast, +fly" # Privs of an areas mod guest -creative_regions.guest_privs (Guest privs) string "-fast, -fly" +creative_regions.guest_privs (Guest privs) string "" # Default privs when not in an area creative_regions.noregion_privs (Noregion default privs) string "-creative, -fast, -fly"