From d8a00f4f7dcd63b932fc0e8d1f1201dcf33a75cf Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Mon, 1 Jun 2020 14:01:53 +0200 Subject: [PATCH] allow admin to place area protectors --- arena.lua | 2 ++ items.lua | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/arena.lua b/arena.lua index 6447222..9971fb2 100644 --- a/arena.lua +++ b/arena.lua @@ -19,6 +19,8 @@ function creative_regions.drop_everything(player, drop_bones) local player_inv = player:get_inventory() local pos = player:get_pos() + --minetest.find_node_near(pos, radius, nodenames) + for _, list_name in ipairs(player_inventory_lists) do for i = 1, player_inv:get_size(list_name) do drop(pos, player_inv:get_stack(list_name, i)) diff --git a/items.lua b/items.lua index c4cd2e0..87b3995 100644 --- a/items.lua +++ b/items.lua @@ -16,6 +16,19 @@ if minetest.get_modpath("areas") then end end + -- allow for players with areas privilege + if not player_owns_id and minetest.check_player_privs(name, { areas=true }) then + if table.getn(current_areas) == 1 + player_owns_id = current_areas[1] or current_areas[0] + else + minetest.chat_send_player(name, "[creative_regions] Area ambiguous: You are in multiple areas.") + minetest.after(0.2, function(pos) + minetest.remove_node(pos) + end, pos) + return + end + end + if player_owns_id then if creative_regions.region_privs[player_owns_id] then minetest.chat_send_player(name, "[creative_regions] Failed. Privileges for area already set.") @@ -95,6 +108,7 @@ if minetest.get_modpath("areas") then creative_regions.save_regions() else minetest.chat_send_player(name, "[creative_regions] Failed to remove privileges!") + minetest.log("warning", "[creative_regions] Failed to remove privileges for "..description.." at "..dump(pos)) end end