Is there a way to force connection_distance update?

Place to get help with not working mods / modding interface.
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Is there a way to force connection_distance update?

Post by Jackalope_Gaming »

I have made a mod (The 8L Train Project) that changes the connection_distance and joint_distance of train entities. The main problem with this is when it's loaded into a game that already has trains placed down, those values do not update until the entity is picked up and placed down again. The collision_box and such do update however, and this causes such problems as shown at https://cloud.githubusercontent.com/ass ... 4fbff6.png where the train turns and the collision boxes between the loco and the wagon behind it crash into each other.

Is there a command, script, or some other way to force the game to update the connection_distance and expand the trains out so it doesn't have to manually be done for every single one?
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Is there a way to force connection_distance update?

Post by Adil »

I can only come up with finding, destroying and respawning each train in the game. (Well, and a fancy idea of checking trains during the on_train_changed_state event.)
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: Is there a way to force connection_distance update?

Post by Jackalope_Gaming »

Destroying the trains and respawning them might be a nuclear option. The big issue with that is going to be the items inside the trains getting destroyed, meaning locos won't have fuel and wagons would lose potentially very valuable items.

Would using a data-updates.lua file work? I'd have to learn how to set that up, but it shouldn't take long.
Post Reply

Return to “Modding help”