diff --git a/icta_controller/commands.lua b/icta_controller/commands.lua index feb9cd0..d5b5522 100644 --- a/icta_controller/commands.lua +++ b/icta_controller/commands.lua @@ -179,7 +179,7 @@ techage.icta_register_condition("state", { type = "textlist", name = "value", label = "", - choices = "stopped,running,standby,blocked,nopower,fault,unloaded,invalid,on,off", + choices = "stopped,running,standby,blocked,nopower,fault,unloaded,invalid,on,off,empty,loaded,loading,full", default = "stopped", }, { @@ -793,3 +793,36 @@ techage.icta_register_condition("get_filter", { return condition, result end, }) + +techage.icta_register_action("exchange", { + title = "place/remove a block via the Door Controller II", + formspec = { + { + type = "number", + name = "number", + label = "number", + default = "", + }, + { + type = "number", + name = "slot", + label = "slot no", + default = "1", + }, + { + type = "label", + name = "lbl", + label = "place/remove a block via\nthe Door Controller II\n", + }, + }, + button = function(data, environ) + return 'exch('..techage.fmt_number(data.number)..","..data.slot..')' + end, + code = function(data, environ) + return function(env, output, idx) + local payload = data.slot + techage.send_single(environ.number, data.number, "exchange", payload) + end + end, +}) + diff --git a/logic/logic_block.lua b/logic/logic_block.lua index 1117177..51bad9d 100644 --- a/logic/logic_block.lua +++ b/logic/logic_block.lua @@ -351,7 +351,7 @@ techage.register_node({"techage:ta3_logic2"}, { nvm.blocking_time = nvm.blocking_time or M(pos):get_float("blocking_time") nvm.inp_tbl = nvm.inp_tbl or {} - if src ~= nvm.own_num and techage.SystemTime > (mem.ttl or 0) then + if src ~= nvm.own_num then if topic == "on" then nvm.inp_tbl[src] = "on" elseif topic == "off" then @@ -360,8 +360,9 @@ techage.register_node({"techage:ta3_logic2"}, { return "unsupported" end + local t = math.max((mem.ttl or 0) - techage.SystemTime, 0.1) + minetest.get_node_timer(pos):start(t) mem.ttl = techage.SystemTime + (nvm.blocking_time or 0) - minetest.get_node_timer(pos):start(0.1) end end, })