Add protection support to Luacontrollers,

protection is ignored with protection_bypass_priv
This commit is contained in:
Carter Kolwey 2016-05-16 12:55:58 -05:00 committed by Jeija
parent 75308f73e4
commit 40487a65f4

View File

@ -508,10 +508,15 @@ local digiline = {
end 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 if not fields.program then
return return
end 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(pos)
reset_meta(pos, fields.code) reset_meta(pos, fields.code)
local err = run(pos, {type="program"}) local err = run(pos, {type="program"})