Transport Fever 2

Transport Fever 2

Capacity Adjuster
This topic has been locked
doug 19 Sep, 2023 @ 6:44pm
Selecting 0.25 causes the game to crash
An array of parameter of n parameter choices will return values between 0 and n-1.
LUA arrays are indexed from 1 to n.
So, when the user selects 0.25 as the scale factor, the parameter value is zero and scaleFactors[params.factor] returns a nil value.
You will want scaleFactors[params.factor + 1]

Also, you will want to note in the description that this mod should be loaded after all mods that add cargo types or that otherwise change the cargoes that vehicles carry. Otherwise, your mod will not modify the cargo capacities that are added to vehicles by those other mods.
< >
Showing 1-2 of 2 comments
doug 19 Sep, 2023 @ 7:01pm 
On further reflection, I don't think the load order will matter. Most, if not all, industry mods copy capacity values from existing compartments.
McModder  [developer] 20 Sep, 2023 @ 2:29am 
About array indexes: Yep, I forgot to check it :/
< >
Showing 1-2 of 2 comments
Per page: 1530 50