summaryrefslogtreecommitdiff
path: root/internal.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2019-06-15 12:09:51 -0500
committercheapie <no-email-for-you@example.com>2019-06-15 12:09:51 -0500
commitda9556bd3a95b35cd88b035beed68e335e6696b5 (patch)
treeef04da80b0f4708e7747606ef0a38f001f9c0f2f /internal.lua
parent0fda965aa475e06fdf7e238bb978c630abb9bbbd (diff)
downloaddigistuff-da9556bd3a95b35cd88b035beed68e335e6696b5.tar
digistuff-da9556bd3a95b35cd88b035beed68e335e6696b5.tar.gz
digistuff-da9556bd3a95b35cd88b035beed68e335e6696b5.tar.bz2
digistuff-da9556bd3a95b35cd88b035beed68e335e6696b5.tar.xz
digistuff-da9556bd3a95b35cd88b035beed68e335e6696b5.zip
Various additions
* Added intermediate connections for vertical digilines * Added protection support to buttons and wall knobs (optional, defaults to off) * Added the ability to manually control the button light (optional, defaults to off)
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