Jump to content

Hydrogen Generator doesn't use internal buffer if pipe is empty


CarlenWhite
  • Pending

Right on the tin.

ug1IP.png


Steps to Reproduce
Pump to filter. Filter to generator. Pump hydrogen into the system. Cause the system to stop (Like no more hydrogen, turn off pump, etc.)
  • Like 1



User Feedback


I would suspect this is due to ConduitConsumer stating that it is not satisfied,
which then tells RequireInputs.CheckRequirements to set the operational flag "pipesHaveMass" to false,
which according to the Operational class, should turn off the machine.

If I had to hazard a guess for the fix, I'd say remove the check for conduitConsumer in CheckRequirements,
and instead check the storage component for materials.

This is also why the Electrolyzer just stops working.

Speaking of the Electrolyzer, due to the bug above there will always be very near to 10kg water stuck inside it.
When the ConduitConsumer grabs the very small amount of water to fill the storage back up to 10kg I suspect
there is a loss of water due to water "packets" attempting to refill the already waiting packet that was partially
consumed. I checked the consume code in ConduitConsumer but there is no bug there because it will only grab
what was missing from the storage. So there is another unrelated bug relating to a packet attempting to merge
with another packet but overflowing what it can contain. I'll see if I can locate that bug.

Okay in ConduitFlow.UpdateConduit(ConduitFlow.IConduit) at the RemoveElement,
it seems pretty suspicious that the out parameter "amount_removed" is being discarded.

 

Edited by Risu

Share this comment


Link to comment
Share on other sites

I have the same problem, 28.7 Kg in internal Storage, it only works for a single moment everytime new Hydrogen gets pumped in.

Share this comment


Link to comment
Share on other sites

After further investigation I'm not so sure about there being a loss of fluids now.
The merged fluid packet actually gets sent down the line all the way to the source,
which isn't exactly obvious. So it might be possible to short circuit this process at the wrong time
and lose some stuff but I don't see how there can be such a huge reported loss from that.

Correction: There actually is a case where fluid can be lost.
When AddElement is called on the destination conduit there is a possibility that not all of the mass can
fit inside it (More likely just returning 0 due to destination being deactivated) and the actual amount
is returned from AddElement, BUT this is ignored and RemoveElement takes
the requested amount and destroys it instead.



 

Edited by Risu
  • Like 1

Share this comment


Link to comment
Share on other sites

I think that might just be a redundant calculation. The same mass calculation  happens before addElement is called. It's a bit hard to read so that's with the assumption b stores how much mass the destination has available.

 

Share this comment


Link to comment
Share on other sites

I keep looking all through the whole system but nothing else is really standing out.
I really do think that section should be run through a debugger.

Like ConduitJoiner keeps getting reported as being bugged but all it does is check for a vacuum
and take the input contents is set it to the output. No math at all there. A bit strange that it has a storage
as nothing seems to target it.
 

Share this comment


Link to comment
Share on other sites

Okay I'm actually quite angry right now. I've spent days trying to debug this and guess what.
It wasn't even a whole line that needed patched. It was a single IL code.
I changed the "pop" after AddElement to "stloc.s 4". This replaces the requested amount
with the amount actually added and RemoveElement uses that instead.
There is no loss in fluid whatsoever.

I'd like to thank

for providing the save that exhibited this behavior.
 

Share this comment


Link to comment
Share on other sites

The liquid destroying behavior seems to appear on every type of machine that consumes or deals with liquids, and I've heard reports that this happens with gases as well; does your bug fix only deal with the hydrogen generators, or does it apply for all other machines as well?

Share this comment


Link to comment
Share on other sites

@Risu Thanks for the pointers, I was able to patch this by having `IsSatisfied` in `ConduitConsumer` aslo check if `!storage.IsEmpty()` if `storage` is set.

Edited by Godworrior

Share this comment


Link to comment
Share on other sites

1 hour ago, Godworrior said:

@Risu Thanks for the pointers, I was able to patch this by having `IsSatisfied` in `ConduitConsumer` aslo check if `!storage.IsEmpty()` if `storage` is set.

Could've just updated to Thermal Update.
 

Share this comment


Link to comment
Share on other sites

5 minutes ago, Risu said:

Could've just updated to Thermal Update.
 

Hmm, I didn't see it in the patch notes. I guess I could have tried that first. Besides; save file incompatibility.

Edited by Godworrior

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...