Method to clone/duplicate an entity

Post Reply
sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Method to clone/duplicate an entity

Post by sparr »

I would like for LuaEntity.clone() to exist or for LuaSurface.create_entity(LuaEntity) to create a copy of the entity in question or some other similar functionality.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Method to clone/duplicate an entity

Post by Rseding91 »

There exists no such logic in the game. The best you can get is to create an entity of the same name and then use copy_settings to copy the settings from the old entity.
If you want to get ahold of me I'm almost always on Discord.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Method to clone/duplicate an entity

Post by sparr »

Rseding91 wrote:There exists no such logic in the game. The best you can get is to create an entity of the same name and then use copy_settings to copy the settings from the old entity.
That's unfortunate. That leaves a lot of un-copyable attributes :(

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Method to clone/duplicate an entity

Post by Rseding91 »

sparr wrote:
Rseding91 wrote:There exists no such logic in the game. The best you can get is to create an entity of the same name and then use copy_settings to copy the settings from the old entity.
That's unfortunate. That leaves a lot of un-copyable attributes :(
That's how it works. The game never needs to clone things to that extent so we never built a system to do it. You'll need to build your own if you want such a thing.
If you want to get ahold of me I'm almost always on Discord.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Method to clone/duplicate an entity

Post by sparr »

Looks like LuaEntity::clone() is going into 0.17. Hooray!

Post Reply

Return to “Implemented mod requests”