Finalized pipe norm algorithm.

This commit is contained in:
Adamo 2020-11-15 23:31:44 -05:00
parent 4ecd8d1125
commit dcc5ca8c4f
3 changed files with 15 additions and 23 deletions

View File

@ -1,6 +1,6 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 0.2.0 Version: 0.2.0
Date: 2020-06-26 Date: 2020-11-15
Changes: Changes:
- Updated to version 1.0 - Updated to version 1.0

View File

@ -101,25 +101,19 @@ local set_burner_colors = function(entity)
) )
end end
-- Assumes pipe had height 1 before being changed by this mod. local pipe_norm = gen_eff
local pipe_rise = data.raw.pipe.pipe.fluid_box.height - 1
for _,boiler in pairs(data.raw.boiler) do for _,boiler in pairs(data.raw.boiler) do
boiler.target_temperature = chem_temp_max boiler.target_temperature = chem_temp_max
local input_rise = boiler.fluid_box.height or 1 boiler.fluid_box.height =
local output_rise = boiler.output_fluid_box.height or 1 (boiler.fluid_box.height or 1)
boiler.fluid_box.height = input_rise/gen_eff /pipe_norm
boiler.output_fluid_box.height = output_rise/gen_eff boiler.output_fluid_box.height =
input_rise = (boiler.fluid_box.height or 1) - input_rise (boiler.output_fluid_box.height or 1)
output_rise = (boiler.output_fluid_box.height or 1) - output_rise /pipe_norm
local input_drop = input_rise - pipe_rise
local output_drop = output_rise - pipe_rise
boiler.fluid_box.base_level = boiler.fluid_box.base_level =
(boiler.fluid_box.base_level or 0) boiler.fluid_box.base_level
- input_drop /pipe_norm
boiler.output_fluid_box.base_level =
(boiler.output_fluid_box.base_level or 0)
- output_drop
boiler.energy_consumption = energy_div( boiler.energy_consumption = energy_div(
boiler.energy_consumption,gen_eff boiler.energy_consumption,gen_eff
) )
@ -149,14 +143,12 @@ for _,generator in pairs(data.raw.generator) do
(generator.effectivity or 1) (generator.effectivity or 1)
*gen_eff *gen_eff
if generator.fluid_box then if generator.fluid_box then
local input_rise = generator.fluid_box.height or 1
generator.fluid_box.height = generator.fluid_box.height =
(generator.fluid_box.height or 1)/gen_eff (generator.fluid_box.height or 1)
input_rise = (generator.fluid_box.height or 1) - input_rise /pipe_norm
local input_drop = input_rise - pipe_rise
generator.fluid_box.base_level = generator.fluid_box.base_level =
(generator.fluid_box.base_level or 0) generator.fluid_box.base_level
- input_drop /pipe_norm
end end
if generator.name:find "steam" then if generator.name:find "steam" then
if generator.name:find "turbine" then if generator.name:find "turbine" then

View File

@ -7,5 +7,5 @@
"base" "base"
], ],
"description": "All power is not created equal.", "description": "All power is not created equal.",
"factorio_version": "0.18" "factorio_version": "1.0"
} }