mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-25 01:40:18 +01:00
Check protection on microcontroller programming (#420)
Also, fix globals assignment.
This commit is contained in:
parent
f61b1affea
commit
5a0492b176
@ -103,6 +103,12 @@ minetest.register_node(nodename, {
|
|||||||
meta:set_string("eeprom", r)
|
meta:set_string("eeprom", r)
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formanme, fields, sender)
|
on_receive_fields = function(pos, formanme, fields, sender)
|
||||||
|
local player_name = sender:get_player_name()
|
||||||
|
if minetest.is_protected(pos, player_name) and
|
||||||
|
not minetest.check_player_privs(player_name, {protection_bypass=true}) then
|
||||||
|
minetest.record_protection_violation(pos, player_name)
|
||||||
|
return
|
||||||
|
end
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if fields.band then
|
if fields.band then
|
||||||
fields.code = "sbi(C, A&B) :A and B are inputs, C is output"
|
fields.code = "sbi(C, A&B) :A and B are inputs, C is output"
|
||||||
@ -272,7 +278,7 @@ yc.parsecode = function(code, pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
yc.parse_get_command = function(code, starti)
|
yc.parse_get_command = function(code, starti)
|
||||||
i = starti
|
local i = starti
|
||||||
local s
|
local s
|
||||||
while s ~= "" do
|
while s ~= "" do
|
||||||
s = string.sub(code, i, i)
|
s = string.sub(code, i, i)
|
||||||
@ -298,7 +304,7 @@ yc.parse_get_command = function(code, starti)
|
|||||||
end
|
end
|
||||||
|
|
||||||
yc.parse_get_params = function(code, starti)
|
yc.parse_get_params = function(code, starti)
|
||||||
i = starti
|
local i = starti
|
||||||
local s
|
local s
|
||||||
local params = {}
|
local params = {}
|
||||||
local is_string = false
|
local is_string = false
|
||||||
@ -321,7 +327,7 @@ yc.parse_get_params = function(code, starti)
|
|||||||
end
|
end
|
||||||
|
|
||||||
yc.parse_get_eeprom_param = function(cond, starti)
|
yc.parse_get_eeprom_param = function(cond, starti)
|
||||||
i = starti
|
local i = starti
|
||||||
local s
|
local s
|
||||||
local addr
|
local addr
|
||||||
while s ~= "" do
|
while s ~= "" do
|
||||||
@ -488,7 +494,7 @@ end
|
|||||||
|
|
||||||
--Condition parsing
|
--Condition parsing
|
||||||
yc.command_if_getcondition = function(code, starti)
|
yc.command_if_getcondition = function(code, starti)
|
||||||
i = starti
|
local i = starti
|
||||||
local s
|
local s
|
||||||
local brackets = 1 --1 Bracket to close
|
local brackets = 1 --1 Bracket to close
|
||||||
while s ~= "" do
|
while s ~= "" do
|
||||||
|
Loading…
Reference in New Issue
Block a user