|
|
@ -17,12 +17,19 @@ if minetest.get_modpath("areas") then |
|
|
|
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.") |
|
|
|
minetest.after(0.2, function(pos) |
|
|
|
minetest.remove_node(pos) |
|
|
|
end, pos) |
|
|
|
return |
|
|
|
end |
|
|
|
meta:set_string("infotext", string.format(description.." for area %s owned by %s", player_owns_id, name)) |
|
|
|
meta:set_string("area_id", player_owns_id) |
|
|
|
meta:set_string("privstring", privstring) |
|
|
|
meta:set_string("owner", name) |
|
|
|
|
|
|
|
creative_regions.add_region_privs(tostring(player_owns_id), privstring) |
|
|
|
creative_regions.set_region_privs(tostring(player_owns_id), privstring) |
|
|
|
minetest.chat_send_player(name, "[creative_regions] "..description.." set for region " .. player_owns_id) |
|
|
|
creative_regions.save_regions() |
|
|
|
else |
|
|
@ -30,6 +37,7 @@ if minetest.get_modpath("areas") then |
|
|
|
minetest.after(0.2, function(pos) |
|
|
|
minetest.remove_node(pos) |
|
|
|
end, pos) |
|
|
|
return |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
@ -60,6 +68,8 @@ if minetest.get_modpath("areas") then |
|
|
|
|
|
|
|
if player_owns_id then |
|
|
|
return true |
|
|
|
elseif owner == name then |
|
|
|
return true |
|
|
|
else |
|
|
|
minetest.chat_send_player(name, "[creative_regions] Cannot remove protector block for area "..id.." owned by "..owner) |
|
|
|
return false |
|
|
@ -79,13 +89,12 @@ if minetest.get_modpath("areas") then |
|
|
|
local current_areas = areas:getAreasAtPos(pos) |
|
|
|
for areas_id, areas_area in pairs( current_areas ) do |
|
|
|
local id = "a"..tostring(areas_id) |
|
|
|
if stored_id == id then |
|
|
|
local success = creative_regions.strip_region_privs(tostring(id), privstring) |
|
|
|
if stored_id == id and privstring == creative_regions.region_privs[tostring(id)] then |
|
|
|
creative_regions.set_region_privs(id, nil) |
|
|
|
minetest.chat_send_player(name, "[creative_regions] "..description.." removed for area " .. id) |
|
|
|
if not success then |
|
|
|
minetest.chat_send_player(name, "[creative_regions] Failed to remove privileges!") |
|
|
|
end |
|
|
|
creative_regions.save_regions() |
|
|
|
else |
|
|
|
minetest.chat_send_player(name, "[creative_regions] Failed to remove privileges!") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|