Cargo wagon capacity

Place to get help with not working mods / modding interface.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 113
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Cargo wagon capacity

Post 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 285 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?
Xorimuth
Filter Inserter
Filter Inserter
Posts: 726
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Cargo wagon capacity

Post 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.)
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 113
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Re: Cargo wagon capacity

Post 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.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 113
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Re: Cargo wagon capacity

Post 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!
Muche
Smart Inserter
Smart Inserter
Posts: 1006
Joined: Fri Jun 02, 2017 6:20 pm
Contact:

Re: Cargo wagon capacity

Post by Muche »

Post Reply

Return to “Modding help”