mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-11-18 00:18:13 +01:00
move logic to method
This commit is contained in:
parent
19c9ca179b
commit
443614f704
@ -656,7 +656,7 @@ minetest.register_chatcommand("/cylinder", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
local check_pyramid = function(name, param)
|
local check_pyramid = function(name, param)
|
||||||
if nil ~= area_protection.areas and not minetest.check_player_privs(name, {areas = true}) then
|
if area_protection:interaction_restrictions(name) then
|
||||||
worldedit.player_notify(
|
worldedit.player_notify(
|
||||||
name,
|
name,
|
||||||
"check_pyramid not yet supported with area protection"
|
"check_pyramid not yet supported with area protection"
|
||||||
@ -723,7 +723,7 @@ minetest.register_chatcommand("/spiral", {
|
|||||||
worldedit.player_notify(name, count .. " nodes added")
|
worldedit.player_notify(name, count .. " nodes added")
|
||||||
end,
|
end,
|
||||||
function(name, param)
|
function(name, param)
|
||||||
if nil ~= area_protection.areas and not minetest.check_player_privs(name, {areas = true}) then
|
if area_protection:interaction_restrictions(name) then
|
||||||
worldedit.player_notify(
|
worldedit.player_notify(
|
||||||
name,
|
name,
|
||||||
"/spiral not yet supported with area protection"
|
"/spiral not yet supported with area protection"
|
||||||
@ -853,7 +853,7 @@ minetest.register_chatcommand("/stack2", {
|
|||||||
worldedit.stack2(pos1, pos2, {x=x, y=y, z=z}, repetitions,
|
worldedit.stack2(pos1, pos2, {x=x, y=y, z=z}, repetitions,
|
||||||
function() worldedit.player_notify(name, count .. " nodes stacked") end)
|
function() worldedit.player_notify(name, count .. " nodes stacked") end)
|
||||||
end, function()
|
end, function()
|
||||||
if nil ~= area_protection.areas and not minetest.check_player_privs(name, {areas = true}) then
|
if area_protection:interaction_restrictions(name) then
|
||||||
worldedit.player_notify(
|
worldedit.player_notify(
|
||||||
name,
|
name,
|
||||||
"/stack2 not yet supported with area protection"
|
"/stack2 not yet supported with area protection"
|
||||||
@ -885,7 +885,7 @@ minetest.register_chatcommand("/stretch", {
|
|||||||
worldedit.player_notify(name, count .. " nodes stretched")
|
worldedit.player_notify(name, count .. " nodes stretched")
|
||||||
end,
|
end,
|
||||||
function(name, param)
|
function(name, param)
|
||||||
if nil ~= area_protection.areas and not minetest.check_player_privs(name, {areas = true}) then
|
if area_protection:interaction_restrictions(name) then
|
||||||
worldedit.player_notify(
|
worldedit.player_notify(
|
||||||
name,
|
name,
|
||||||
"/stretch not yet supported with area protection"
|
"/stretch not yet supported with area protection"
|
||||||
@ -1172,7 +1172,7 @@ minetest.register_chatcommand("/load", {
|
|||||||
description = "Load nodes from \"(world folder)/schems/<file>[.we[m]]\" with position 1 of the current WorldEdit region as the origin",
|
description = "Load nodes from \"(world folder)/schems/<file>[.we[m]]\" with position 1 of the current WorldEdit region as the origin",
|
||||||
privs = {worldedit=true},
|
privs = {worldedit=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if nil ~= area_protection.areas and not minetest.check_player_privs(name, {areas = true}) then
|
if area_protection:interaction_restrictions(name) then
|
||||||
worldedit.player_notify(
|
worldedit.player_notify(
|
||||||
name,
|
name,
|
||||||
"/load not yet supported with area protection"
|
"/load not yet supported with area protection"
|
||||||
@ -1295,7 +1295,7 @@ minetest.register_chatcommand("/mtschemplace", {
|
|||||||
description = "Load nodes from \"(world folder)/schems/<file>.mts\" with position 1 of the current WorldEdit region as the origin",
|
description = "Load nodes from \"(world folder)/schems/<file>.mts\" with position 1 of the current WorldEdit region as the origin",
|
||||||
privs = {worldedit=true},
|
privs = {worldedit=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if nil ~= area_protection.areas and not minetest.check_player_privs(name, {areas = true}) then
|
if area_protection:interaction_restrictions(name) then
|
||||||
worldedit.player_notify(
|
worldedit.player_notify(
|
||||||
name,
|
name,
|
||||||
"/mtschemplace not yet supported with area protection"
|
"/mtschemplace not yet supported with area protection"
|
||||||
|
@ -4,6 +4,19 @@ if minetest.get_modpath("areas") then
|
|||||||
area_protection.areas = areas
|
area_protection.areas = areas
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local area_protection.interaction_restrictions = function(
|
||||||
|
area_protection,
|
||||||
|
player_name
|
||||||
|
)
|
||||||
|
if area_protection.areas then
|
||||||
|
if minetest.check_player_privs(name, {areas = true}) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local area_protection.interaction_allowed = function(
|
local area_protection.interaction_allowed = function(
|
||||||
area_protection,
|
area_protection,
|
||||||
description,
|
description,
|
||||||
|
Loading…
Reference in New Issue
Block a user