[Dominik][0.17.59] Fluid mixing by game.merge_forces
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
I am quite familiar with it as this "clamping" is internally quite sick and created some difficult bug.
-
- Long Handed Inserter
- Posts: 96
- Joined: Sun Mar 25, 2018 5:34 am
- Contact:
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
It's just pipe prototype manipulating to have less ports than before. It locks it down to very specific connection positions to deny connection in specific directions.
It was my other mod that caused all the bugs lol.
It was my other mod that caused all the bugs lol.
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
I remember that I spent long time fixing this one with pipes connecting wrong during the hidden prototype replacement.
-
- Long Handed Inserter
- Posts: 96
- Joined: Sun Mar 25, 2018 5:34 am
- Contact:
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
Ohhh damn that's right.
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
Nice. So devs already have experience with the mod. Then it should be obvious that adopting it into vanilla is the perfect solution.
-
- Long Handed Inserter
- Posts: 96
- Joined: Sun Mar 25, 2018 5:34 am
- Contact:
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
Oktokolo solving problems by just splitting the pipes usually does not solve the actual problem. While having the better pipe building would be nice, it is not good a solution to mixing problems. (not like my solution is good, but it does not take two weeks to make)
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
I think there is a solution: turn this bug into feature. Every time two underground pipes may connect but contain different fluids, just remove them and spawn explosion and show alert "underground pipe was destroyed by mixing fluids".
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
Yeah I would really love that, get rid of this whole blocked pipe thing. But that is the last resort and I don't want to do that when I have already sunk so much work into it
- BlueTemplar
- Smart Inserter
- Posts: 3234
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
BobDiggity (mod-scenario-pack)
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
The actual problem is, that you can build things with multiple factions that are forbidden to have with only one faction. The root cause is that adjacent pipes have to connect and underground pipes have to connect to the nearest opposite-facing endpoint while connecting two differently-fluid-locked FSs is forbidden.
Fix the build restriction in the general case so we can have adjacent unconnected pipes and connect undergrounds to any opposite-facing and free endpoint in range as we wish. Then the game state created by naively merging factions is not invalid anymore and a whole class of fluid-system-related bugs is not a bug anymore.
But having huge explosions destroying a multiple-tile radius of piping and machinery when trying to connect FSs holding different fluids would make me happy too. So i am fine with "fixing" the bug class that way. I am mostly playing modded (mostly QoL and some "Cheats" like Nanobots, warehouses, crating) anyway. The mod works fine as it is and would probably still continue to work after the high explosive fluids "fix".
I don't know how hard copying a mod into the core mod and implementing the layer-copy-testing method is, but triggering explosions on no-fluid-mixing-rule violation should be rather easy to add to the existing automatism.
It would certainly look much better in streams than just having boring pipes next to each other that just work and do nothing fancy at all too.
Except, that it would just solve the entire class of fluid mixing problems for pipes and underground pipes. Add a solution for machinery like pumps and refineries/assemblers/tanks too and you have the entire bug class gone extinct as fluid mixing violations would literally become impossible to exist.
By the way: It does not have to be done with "special" prototypes and replacing them when clamping/unclamping. That just was the only sensible way for a mod author without direct access to the engine code to use. With access to engine code, you could have a bit-flag per possible connection-point indicating whether there might be a connection established or not. That would imply one byte extra state per fluid-related entity per eight fluid connection points though (not sure whether that is worth it or not for pipes and undergrounds as they work just fine with the "special" prototypes hack).
The automatism code would have to set the corresponding flags for both items' affected connection points whenever a non-fluid-mixing-rule violation is detected.
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
For this one, I have to unfortunately do won't fix. It is not really something people would realistically encounter and rewriting several places in the code, force change logic, is just not worth it.
Re: [Dominik][0.17.59] Fluid mixing by game.merge_forces
Sad but understandable. We might still get lucky and have the root cause resurface as a less easy ignorable bug.
Also i am pretty sure that it is possible to fix this bug in a mod doing the layer-copy-merge-compare i suggested in an on_forces_merging event handler.