I want to add to my mod high-tier structure that can and transfer and store the electricity, call it "substation facility".
But, it is impossible to apply multiple types to one entity, directly we can have only or electricity-pole or accumulator.
I thought about pasting two entity both from one item, but I don't think just add it to "place_result" will be works, and this need coordinates and removeablity of two spawned entities simultaneously to prevent item-entity duplicating "cheat".
What you thinks about this?
Making "fake single" entity from multi entities?
- DemerNkardaz
- Inserter
- Posts: 27
- Joined: Wed Jan 18, 2023 12:32 am
- Contact:
Re: Making "fake single" entity from multi entities?
The usual way is to use one item that will place a placeholder entity. Listen to the build events, and if your placeholder is built, create the real (but hidden) entities which do the actual work at the same location (with some offset, if necessary). You must keep track of which hidden entities belong to which combined entity, so when the visible entity is destroyed or mined, you can destroy the hidden entities as well.DemerNkardaz wrote: Sun Jan 22, 2023 8:35 am I want to add to my mod high-tier structure that can and transfer and store the electricity, call it "substation facility".
But, it is impossible to apply multiple types to one entity, directly we can have only or electricity-pole or accumulator.
I thought about pasting two entity both from one item, but I don't think just add it to "place_result" will be works, and this need coordinates and removeablity of two spawned entities simultaneously to prevent item-entity duplicating "cheat".
What you thinks about this?
If you want to take a look, I've used this technique for Bio Industries -- but I'm afraid the code is not exactly easy to read.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
- DemerNkardaz
- Inserter
- Posts: 27
- Joined: Wed Jan 18, 2023 12:32 am
- Contact:
Re: Making "fake single" entity from multi entities?
Thank you for answer!Pi-C wrote: Sun Jan 22, 2023 10:12 amThe usual way is to use one item that will place a placeholder entity. Listen to the build events, and if your placeholder is built, create the real (but hidden) entities which do the actual work at the same location (with some offset, if necessary). You must keep track of which hidden entities belong to which combined entity, so when the visible entity is destroyed or mined, you can destroy the hidden entities as well.DemerNkardaz wrote: Sun Jan 22, 2023 8:35 am I want to add to my mod high-tier structure that can and transfer and store the electricity, call it "substation facility".
But, it is impossible to apply multiple types to one entity, directly we can have only or electricity-pole or accumulator.
I thought about pasting two entity both from one item, but I don't think just add it to "place_result" will be works, and this need coordinates and removeablity of two spawned entities simultaneously to prevent item-entity duplicating "cheat".
What you thinks about this?
If you want to take a look, I've used this technique for Bio Industries -- but I'm afraid the code is not exactly easy to read.
Now I will think about it.