mirror of
https://github.com/minetest-mods/digilines.git
synced 2024-12-24 17:50:20 +01:00
Add protection support to channel fields (#33)
This commit is contained in:
parent
b6e8913901
commit
4c743f9c4d
@ -61,6 +61,11 @@ minetest.register_node("digilines_inventory:chest", {
|
|||||||
return minetest.get_meta(pos):get_inventory():is_empty("main")
|
return minetest.get_meta(pos):get_inventory():is_empty("main")
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
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 ~= nil then
|
if fields.channel ~= nil then
|
||||||
minetest.get_meta(pos):set_string("channel",fields.channel)
|
minetest.get_meta(pos):set_string("channel",fields.channel)
|
||||||
end
|
end
|
||||||
|
@ -107,6 +107,11 @@ minetest.register_node("digilines_lcd:lcd", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
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
|
if (fields.channel) then
|
||||||
minetest.get_meta(pos):set_string("channel", fields.channel)
|
minetest.get_meta(pos):set_string("channel", fields.channel)
|
||||||
end
|
end
|
||||||
|
@ -50,6 +50,11 @@ minetest.register_node("digilines_lightsensor:lightsensor", {
|
|||||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
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
|
if (fields.channel) then
|
||||||
minetest.get_meta(pos):set_string("channel", fields.channel)
|
minetest.get_meta(pos):set_string("channel", fields.channel)
|
||||||
end
|
end
|
||||||
|
@ -46,6 +46,11 @@ minetest.register_node("digilines_rtc:rtc", {
|
|||||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
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
|
if (fields.channel) then
|
||||||
minetest.get_meta(pos):set_string("channel", fields.channel)
|
minetest.get_meta(pos):set_string("channel", fields.channel)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user