Page 1 of 1

Save/restore a single entity settings

Posted: Tue May 16, 2017 5:25 pm
by mickael9
Right now, if you have an entity that you want to copy somewhere, you need the original entity to exist to be able to copy it (copy_settings require the source LuaEntity) or you need to manually deep copy the entity's properties to manually copy them (assuming they're exposed) as some aren't introspectable (eg LuaControlBehavior).

A way to save these all the settings as a plain table and restore them later when the orignal entity is gone would be very useful.
This could be achieved by providing two export_settings and import_settings methods on LuaEntity.

The format of the saved settings would be the same as the blueprint entity format so that we can also copy settings from a blueprint or basically replicate blueprint functionality without actually using blueprints