summaryrefslogtreecommitdiff
path: root/internal.lua
diff options
context:
space:
mode:
Diffstat (limited to 'internal.lua')
-rw-r--r--internal.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal.lua b/internal.lua
index 494a206..2ee3a56 100644
--- a/internal.lua
+++ b/internal.lua
@@ -1,3 +1,5 @@
+digistuff.mesecons_installed = minetest.get_modpath("mesecons")
+
digistuff.rotate_rules = function(rulesin,dir)
local rules = {}
for k,v in ipairs(rulesin) do rules[k] = v end
@@ -42,3 +44,14 @@ digistuff.rotate_rules = function(rulesin,dir)
return {}
end
end
+
+digistuff.check_protection = function(pos,player)
+ assert(type(pos) == "table","Position must be a table")
+ assert(type(player) == "string" or type(player) == "userdata","Invalid player specified")
+ if type(player) == "userdata" then player = player:get_player_name() end
+ if minetest.is_protected(pos,player) and not minetest.check_player_privs(player,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,player)
+ return false
+ end
+ return true
+end