From da9556bd3a95b35cd88b035beed68e335e6696b5 Mon Sep 17 00:00:00 2001 From: cheapie Date: Sat, 15 Jun 2019 12:09:51 -0500 Subject: 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) --- internal.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'internal.lua') 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 -- cgit v1.2.3