summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2016-08-22 23:15:18 -0500
committercheapie <no-email-for-you@example.com>2016-08-22 23:15:18 -0500
commit548cca81921c8b4b14cd379774d64a4c03b12f35 (patch)
tree1a688054820131f80ef3b75f2540de20c078a40f
parent26c8998cdf897c28e4d3f7ba5016af8055e91321 (diff)
downloaddigistuff-548cca81921c8b4b14cd379774d64a4c03b12f35.tar
digistuff-548cca81921c8b4b14cd379774d64a4c03b12f35.tar.gz
digistuff-548cca81921c8b4b14cd379774d64a4c03b12f35.tar.bz2
digistuff-548cca81921c8b4b14cd379774d64a4c03b12f35.tar.xz
digistuff-548cca81921c8b4b14cd379774d64a4c03b12f35.zip
Add protection support to detector
-rw-r--r--init.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index e36f28c..276caf9 100644
--- a/init.lua
+++ b/init.lua
@@ -305,6 +305,11 @@ minetest.register_node("digistuff:detector", {
meta:set_string("formspec","size[8,4;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;radius;Radius;${radius}]button_exit[2.25,3;3,1;submit;Save]")
end,
on_receive_fields = function(pos, formname, fields, sender)
+ 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
local meta = minetest.get_meta(pos)
if fields.channel then meta:set_string("channel",fields.channel) end
if fields.msg then meta:set_string("msg",fields.msg) end