mirror of
				https://asciireactor.com/factorio/adamo-physics.git
				synced 2025-10-31 23:18:04 +00:00 
			
		
		
		
	Finalized pipe norm algorithm.
This commit is contained in:
		
							parent
							
								
									4ecd8d1125
								
							
						
					
					
						commit
						dcc5ca8c4f
					
				| @ -1,6 +1,6 @@ | ||||
| --------------------------------------------------------------------------------------------------- | ||||
| Version: 0.2.0 | ||||
| Date: 2020-06-26 | ||||
| Date: 2020-11-15 | ||||
| 
 | ||||
|   Changes: | ||||
|     - Updated to version 1.0 | ||||
|  | ||||
| @ -101,25 +101,19 @@ local set_burner_colors = function(entity) | ||||
| 		) | ||||
| end | ||||
| 
 | ||||
| -- Assumes pipe had height 1 before being changed by this mod. | ||||
| local pipe_rise = data.raw.pipe.pipe.fluid_box.height - 1 | ||||
| local pipe_norm = gen_eff | ||||
| 
 | ||||
| for _,boiler in pairs(data.raw.boiler) do | ||||
| 	boiler.target_temperature = chem_temp_max | ||||
| 	local input_rise = boiler.fluid_box.height or 1 | ||||
| 	local output_rise = boiler.output_fluid_box.height or 1 | ||||
| 	boiler.fluid_box.height = input_rise/gen_eff | ||||
| 	boiler.output_fluid_box.height = output_rise/gen_eff | ||||
| 	input_rise = (boiler.fluid_box.height or 1) - input_rise | ||||
| 	output_rise = (boiler.output_fluid_box.height or 1) - output_rise | ||||
| 	local input_drop = input_rise - pipe_rise | ||||
| 	local output_drop = output_rise - pipe_rise | ||||
| 	boiler.fluid_box.height =  | ||||
| 		(boiler.fluid_box.height or 1) | ||||
| 		/pipe_norm | ||||
| 	boiler.output_fluid_box.height =  | ||||
| 		(boiler.output_fluid_box.height or 1) | ||||
| 		/pipe_norm | ||||
| 	boiler.fluid_box.base_level = | ||||
| 		(boiler.fluid_box.base_level or 0) | ||||
| 		- input_drop | ||||
| 	boiler.output_fluid_box.base_level = | ||||
| 		(boiler.output_fluid_box.base_level or 0) | ||||
| 		- output_drop | ||||
| 		boiler.fluid_box.base_level | ||||
| 		/pipe_norm | ||||
| 	boiler.energy_consumption = energy_div( | ||||
| 		boiler.energy_consumption,gen_eff | ||||
| 	) | ||||
| @ -149,14 +143,12 @@ for _,generator in pairs(data.raw.generator) do | ||||
| 		(generator.effectivity or 1) | ||||
| 		*gen_eff | ||||
| 	if generator.fluid_box then | ||||
| 		local input_rise = generator.fluid_box.height or 1 | ||||
| 		generator.fluid_box.height =  | ||||
| 			(generator.fluid_box.height or 1)/gen_eff | ||||
| 		input_rise = (generator.fluid_box.height or 1) - input_rise | ||||
| 		local input_drop = input_rise - pipe_rise | ||||
| 			(generator.fluid_box.height or 1) | ||||
| 			/pipe_norm | ||||
| 		generator.fluid_box.base_level = | ||||
| 			(generator.fluid_box.base_level or 0) | ||||
| 			- input_drop | ||||
| 			generator.fluid_box.base_level | ||||
| 			/pipe_norm | ||||
| 	end | ||||
| 	if generator.name:find "steam" then | ||||
| 		if generator.name:find "turbine" then | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user