Method to clone/duplicate an entity
Method to clone/duplicate an entity
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.
Re: Method to clone/duplicate an entity
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.
Re: Method to clone/duplicate an entity
That's unfortunate. That leaves a lot of un-copyable attributesRseding91 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.
Re: Method to clone/duplicate an entity
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.sparr wrote:That's unfortunate. That leaves a lot of un-copyable attributesRseding91 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.
If you want to get ahold of me I'm almost always on Discord.
Re: Method to clone/duplicate an entity
Looks like LuaEntity::clone() is going into 0.17. Hooray!