Page 1 of 1

[2.0.28] ItemProductPrototype::amount is not a uint16

Posted: Sat Dec 28, 2024 12:47 am
by zeramorphic
The type of `amount` in ItemProductPrototype is listed as `uint16`, but many of the recycling recipes in `data.raw` have floating-point values for their craft amount. For example, in `accumulator-recycling`, there is the block

Code: Select all

amount = 1.25,
extra_count_fraction = 0.25,
name = "battery",
type = "item"
I assume what happens is that the floor is taken of `amount` when loaded - I'm not sure if this behaviour is documented (at least, I couldn't find it on the docs page). Please correct me if my understanding is wrong!

Re: [2.0.28] ItemProductPrototype::amount is not a uint16

Posted: Sat Dec 28, 2024 3:55 am
by curiosity
If it's integer, then yeah, fractional numbers are silently cast to integer. Best to check in prototype explorer what the game has actually read it as.

Though it should probably be mentioned somewhere, yeah. I expect on the type's page.

Re: [2.0.28] ItemProductPrototype::amount is not a uint16

Posted: Fri May 09, 2025 8:07 am
by Therenas
I noted the truncating behavior on all prototype stage integer types for the next release, thanks.