Fix ICTA controller bug

This commit is contained in:
Joachim Stolberg 2022-07-08 20:59:22 +02:00
parent 7082e1ab0d
commit 904d6559d3

View File

@ -153,7 +153,7 @@ techage.icta_register_condition("input", {
return env.input[data.number] return env.input[data.number]
end end
local result = function(val) local result = function(val)
return techage.compare(val, data.value, data.operand) return techage.compare(val, tonumber(data.value) or 0, data.operand)
end end
return condition, result return condition, result
end, end,
@ -196,7 +196,7 @@ techage.icta_register_condition("state", {
return techage.send_single(environ.number, data.number, "state") return techage.send_single(environ.number, data.number, "state")
end end
local result = function(val) local result = function(val)
return techage.compare(val, data.value, data.operand) return techage.compare(val, tonumber(data.value) or 0, data.operand)
end end
return condition, result return condition, result
end, end,
@ -238,7 +238,7 @@ techage.icta_register_condition("fuel", {
return techage.send_single(environ.number, data.number, "fuel") return techage.send_single(environ.number, data.number, "fuel")
end end
local result = function(val) local result = function(val)
return techage.compare(val, tonumber(data.value), data.operand) return techage.compare(val, tonumber(data.value) or 0, data.operand)
end end
return condition, result return condition, result
end, end,
@ -280,7 +280,7 @@ techage.icta_register_condition("load", {
return techage.send_single(environ.number, data.number, "load") return techage.send_single(environ.number, data.number, "load")
end end
local result = function(val) local result = function(val)
return techage.compare(val, tonumber(data.value), data.operand) return techage.compare(val, tonumber(data.value) or 0, data.operand)
end end
return condition, result return condition, result
end, end,
@ -322,7 +322,7 @@ techage.icta_register_condition("depth", {
return techage.send_single(environ.number, data.number, "depth") return techage.send_single(environ.number, data.number, "depth")
end end
local result = function(val) local result = function(val)
return techage.compare(val, tonumber(data.value), data.operand) return techage.compare(val, tonumber(data.value) or 0, data.operand)
end end
return condition, result return condition, result
end, end,
@ -364,7 +364,7 @@ techage.icta_register_condition("delivered", {
return techage.send_single(environ.number, data.number, "delivered") return techage.send_single(environ.number, data.number, "delivered")
end end
local result = function(val) local result = function(val)
return techage.compare(val, tonumber(data.value), data.operand) return techage.compare(val, tonumber(data.value) or 0, data.operand)
end end
return condition, result return condition, result
end, end,
@ -408,7 +408,7 @@ techage.icta_register_condition("chest", {
return techage.send_single(environ.number, data.number, "state") return techage.send_single(environ.number, data.number, "state")
end end
local result = function(val) local result = function(val)
return techage.compare(val, data.value, data.operand) return techage.compare(val, tonumber(data.value) or 0, data.operand)
end end
return condition, result return condition, result
end, end,
@ -449,7 +449,7 @@ techage.icta_register_condition("signaltower", {
return techage.send_single(environ.number, data.number, "state") return techage.send_single(environ.number, data.number, "state")
end end
local result = function(val) local result = function(val)
return techage.compare(val, data.value, data.operand) return techage.compare(val, tonumber(data.value) or 0, data.operand)
end end
return condition, result return condition, result
end, end,
@ -919,7 +919,7 @@ techage.icta_register_condition("get_filter", {
return techage.send_single(environ.number, data.number, "port", data.color) return techage.send_single(environ.number, data.number, "port", data.color)
end end
local result = function(val) local result = function(val)
return techage.compare(val, data.value, data.operand) return techage.compare(val, tonumber(data.value) or 0, data.operand)
end end
return condition, result return condition, result
end, end,