If I had game.interface as an alternative I would be happy. But I tested it once more. I am a simple thinker
, so I thought that this would perhaps work:
params = game.interface.getEntity(constrId).params
game.interface.upgradeConstruction(constrId, constr.fileName, params)
Ok, I didn't do this transf thing, but if the params are the same I think it has not to be done ...
I got this nice short error message
:
Error message: error: [string "C:/Program Files (x86)/Steam/userdata/1080598..."]:111: internal error
> Exception type: Fatal error
>
> Details:
>
> Error message: Assertion `pr.second' failed.
>
> Minidump: C:/Program Files (x86)/Steam/userdata/1080598009/1066780/local/crash_dump/0b551068-2454-41d3-ba96-640c5b00e92b.dmp
>
> In file: c:\build\tpf2_steam\src\lib\lua\value.cpp:38
>
> In function: class std::variant<struct lua::Nil,bool,double,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct lua::Table> &__cdecl lua::Table::Put(const class std::variant<struct lua::Nil,bool,double,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct lua::Table> &,class std::variant<struct lua::Nil,bool,double,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct lua::Table> &&)
stack traceback:
=[C](-1): ?
=[C](-1): upgradeConstruction
C:/Program Files (x86)/Steam/userdata/1080598009/1066780/local/mods/wk_entity_test_1/res/config/game_script/wk_entity_test.lua(111): ?
Alles anzeigen
I do not know what it means but I think I have inserted the wrong params. 
But this is what drives me crazy - and this is the reason why I have almost given up this way. 
So I will go on with the other method and try to find out if and how I could reconnect the nodes. The question is if I am allowed to write directly into some param structures - and which. I think not ... my last chance is to find some examples elsewhere. Otherwise the changing of the constructions is not so important for the things I want to do.
[OT] A very simple way to understand my project is to replace the vanilla track types by such with reduced top speed by a mod or a modifier. Now load an old map with already laid tracks. If you press [NUM]-[4] you will see that the top speed has not changed.
. But if you lay new tracks, you get the right speed for them. So you would have to replace every single laid track by itself. For certain things (like streets with no developement) even the magic wand will not work!
And this is exactly what I want to have automatized by a mod - but I cannot yet do it for stations, switch modules and so on ... I would be glad if I did not have to write such a difficult mod if the game would at least offer something like the F5-"update"-key in browsers or windows. 
If someone could tell me there is a hidden key I would be very happy because then I could program other much more exciting stuff. 
But my work won't be useless anyway. It's also a kind of "basic research"
.