Page 1 of 1

surface.clone_area mirror area support

Posted: Tue Sep 15, 2020 9:24 pm
by badgamernl
Not sure if bug or not (feeling more like a missing feature so posting here)
Why?
I would like to be able to mirror an area or invert the destination axis. Could also be added as a separate function.

This would allow me to mirror a surface on a axis. (if you have another performant way to do it I would like to know)
Result now:
Command to copy chunk from bottom right to top left without mirroring it: (Works)

Code: Select all

/c game.player.surface.clone_area{source_area={{0,0},{32,32}}, destination_area={{-32,-32},{0,0}}, clone_tiles=true, clone_entities=true, clone_decoratives=true, clear_destination_entities=true, clear_destination_decoratives=true, expand_map=true}
Command to copy chunk from bottom right to top left with mirroring the destination area: (Does not work)

Code: Select all

/c game.player.surface.clone_area{source_area={{0,0},{32,32}}, destination_area={{0,0},{-32,-32}}, clone_tiles=true, clone_entities=true, clone_decoratives=true, clear_destination_entities=true, clear_destination_decoratives=true, expand_map=true}

Error:
Source area and destination area are not the same size

Re: surface.clone_area mirror area support

Posted: Wed Sep 16, 2020 5:18 am
by Rseding91
The cloning logic was built at its core to clone; not to mirror, rotate, or make copies - but to clone fully some source to a destination. It doesn't work to mirror; rails, train stops, some entities with fluid inputs/outputs are all different when rotated and just won't work the same rotated/mirrored.

What you want can already be done by iterating the entities in an area and calling clone() one at a time with what ever logic you want to be done with the position.