Page 1 of 1

access value of belt speed? factorio 0.12.26/27

Posted: Sun Mar 20, 2016 3:11 am
by Impatient
Hi,

is there currently (0.12.26/27) a way to access the speed of a belt via the api? i know i can set it in the entities definition. but can i access it programmatically?

thanks

Re: access value of belt speed? factorio 0.12.26/27

Posted: Sun Mar 20, 2016 9:07 am
by Rseding91
Runtime, not currently.

Read access would be pretty simple to add. Write access would require we save the speed of every single belt in the world to the save file in case it wasn't what the prototype speed was defined at which would waste a ton of space in 95%+ of everyone's save file that didn't have modified speed belts.

Re: access value of belt speed? factorio 0.12.26/27

Posted: Sun Mar 20, 2016 11:23 am
by orzelek
Rseding91 wrote:Runtime, not currently.

Read access would be pretty simple to add. Write access would require we save the speed of every single belt in the world to the save file in case it wasn't what the prototype speed was defined at which would waste a ton of space in 95%+ of everyone's save file that didn't have modified speed belts.
Or you would save only modified ones if they differ from prototype and skip saving for unmodified ones :)

Re: access value of belt speed? factorio 0.12.26/27

Posted: Sun Mar 20, 2016 3:03 pm
by Impatient
orzelek wrote:
Rseding91 wrote:Runtime, not currently.

Read access would be pretty simple to add. Write access would require we save the speed of every single belt in the world to the save file in case it wasn't what the prototype speed was defined at which would waste a ton of space in 95%+ of everyone's save file that didn't have modified speed belts.
Or you would save only modified ones if they differ from prototype and skip saving for unmodified ones :)
makes sense. both.

read access would help. thanks!


(the problematic scenario i was thinking of, is my modded entity having to interact with belts and me just knowing the speeds of the stock belts. and then, what if it has to deal with some belt from another mod, with a non-stock speed? regarding write access ... that would open up interesting new possibilities. like creating belt structures that adapt their speed to the environment, to other belts, to some conditions ? ... maybe enable write access only for non-stock/modded belt entities?)

Re: access value of belt speed? factorio 0.12.26/27

Posted: Sun Mar 20, 2016 6:50 pm
by Rseding91
orzelek wrote:... Or you would save only modified ones if they differ from prototype and skip saving for unmodified ones :)
That doesn't work because load time how do you know if you need to load the saved data? You'd have to save out a flag for every belt saying it did or didn't save the speed and at that point you might as well just save the speed.

Re: access value of belt speed? factorio 0.12.26/27

Posted: Wed Apr 06, 2016 4:45 am
by Impatient
now officially requested here:

viewtopic.php?f=28&t=23187