Page 1 of 1

Get Belts of belt Line

Posted: Sat Jan 30, 2021 3:41 pm
by ss_Baum
Hello everyone, hello dear dev's

I am trying to create a mod which allows you, to built speed editable belt's.
There I have to get the Belt-Line to change the speed, do the electricity calculation and more.
It would be nice, if there would be a way to get all Belt's of one line.
I know there is the belt_neighbors which gives you the neighbor of a single belt.
But I hoped, that you could get all the belt entities from a belt line in one table, to get a better performance.
If you don't store them while creating the path for the Items, you don't need to implement this.
But if the data is already stored in a variable, it would be nice if I could access the variable through the api.

Re: Get Belts of belt Line

Posted: Sun Jan 31, 2021 12:49 am
by Rseding91
Belt speed is just changeable runtime so i'm not sure how this would be of any use to you.

Re: Get Belts of belt Line

Posted: Sun Jan 31, 2021 10:28 am
by ss_Baum
Rseding91 wrote: Sun Jan 31, 2021 12:49 am Belt speed is just changeable runtime so i'm not sure how this would be of any use to you.
I am not sure, if I understood your answer right, maybe I missed the context because englisch isn't my primary language.

So, can you change the Belt_speed while in-game? That's what I have understood from your message.
At the moment I do this with create_entity viewtopic.php?f=34&t=95188

And to my question, accessing all belts of one transport line would make it just easier for me, to handle the built and destroy-events. Because at the mpment I would have to loop through the blet_neighbors pretty often. Not every time a belt is built, but every time a belt is destroyed ore rotated I have to figure out, if the line changed, where it split's to two lines and so on.

So if there would be a way to access all Belt's of a transport line, I would not have to loop through the belt_neighbors and that would be good for the performance.

Re: Get Belts of belt Line

Posted: Sun Jan 31, 2021 4:34 pm
by Rseding91
Sorry; I meant to say setting belt speeds runtime is *not* possible.

Re: Get Belts of belt Line

Posted: Sun Jan 31, 2021 4:41 pm
by ss_Baum
Rseding91 wrote: Sun Jan 31, 2021 4:34 pm Sorry; I meant to say setting belt speeds runtime is *not* possible.
How you maybe saw in the vid, I decided to use create_entity to make it possible, At the moment I am creating the line-detection.
And that's the point where it would be nice, to get at least the positions of the belts in array.
at the moment I try it with belt_neighbour.