Page 1 of 1

Connect adjacent belts to entity

Posted: Sat Sep 10, 2016 11:11 pm
by judos
For my belt sorter mod I would like to make outgoing belts connect to the entity itself.
However currently I don't see a way to implement this. Spawning invisible belts below the entity doesn't help since there would be multiple outgoing belts and those outgoing belts only check for 1 belt on the beltSorter's tile it seems.
See also this screenshot: https://github.com/judos/beltSorter/issues/9

It would be cool to have a property to make belts automatically connect (visually change their input direction) to an entity.
Thanks for your feedback!

Cheers

Re: Connect adjacent belts to entity

Posted: Sun Sep 11, 2016 2:16 am
by aubergine18
The base game is getting "loader" belts that do this sort of thing. There's a mod that enables the hidden entities: https://mods.factorio.com/mods/kij336/add-loader

Re: Connect adjacent belts to entity

Posted: Mon Sep 12, 2016 2:43 pm
by DedlySpyder
aubergine18 wrote:The base game is getting "loader" belts that do this sort of thing. There's a mod that enables the hidden entities: https://mods.factorio.com/mods/kij336/add-loader
Pretty sure that loaders were scrapped from the game (replaced by stack inserters), but they included what they had on them for modders to use

Re: Connect adjacent belts to entity

Posted: Mon Sep 12, 2016 9:59 pm
by judos
Ok thanks to Nexela we could narrow down the problem.

Spawning multiple belts on the same tile helps and adjacend belts will connect. The problem is only 2 output belts will connect and it's always either only vertical or only horizontal. See also the image.

Re: Connect adjacent belts to entity

Posted: Mon Sep 12, 2016 10:58 pm
by aubergine18
See also the appendix.
?

Re: Connect adjacent belts to entity

Posted: Mon Sep 12, 2016 11:02 pm
by judos
I meant the image that I appended.

Re: Connect adjacent belts to entity

Posted: Mon Sep 12, 2016 11:05 pm
by aubergine18
For the curved belts, have you investigated their .direction/.orientation/etc? Maybe a combination of the two is what determines whether to use curved belt sprites? If so, you could potentially listen for changes in belts (create/destroy, etc) adjacent to your entity, and then ensure any that connect to your entity have the right combo of .direction and .orientation etc?

Re: Connect adjacent belts to entity

Posted: Mon Sep 12, 2016 11:07 pm
by Nexela
Just for giggles

Way too hacky to include reliably but a proof of concept. and gives me hope that it can be done!

Re: Connect adjacent belts to entity

Posted: Mon Sep 12, 2016 11:20 pm
by aubergine18
Which property was it - the .orientation or .direction or something else?

Re: Connect adjacent belts to entity

Posted: Mon Sep 12, 2016 11:33 pm
by Nexela