Add protection support to channel fields (#33)

This commit is contained in:
cheapie
2016-05-23 13:13:24 -05:00
committed by Auke Kok
parent b6e8913901
commit 4c743f9c4d
4 changed files with 20 additions and 0 deletions

View File

@ -46,6 +46,11 @@ minetest.register_node("digilines_rtc:rtc", {
meta:set_string("formspec", "field[channel;Channel;${channel}]")
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
if (fields.channel) then
minetest.get_meta(pos):set_string("channel", fields.channel)
end