Page 1 of 1

Cargo wagon capacity

Posted: Wed Feb 12, 2025 10:59 pm
by hgschmie
When inquiring a cargo wagon for its capacity, there are mulitple ways:

Code: Select all

#wagon.get_inventory(defines.inventory.cargo_wagon)
wagon.prototype.get_inventory_size(defines.inventory.cargo_wagon)
both return 40 for a regular cargo wagon.

The cargo wagon prototype has this value set as the inventory_size attribute.

When activating the quality_affects_inventory_size attribute, the cargo wagon capacity changes with the quality:
Screenshot 2025-02-12 at 14.48.59.png
Screenshot 2025-02-12 at 14.48.59.png (82.18 KiB) Viewed 605 times
which is returned in #wagon.get_inventory(defines.inventory.cargo_wagon) but the prototype still reports "40" as inventory size.

Is there a way to calculate the expected inventory size? Quality has some scale information for mining drills and beacons but nothing for cargo wagons. And the progression (12, 12, 12, 24) is not really obvious.

Or is just looking at the inventory size of the entity the right thing to do?

Re: Cargo wagon capacity

Posted: Wed Feb 12, 2025 11:09 pm
by Xorimuth
hgschmie wrote: Wed Feb 12, 2025 10:59 pm When activating the quality_affects_inventory_size attribute, the cargo wagon capacity changes with the quality:

Screenshot 2025-02-12 at 14.48.59.png

which is returned in #wagon.get_inventory(defines.inventory.cargo_wagon) but the prototype still reports "40" as inventory size.
You can pass a level into `prototype.get_inventory_size` like this: `wagon.prototype.get_inventory_size(defines.inventory.cargo_wagon, "epic")`, which should return 76. https://lua-api.factorio.com/latest/cla ... ntory_size
Is there a way to calculate the expected inventory size? Quality has some scale information for mining drills and beacons but nothing for cargo wagons. And the progression (12, 12, 12, 24) is not really obvious.
That's because it follows the standard quality scaling that almost all things in factorio follow: +30% per level. (52 = 40 * 1.3, 64 = 40 * 1.6, etc. Legendary is 2 levels higher than Epic so it jumps by 24 rather than 12.)

Re: Cargo wagon capacity

Posted: Wed Feb 12, 2025 11:28 pm
by hgschmie
this seems even harder for the fluid wagon where the progression is 50, 65, 80, 95, 125 and there is no way to actually get that from the entity itself.

Re: Cargo wagon capacity

Posted: Wed Feb 12, 2025 11:29 pm
by hgschmie
Xorimuth wrote: Wed Feb 12, 2025 11:09 pm
hgschmie wrote: Wed Feb 12, 2025 10:59 pm When activating the quality_affects_inventory_size attribute, the cargo wagon capacity changes with the quality:

Screenshot 2025-02-12 at 14.48.59.png

which is returned in #wagon.get_inventory(defines.inventory.cargo_wagon) but the prototype still reports "40" as inventory size.
You can pass a level into `prototype.get_inventory_size` like this: `wagon.prototype.get_inventory_size(defines.inventory.cargo_wagon, "epic")`, which should return 76. https://lua-api.factorio.com/latest/cla ... ntory_size
Is there a way to calculate the expected inventory size? Quality has some scale information for mining drills and beacons but nothing for cargo wagons. And the progression (12, 12, 12, 24) is not really obvious.
That's because it follows the standard quality scaling that almost all things in factorio follow: +30% per level. (52 = 40 * 1.3, 64 = 40 * 1.6, etc. Legendary is 2 levels higher than Epic so it jumps by 24 rather than 12.)

D'oh! Thanks!

Re: Cargo wagon capacity

Posted: Fri Feb 21, 2025 5:44 pm
by Muche