Critical flaw in generator code
M-W-K opened this issue ยท 1 comments
GregTech CEu Version
v2.8.0
Modpack Used
None
Addons Installed
Gregicality Multiblocks v1.2.6
Environment
Singleplayer
New Worlds
Yes
Cross-Mod Interaction
No
Expected Behavior
Generators should consume as much fuel as they need to generate their power, and stop or produce less power if they don't have enough
Actual Behavior
If enough fuel is present in the buffer for the base, unparallelized recipe to run when the recipe completes/starts, the generator will activate with full output no matter how much fuel was actually consumed.
Steps to Reproduce
- Place two Turbo Steam Turbines (HV singleblock tier) on the ground, each with a creative tank feeding into them and a creative energy emitter acting as a sink.
- For the first turbine, set the tank to produce 10240L of steam every 10 ticks.
- For the second turbine, set the tank to produce 640L of steam every 2 ticks.
- Check the energy sinks and notice that they both record 10240EU/s, despite the second turbine clearly not receiving enough steam! (this is only enough steam for a mere 3200EU/s normally.)
Additional Information
If you are using One Probe, you can see that the second turbine completes every 2 ticks. Because of the creative tank's settings, the turbine's internal steam buffer is filled with exactly 640 steam right before the turbine does its next recipe checks.
Going to the actual recipe check logic, which is unchanged for generators, we discover that the check has zero idea of how many parallelizations the recipe is undergoing, and as such only checks if the internal tank has what it needs for the base recipe. Thus, the check sees 640 steam in the tank and signals the all clear, despite far more steam actually being required.
Loading into 2.8.2, I can make some further clarifications:
- Multiblocks no longer suffer from the issue from what I can tell; testing source is the GCYM industrial steam engine, looks like this pull request fixed it
- Singleblock turbines still have the issue in 2.8.2.