Browse Source

allow admin to place area protectors

main
Hendrik Langer 5 years ago
parent
commit
d8a00f4f7d
  1. 2
      arena.lua
  2. 14
      items.lua

2
arena.lua

@ -19,6 +19,8 @@ function creative_regions.drop_everything(player, drop_bones)
local player_inv = player:get_inventory() local player_inv = player:get_inventory()
local pos = player:get_pos() local pos = player:get_pos()
--minetest.find_node_near(pos, radius, nodenames)
for _, list_name in ipairs(player_inventory_lists) do for _, list_name in ipairs(player_inventory_lists) do
for i = 1, player_inv:get_size(list_name) do for i = 1, player_inv:get_size(list_name) do
drop(pos, player_inv:get_stack(list_name, i)) drop(pos, player_inv:get_stack(list_name, i))

14
items.lua

@ -16,6 +16,19 @@ if minetest.get_modpath("areas") then
end end
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 player_owns_id then
if creative_regions.region_privs[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.") 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() creative_regions.save_regions()
else else
minetest.chat_send_player(name, "[creative_regions] Failed to remove privileges!") 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
end end

Loading…
Cancel
Save