Mana Fluxfield is completely broken
hacatu opened this issue ยท 2 comments
There are at least two bugs with the mana fluxfield which cause it to generate nearly 40k rf/t and more than an order of magnitude more mana/rf than configured. First, when converting mana to rf, you only deduct mana if all the rf that 160 mana would be converted into can fit. If not, no mana is deducted. For example, if rf/burst is 4096 in config, but only 4095 rf can fit in the buffer, you would get 4095 rf for 0 mana. The while loop near line 91 should be replaced with floor division and min, like
manaToConvert = min((maxRf-currRf)/(RfPerMana), currMana);
currRf += RfPerMana*manaToConvert;
currMana -= manaToConvert;
Second, and more severly, near line 119 you limit the energy deducted from the internal buffer but not the energy sent to external machines, so if the internal buffer is 40k rf, about 40k rf is sent per tick rather than 1.6 k. You should set the rf to send to min(currRf/adjSinks, maxRfPerTick)
.
Also, the config should have mana/rf and rf/tick instead of mana/burst and shots/burst. Shot and burst are synonyms so the second option makes no sense and is not what people want. Mana bursts can range from 1 mana to 1280 mana (probably more with the manastorm charge) so having any of the code rely on the value for a basic spreader doesn't make sense. It is also easier to reason about rf/mana than rf/burst. And the rf/tick setting would just be very useful.
I get not having numbers within the user facing gameplay of botania, but for mod development and even pack development they're necessary. There isn't a fixed rf production rate that works for all packs any more than there is a fixed rf to mana ratio in all packs. It could be expressed as "ticks to process burst" instead of "rf/t" if we want to staunchly minimize numbers. Having it just output as quickly as possible as it does now (despite the rf/t limit existing nominally) but correctly draining its internal buffer could also work, but less flexibly