Page 1 of 1

Many entities in one tile

Posted: Wed Jan 03, 2018 10:31 pm
by thelordodin
Is it possible to create many custom-entities in one tile?
For example take as base entity - lamp or constant combinator and create them with factorio API?

I didn't succeed with my attempts to do it.

Is it possible?
How?
Is it possible to make the whole set of entites blueprintable?

----
What for:
I want to create a small entity, but it seems that I need several functionalities for it, so I have to create several invisible paired entites for it

Re: Many entities in one tile

Posted: Thu Jan 04, 2018 3:10 am
by Nexela
Building by script will (almost?) always build the entity no matter what else is there. So you would use the on built event to check for your main entity being build and then spawn in your helper entities on the same position. Doing it this way should also cover when robots build the entity. Also don't forget on_entity_died and the pre-mined events might be needed to clean up entities.


Given how often these event would fire. (Not very) it is usually easter to search the position of the entity for your helpers than to rely on a bunch of global table mappings to save it

Re: Many entities in one tile

Posted: Thu Jan 04, 2018 4:17 am
by eradicator
If you need your "cluster" to be blueprint compatible the most common(?) way is to have one "main" entity with a collision box, and all the invisible helpers with no collision/selection box at all. But this is only required if the helper entities have to store some blueprintable data (i.e. circuit settings, wires, direction), if they don't it's easier to destroy/build them entirely in script.