Changing transport belt speed in-game

Place to get help with not working mods / modding interface.
Post Reply
xenon54xenon
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Aug 31, 2022 8:02 pm
Contact:

Changing transport belt speed in-game

Post by xenon54xenon »

Decided to do some poking around in the api docs, and it seems like the transport belt prototype(s) have their speed set before runtime. Problem is, I would like to change the speed of transport belts while the map is loaded, preferably with circuit signals, and even have multiple different belts running at their own speeds. I'd appreciate it if somebody could help me figure out if this is possible to implement within the vanilla prototypes, whether I can change the prototypes to make this possible, if it would take a top-bottom reimplementation of belt logic and prototypes, or if the only possible solution is to preload like a hundred different transport belts of different speeds and script different ones to swap in when the speed changes it's impossible.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2255
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Changing transport belt speed in-game

Post by boskid »

There is no support for this. This falls into the common problem of deciding what value to take in case of a prototype data changes: should it take a value from an existing entity or a value from a new prototype? Internally TransportLines can have speed changed and it is used in one specific case (when a transport belt is connected with a circuit wire and it is disabled, the speed is forced to 0) but there is no place where a speed value is save-loaded, its always taken from the prototype and all the changes are reapplied from the control behavior state. There are also some tiny things to consider like splitting and merging transport lines when belts would have the same speed while being of different prototype or would have different speed when being of the same prototype: for example transport belt with control behavior will never merge transport lines to adjacent connectables because splitting a transport line every time a circuit condition is changed would be way too expensive.

I think this would also create a lot of issues with the belt animations

xenon54xenon
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Aug 31, 2022 8:02 pm
Contact:

Re: Changing transport belt speed in-game

Post by xenon54xenon »

How much would need to be reimplemented? Like is this a problem going back to the entity prototype itself or would it 'only' need transport belts (and presumably their logic) to be remade?

Post Reply

Return to “Modding help”