Hendrik Langer 5 years ago
parent
commit
b270db0960
  1. 12
      chatcommands.lua
  2. 4
      mod_areas.lua
  3. 2
      player.lua
  4. 1
      region.lua
  5. 4
      settingtypes.txt

12
chatcommands.lua

@ -37,17 +37,14 @@ minetest.register_chatcommand("creative_region_privs", {
return false, "Player not found"
end
local found, _, region_id, privstring = param:find("^([+-]?%a?%d+)%s*,%s*(.+)$")
if not found then
if not found or not region_id or not privstring then
return false, "Syntax error"
end
if privstring and region_id then
creative_regions:set_region_privs(tostring(region_id), privstring)
minetest.chat_send_player(name, "[creative_regions] Privstring set for region " .. region_id .. ": " .. privstring)
creative_regions:save_regions()
return true, "Done"
else
return false, "Failed"
end
end,
})
@ -61,7 +58,7 @@ minetest.register_chatcommand("creative_region_rm", {
return false, "Player not found"
end
local found, _, region_id = param:find("^([+-]?%d+)%s*$")
if not found then
if not found or not region_id then
return false, "Syntax error"
end
local success = creative_regions.astore:remove_area(tonumber(region_id))
@ -69,7 +66,8 @@ minetest.register_chatcommand("creative_region_rm", {
minetest.chat_send_player(name, "[creative_regions] Region " .. region_id .. "removed")
creative_regions:set_region_privs(tostring(region_id), nil)
else
minetest.chat_send_player(name, "[creative_regions] Error removing region " .. region_id)
minetest.chat_send_player(name, "Failed to remove region " .. region_id)
return false, "Region not found"
end
creative_regions:save_regions()
return true, "Done."

4
mod_areas.lua

@ -1,9 +1,11 @@
--[[
function creative_regions:is_areas_mod(area_id)
area_id = tostring(area_id)
assert(type(area_id) == "string")
local is_areas_id = string.sub(id, 1, 2) == "a"
local a_id = tonumber( string.sub(id, 2) )
return is_areas_id, a_id
end
--]]
function creative_regions:get_areas_area_size(areas_area)
local pos1 = areas_area.pos1

2
player.lua

@ -10,6 +10,7 @@ function creative_regions:initial_stuff()
return itemtable
end
--[[
function creative_regions:save_player_privs(player)
local name = player:get_player_name()
local pmeta = player:get_meta()
@ -26,6 +27,7 @@ function creative_regions:restore_player_privs(player)
pmeta:set_string("creative_regions.saved_privs", nil)
end
end
--]]
function creative_regions:save_player_inventory(player, listname)
local name = player:get_player_name()

1
region.lua

@ -56,7 +56,6 @@ function creative_regions:decode_privs_table(privs_table)
return privs_grant, privs_revoke
end
function creative_regions:add_privs_from_string(privs_table, str)
-- minetest/builtin/common/misc_helpers.lua:core.string_to_privs()
assert(type(str) == "string")

4
settingtypes.txt

@ -5,7 +5,7 @@ creative_regions.owner_privs (Owner privs) string "+creative, +fast, +fly"
creative_regions.guest_privs (Guest privs) string "-fly, -fast"
# Default privs when not in an area
creative_regions.noregion_privs (Default privs) string "-creative, -fast, -fly"
creative_regions.noregion_privs (Noregion default privs) string "-creative, -fast, -fly"
# Default privs for a new area
creative_regions.default_privs (Default privs) string "+creative, +fast, +fly"
creative_regions.default_privs (Region default privs) string "+creative, +fast, +fly"

Loading…
Cancel
Save