Transport Fever 2

Transport Fever 2

Dynamic Infrastructure Costs
GordonDry 2022 年 5 月 10 日 下午 12:14
Fixed: Incompatibility to "Freestyle train station"
https://psteamcommunity.yuanyoumao.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://psteamcommunity.yuanyoumao.com/workshop/filedetails/discussion/2363493916/3271312871356220431/
and / or
https://psteamcommunity.yuanyoumao.com/workshop/filedetails/discussion/2617346426/3271312219447216045/
最后由 GordonDry 编辑于; 2022 年 5 月 13 日 上午 5:10
< >
正在显示第 1 - 9 条,共 9 条留言
GordonDry 2022 年 5 月 10 日 下午 12:34 
After removing "Dynamic Infrastructure Costs v2" the beforementioned issue with "Freestyle train station is gone.

Even the other issue is gone:
https://psteamcommunity.yuanyoumao.com/workshop/filedetails/discussion/2363493916/3271312871356220431/
phobos2077  [开发者] 2022 年 5 月 11 日 上午 1:42 
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?
最后由 phobos2077 编辑于; 2022 年 5 月 11 日 上午 1:45
phobos2077  [开发者] 2022 年 5 月 11 日 上午 2:03 
I've published new version with possible fix. Can you test it?
GordonDry 2022 年 5 月 11 日 上午 3:04 
Fixed.
phobos2077  [开发者] 2022 年 5 月 11 日 上午 3:25 
Nice to hear. Thanks for reporting!
lollus 2022 年 5 月 13 日 上午 5:05 
Which component has yearFrom == nil?
phobos2077  [开发者] 2022 年 5 月 13 日 上午 5:12 
引用自 lollus
Which component has yearFrom == nil?
It wasn't yearFrom, rather params.year being null in Construction UpdateFn. Which never happened in vanilla.
lollus 2022 年 5 月 13 日 上午 5:14 
params.year is set automatically by the game. Which construction is it?
phobos2077  [开发者] 2022 年 5 月 13 日 上午 6:06 
引用自 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.
< >
正在显示第 1 - 9 条,共 9 条留言
每页显示数: 1530 50