ICTA controller: Add exchange command
This commit is contained in:
parent
4410af0064
commit
5d3b4213ab
@ -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,
|
||||
})
|
||||
|
||||
|
@ -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,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user