|
@ -6,8 +6,6 @@ local mod_storage = minetest.get_mod_storage() |
|
|
toggle_areas.astore = AreaStore() |
|
|
toggle_areas.astore = AreaStore() |
|
|
|
|
|
|
|
|
toggle_areas.area_privs = {} |
|
|
toggle_areas.area_privs = {} |
|
|
toggle_areas.registered_on_enter = {} |
|
|
|
|
|
toggle_areas.registered_on_leave = {} |
|
|
|
|
|
|
|
|
|
|
|
areas_owner_privs = minetest.settings:get("toggle_areas.owner_privs") or "+creative, +fast, +fly" |
|
|
areas_owner_privs = minetest.settings:get("toggle_areas.owner_privs") or "+creative, +fast, +fly" |
|
|
areas_guest_privs = minetest.settings:get("toggle_areas.guest_privs") or "-fly, -fast" |
|
|
areas_guest_privs = minetest.settings:get("toggle_areas.guest_privs") or "-fly, -fast" |
|
@ -21,15 +19,6 @@ function toggle_areas:load_areas() |
|
|
local astore_id = self.astore:insert_area(edge1, edge2, tostring(data)) |
|
|
local astore_id = self.astore:insert_area(edge1, edge2, tostring(data)) |
|
|
|
|
|
|
|
|
toggle_areas:set_area_privs(astore_id, "+creative, +fast, +fly") |
|
|
toggle_areas:set_area_privs(astore_id, "+creative, +fast, +fly") |
|
|
|
|
|
|
|
|
self.register_on_enter(astore_id, function(player) |
|
|
|
|
|
local name = player:get_player_name() |
|
|
|
|
|
local privs = minetest.get_player_privs(name) |
|
|
|
|
|
minetest.log("warning", "[toggle_areas] callback worked") |
|
|
|
|
|
privs.fly = true |
|
|
|
|
|
privs.fast = false |
|
|
|
|
|
minetest.set_player_privs(name, privs) |
|
|
|
|
|
end) |
|
|
|
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function toggle_areas:save_areas() |
|
|
function toggle_areas:save_areas() |
|
@ -41,10 +30,6 @@ function toggle_areas:save_areas() |
|
|
mod_storage:set_string("astore", datastr) |
|
|
mod_storage:set_string("astore", datastr) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function toggle_areas:register_on_enter(id, func) |
|
|
|
|
|
toggle_areas.registered_on_enter[id] = func |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function toggle_areas:set_area_privs(id, privs_string) |
|
|
function toggle_areas:set_area_privs(id, privs_string) |
|
|
toggle_areas.area_privs[id] = privs_string |
|
|
toggle_areas.area_privs[id] = privs_string |
|
|
end |
|
|
end |
|
|