diff --git a/energy_storage/heatexchanger2.lua b/energy_storage/heatexchanger2.lua index 967e26a..591acc8 100644 --- a/energy_storage/heatexchanger2.lua +++ b/energy_storage/heatexchanger2.lua @@ -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 diff --git a/power/formspecs.lua b/power/formspecs.lua index c014ab5..81fb87b 100644 --- a/power/formspecs.lua +++ b/power/formspecs.lua @@ -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 -------------------------------------------------------------------------------