[2.0.28] ItemProductPrototype::amount is not a uint16

zeramorphic
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Dec 28, 2024 12:39 am
Contact:

[2.0.28] ItemProductPrototype::amount is not a uint16

Post 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!
curiosity
Filter Inserter
Filter Inserter
Posts: 651
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

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

Post 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.
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 323
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

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

Post by Therenas »

I noted the truncating behavior on all prototype stage integer types for the next release, thanks.
Post Reply

Return to “Resolved Requests”