Update the type of EffectValue to be be uint16
Update the type of EffectValue to be be uint16
Currently the effect value page https://lua-api.factorio.com/latest/typ ... html#bonus claims that bonus is stored as a double. This is not the case, it is actually stored as a uint16 and is reflected by trying to create a module with a bonus higher than (2^16 - 1)/2 because the bonus rolls over into the negatives.
Re: Update the type of EffectValue to be be uint16
No, not really.
First of all, it is not uint16 because effect values can be negative (for example productivity modules give speed penalty). Second, if it would be documented as integer then it would say that only acceptable values are integers however effect values loaded have 0.01 resolution that are equivalent of a 1% of the effect. Internally effect values are converted to int16 where a value is a percentage which gives an effective effect value range from -327.68 to 327.67.
First of all, it is not uint16 because effect values can be negative (for example productivity modules give speed penalty). Second, if it would be documented as integer then it would say that only acceptable values are integers however effect values loaded have 0.01 resolution that are equivalent of a 1% of the effect. Internally effect values are converted to int16 where a value is a percentage which gives an effective effect value range from -327.68 to 327.67.
Re: Update the type of EffectValue to be be uint16
This sounds like a modding interface request, not a documentation request. But also the docs are incorrect, the value is given off to mods as 32-bit floating point. You can tell by the horrid imprecision.
Re: Update the type of EffectValue to be be uint16
Thanks for noting this, I added the range given by boskid to the docs for the next release.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Update the type of EffectValue to be be uint16
yeah I hadn't exactly expressed it right but yeah I guess my point was that the modding docs dont actually mention that it sneakily behaves as a int16 where the value is a percentage of that number. The way it is set up currently led me to believe I could have a effective effect value of some large number, lets say 23402 and not actually capping at the range you gave boskid.