mirror of
https://github.com/minetest-mods/technic.git
synced 2024-12-24 18:00:29 +01:00
Supply converter: Charge batteries again
This commit is contained in:
parent
6a9dfec36f
commit
705961e2fe
@ -157,7 +157,8 @@ local run = function(pos, node, run_stage)
|
||||
local demand = 0
|
||||
if enabled then
|
||||
-- Reverse evaluate the required machine and round to a nice number
|
||||
demand = 100 * math.ceil((sw_meta:get_int("demand") / efficiency) / 100)
|
||||
demand = sw_meta:get_int("ba_demand") + sw_meta:get_int("demand")
|
||||
demand = 100 * math.ceil(demand / efficiency / 100)
|
||||
-- Do not draw more than the limit
|
||||
demand = math.min(demand, meta:get_int("power"))
|
||||
end
|
||||
|
@ -355,6 +355,8 @@ minetest.register_abm({
|
||||
BA_eu_supply = BA_eu_supply + meta1:get_int(eu_supply_str)
|
||||
BA_eu_demand = BA_eu_demand + meta1:get_int(eu_demand_str)
|
||||
end
|
||||
-- Expose value for the supply converter
|
||||
meta:set_int("ba_demand", BA_eu_demand)
|
||||
--dprint("Total BA supply:"..BA_eu_supply)
|
||||
--dprint("Total BA demand:"..BA_eu_demand)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user