Here is a patch for Warptorio compatibility. In theory it should work, unfortunately there seems to be a bug in Factorio's clone_entities
method:
If you run surface.clone_entities{entities={e1, e2, e3}, ...}
, and the clone events are in order e1
, e2
, e3
, but the on_entity_cloned
event of e2
deletes e1
and e3
, then clones of e1
, e2
, e3
will all be created, but there will be no on_entity_cloned
event for e3
.
This is probably worth an official bug report, but if you want to work around that in the meantime, you'll need to call clone
for each entity in etbl
individually, checking whether the entity is valid right before cloning it.
(The effect of this bug in practice is that a bunch of disconnected auxiliary entities appear beneath the cloned factory building, causing all sorts of trouble, e.g. messing with pipe connectivity, and persisting after the factory building is moved.)