ClaudeMetz / FactoryPlanner

A mod for Factorio. Allows you to plan out your production in detail.
https://mods.factorio.com/mod/factoryplanner
MIT License
92 stars 46 forks source link

Fluid temperature is broken #95

Open ClaudeMetz opened 1 year ago

ClaudeMetz commented 1 year ago

I have thrown out the previous handling of fluid temps. It means the system is now over-lenient (allowing you to plan setups that won't actually work that way) instead of over-restrictive (not allowing you to plan setups that are actually possible). This is better than before, as it at least allows you to plan everything, while being careful that what you lay out is actually allowed.

The fluid temperature system is actually pretty straightforward, at least for normal recipes. Products have a temperature at which they come into existence. Ingredients have a min and max temp they work with. They can also have a single exact temperature required I think. If the product temp is within the ingredient's range, they work. So far, so simple. Actually implementing this though poses a few issues.

For one, it requires tracking actual fluid temperatures with their items, which shouldn't be done via having it encoded in the prototype name anymore. This opens up a whole can of worms, as the system is not at all laid out for this. The solver doesn't have a place to carry temperatures along, so the structures will need to be reworked to fit it in, which is a lot. Then, every place that matches ingredients/products will need special logic to go and see if any fluids with temp are involved and handle them in a special way.

The two places that this affects is the recipe dialog and the solvers. The solvers are probably fine since they deal with the Ingredient/FormattedProduct tables directly which have the relevant info, it's just some effort to change things around. The recipe dialog is another matter. It just passes item prototypes around since that is the expedient way to do things. Now, it needs to consider the item temperature too, which means it needs to be passed around from its line/floor everywhere, which it is not at all set up to do.

Apparently, IR3 uses fluid temps to good effect. Ore washing efficiency apparently depends on water temp? Will have to investigate.

Tangentially, fluid temps are also relevant to boilers, support for which I dropped for now. There, the variable temperature plays an actual role I think. The boilers also didn't support all energy sources, like fluids. When I have the fluid temperature system for recipes worked out, I should come back to this and make it work properly in all cases.

ClaudeMetz commented 1 month ago

After weeks of work, I think I am close to cracking this. Just didn't make it for 2.0, but will hopefully come soon after.