Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Maybe it's a good thing... If a mod update is something that crashes (because mod conflict or whatever), and the game automatically updates everything at start, then it would insta-crash at every start. Maybe a little more difficult to find out what's wrong.
Still sucks having to manually update every single construction after every mod update tho... 😵
I'm using a loadConstruction addModifier to add a new user-selectable option to modular rail stations (vanilla plus a few specified mods).
When I load the game, if I modify an existing station first to "refresh" it (add/remove a component) and then toggle the new option, it works okay, though I have to toggle the option off then on again to see the effect.
BUT if I load the game and toggle the new option without first refreshing the station, it's instant CTD 💥 Since doing that is completely natural this is unusable because there'll be so many crashes.
How can I refresh all existing stations when the game loads so that this crash doesn't happen when the new option is toggled for the first time?
I tried running the base_config.lua function game.config.ConstructWithModules(params) inside the postRunFn of mod.lua but it also crashes due to missing data.
Thanks
Then you can try game.interface.upgradeConstruction(), copy from the freestyle station itself.
I really think you should not do this though.
Anyhow I skipped it. The context was a mod used to have a .script file that is no longer needed so I removed it. But before the stations are updated by the user, the modules still point to that file so it crashed. I restored the file and the crashes stopped. It's unused so it's just there for legacy support now.
I tried using an addModifier to change the script reference but it still crashed. The reference in stored savegames seems to be at a lower data level than the tables that we access via lua/API commands.
I forget if I also tried it in postRunFn too...
I looked at the "station / industry bulk upgrade" mod and it uses some API functions to update things, but it's in response to a user selection in the GUI.
However, you want to 1. fire 2. upgradeFn() here, which is something else.
- Old mod set the updateScript.fileName of station modules to a custom .script file.
- Build stations with old mod and save game.
- New mod v2 doesn't set updateScript.fileName anymore because that script is not used now. New mod also adds a new construction.param option for the user.
- Load savegame, and user toggles the new param option on an existing station, instant CTD. Error indicates the game (specifically base_config.constructWithModules) is still trying to find the old .script file from v1.
- Load savegame, add/delete a module to update existing station first, no crash. Then toggle the new param option, no crash.
So it's the combination of the removal of an old .script file, and toggling a new param option that didn't exist before.
It seems that when that first update occurs, an existing station is still using stale data that was in the savegame, not the current mod definition. And for some reason the new param option seems to be involved. I mean I can remove the old .script and nothing crashes. But if I add a new param option and toggle that first, then it crashes and says it can't find the old .script 🤷♂️
* Delete the station.
* Undo the deletion via Undo Mod.
When it reappears it will be the same configuration you had it in track/platform wise, but it will be the updated version scripting wise.
If that is not what you wanted, then I may have misunderstood your question.