Browse Source

working

main
Hendrik Langer 5 years ago
parent
commit
055f9b0536
  1. 2
      init.lua
  2. 9
      items.lua
  3. 2
      settingtypes.txt

2
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"

9
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

2
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"

Loading…
Cancel
Save