summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarter Kolwey <cheapiephp@gmail.com>2016-05-16 12:55:58 -0500
committerJeija <norrepli@gmail.com>2016-05-17 07:58:50 +0200
commit40487a65f47cd42595417ab434a9b5a97a496a3e (patch)
tree257eb4fb35d55dbe2c5a06435bea090b57a860dd
parent75308f73e4a34c2ab1a31871db2e3e93119f0423 (diff)
downloadmesecons-40487a65f47cd42595417ab434a9b5a97a496a3e.tar
mesecons-40487a65f47cd42595417ab434a9b5a97a496a3e.tar.gz
mesecons-40487a65f47cd42595417ab434a9b5a97a496a3e.tar.bz2
mesecons-40487a65f47cd42595417ab434a9b5a97a496a3e.tar.xz
mesecons-40487a65f47cd42595417ab434a9b5a97a496a3e.zip
Add protection support to Luacontrollers,
protection is ignored with protection_bypass_priv
-rw-r--r--mesecons_luacontroller/init.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua
index 01f5878..458286f 100644
--- a/mesecons_luacontroller/init.lua
+++ b/mesecons_luacontroller/init.lua
@@ -508,10 +508,15 @@ local digiline = {
end
}
}
-local function on_receive_fields(pos, form_name, fields)
+local function on_receive_fields(pos, form_name, fields, sender)
if not fields.program then
return
end
+ local name = sender:get_player_name()
+ if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then
+ minetest.record_protection_violation(pos, name)
+ return
+ end
reset(pos)
reset_meta(pos, fields.code)
local err = run(pos, {type="program"})