Many entities in one tile

Place to get help with not working mods / modding interface.
Post Reply
thelordodin
Fast Inserter
Fast Inserter
Posts: 148
Joined: Fri Jan 06, 2017 1:54 am
Contact:

Many entities in one tile

Post 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

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Many entities in one tile

Post 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

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Many entities in one tile

Post 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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Modding help”