Fix 'delivered' command for ta4 heat exchanger
This commit is contained in:
parent
17a39387b7
commit
e73124fd38
@ -283,7 +283,8 @@ techage.register_node({"techage:heatexchanger2"}, {
|
||||
return "stopped"
|
||||
end
|
||||
elseif topic == "delivered" then
|
||||
return -math.max(nvm.needed or 0, 0)
|
||||
local data = power.get_network_data(pos, Cable, DOWN)
|
||||
return data.consumed - data.provided
|
||||
elseif topic == "load" then
|
||||
return techage.power.percent(nvm.capa_max, nvm.capa)
|
||||
elseif topic == "on" then
|
||||
|
@ -38,7 +38,7 @@ local function round(val)
|
||||
end
|
||||
|
||||
local function calc_percent(max_val, curr_val)
|
||||
return math.min(((curr_val or 0) * 100) / (max_val or 1.0), 100)
|
||||
return round(math.min(((curr_val or 0) * 100) / (max_val or 1.0), 100))
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user