Transport Fever 2

Transport Fever 2

Dynamic Infrastructure Costs
GordonDry 10 May, 2022 @ 12:14pm
Fixed: Incompatibility to "Freestyle train station"
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2363493916

Already built station (before I upddated this mod to v2), trying to add a module adds this to the log each time:
Exception type: Lua exception This error is usually caused by modding. Some game resources contain incorrect data. Details: Error message: error: mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/vehicle_stats.lua:33: attempt to compare number with nil stack traceback: =[C](-1): __le @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/vehicle_stats.lua(33): isAvailable @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/vehicle_stats.lua(53): selectorFunc @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/lib/table_util.lua(170): func @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/lib/table_util.lua(115): ? @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/lib/table_util.lua(90): map @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/vehicle_stats.lua(50): getBestAvailableVehicleScoreByCategory @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/vehicle_stats.lua(118): calculateVehicleMultipliers @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/vehicle_stats.lua(202): getMultiplier @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/main.lua(109): constructionUpdate @mods/dynamic_infrastructure_costs_2/res/scripts/costly_infrastructure_v2/main.lua(143): ? @res/config/base_config.lua(41): ? File name: mods/freestyle_train_station_1/res/construction/station/rail/lollo_freestyle_train_station/station.con Key: game/config/ConstructWithModules Minidump: C:/Users/Admin/AppData/Roaming/Transport Fever 2/crash_dump/9181dd48-cf6e-41b7-ad2c-b6e8295f70af.dmp Mod: "Freestyle train station" (freestyle_train_station, 1) (consider removing this mod and contacting the mod author) In file: C:\GitLab-Runner\builds\1BJoMpBZ\0\ug\urban_games\train_fever\src\Lib\lua\State.cpp:641 In function: void __cdecl lua::State::Call(int,int)


Perhaps it's triggered by this?
https://steamhost.cn/steamcommunity_com/workshop/filedetails/discussion/2363493916/3271312871356220431/
and / or
https://steamhost.cn/steamcommunity_com/workshop/filedetails/discussion/2617346426/3271312219447216045/
Last edited by GordonDry; 13 May, 2022 @ 5:10am
< >
Showing 1-9 of 9 comments
GordonDry 10 May, 2022 @ 12:34pm 
After removing "Dynamic Infrastructure Costs v2" the beforementioned issue with "Freestyle train station is gone.

Even the other issue is gone:
https://steamhost.cn/steamcommunity_com/workshop/filedetails/discussion/2363493916/3271312871356220431/
phobos2077  [developer] 11 May, 2022 @ 1:42am 
Can't seem to reproduce this. Based on error message it looks like the construction script from that mod changed "year" parameter to nil, which is not expected (vanilla constructions never do this).

Maybe you can send me your save file and exact steps to reproduce the error?
Last edited by phobos2077; 11 May, 2022 @ 1:45am
phobos2077  [developer] 11 May, 2022 @ 2:03am 
I've published new version with possible fix. Can you test it?
GordonDry 11 May, 2022 @ 3:04am 
Fixed.
phobos2077  [developer] 11 May, 2022 @ 3:25am 
Nice to hear. Thanks for reporting!
lollus 13 May, 2022 @ 5:05am 
Which component has yearFrom == nil?
phobos2077  [developer] 13 May, 2022 @ 5:12am 
Originally posted by lollus:
Which component has yearFrom == nil?
It wasn't yearFrom, rather params.year being null in Construction UpdateFn. Which never happened in vanilla.
lollus 13 May, 2022 @ 5:14am 
params.year is set automatically by the game. Which construction is it?
phobos2077  [developer] 13 May, 2022 @ 6:06am 
Originally posted by lollus:
params.year is set automatically by the game. Which construction is it?
I actually don't know, I wasn't able to reproduce this myself. I only discovered this based on error log (another value being compared can't be nil in that expression, so it was 100% params.year being nil). I only added nil check so my mod defaults to cost multiplier of 1 for such constructions.
< >
Showing 1-9 of 9 comments
Per page: 1530 50