[1.1.33] LuaSurface.clone_brush clones entities to the wrong location.
Posted: Wed May 05, 2021 8:31 am
LuaSurface.clone_brush always clones entities to the exact same position they are in, ignoring the source_offset and destination_offset parameters. This does not affect LuaSurface.clone_area.
However LuaSurface.clone_brush clones tiles correctly respecting the source_offset and destination_offset.
If trying to clone_brush from a position on a surface to a different position on the same surface, this will result in the entities being duplicated in place.
If trying to clone_brush from a position on a surface to a different position on a different surface, this will result in the entities being cloned to the wrong position on the different surface (because the cloned entity x/y position is not modified by the source_offset and destination_offset.
The behavior of clearing entities in the area being cloned to seems to work. The only issue I've managed to verify is that the cloned entities are put in the wrong location.
An example with images of what's happening when trying to use LuaSurface.clone_brush is below.
The images were created by trying to use LuaSurface.clone_brush to clone part of a build (mostly just the belts) from one planet to another.
The first image shows the original build on the source planet: The second image shows the tiles that were attempted to be copied being placed with respect to the passed source_offset and destination_offset: The third image shows the entities that were attempted to be copied being placed with the exact same x/y coordinate as those of the entities on the original surface: The expected behavior would be that the tiles and entities are cloned to the same location, not different ones (and preferably to the location that the tiles are cloned to since that seems to be working currently).
Log here. Made a mistake and didn't include it originally. I am sorry.
However LuaSurface.clone_brush clones tiles correctly respecting the source_offset and destination_offset.
If trying to clone_brush from a position on a surface to a different position on the same surface, this will result in the entities being duplicated in place.
If trying to clone_brush from a position on a surface to a different position on a different surface, this will result in the entities being cloned to the wrong position on the different surface (because the cloned entity x/y position is not modified by the source_offset and destination_offset.
The behavior of clearing entities in the area being cloned to seems to work. The only issue I've managed to verify is that the cloned entities are put in the wrong location.
An example with images of what's happening when trying to use LuaSurface.clone_brush is below.
The images were created by trying to use LuaSurface.clone_brush to clone part of a build (mostly just the belts) from one planet to another.
The first image shows the original build on the source planet: The second image shows the tiles that were attempted to be copied being placed with respect to the passed source_offset and destination_offset: The third image shows the entities that were attempted to be copied being placed with the exact same x/y coordinate as those of the entities on the original surface: The expected behavior would be that the tiles and entities are cloned to the same location, not different ones (and preferably to the location that the tiles are cloned to since that seems to be working currently).
Log here. Made a mistake and didn't include it originally. I am sorry.