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.
[1.1.33] LuaSurface.clone_brush clones entities to the wrong location.
[1.1.33] LuaSurface.clone_brush clones entities to the wrong location.
- Attachments
-
- factorio-current.log
- (164.8 KiB) Downloaded 165 times
Re: [1.1.33] LuaSurface.clone_brush clones entities to the wrong location.
Actually I made a mistake in not testing this without any mods installed. Here is a savefile and a log for how to repro the issue with no mods.
Run this command `/c game.surfaces[1].clone_brush{source_offset={0,0},destination_offset={-10,-10},source_positions={{34,30},{34,29},{34,31},{33,30},{33,29},{33,30}},clone_entities=true,clone_tiles=true}` on the map.
You will notice that the furnace gets duplicated. Try mining it. It will be able to be mined twice.
This is unexpected. Expected behavior would be for another furnace to show up 10 tiles away (up and to the left) (not in the same spot).
If you look carefully after running the command, the tiles below the furnace (the light brown) will replace the darker brown 10 tiles away (up and to the left).
Meaning that the tiles were cloned to the right position, but not the entity.
Run this command `/c game.surfaces[1].clone_brush{source_offset={0,0},destination_offset={-10,-10},source_positions={{34,30},{34,29},{34,31},{33,30},{33,29},{33,30}},clone_entities=true,clone_tiles=true}` on the map.
You will notice that the furnace gets duplicated. Try mining it. It will be able to be mined twice.
This is unexpected. Expected behavior would be for another furnace to show up 10 tiles away (up and to the left) (not in the same spot).
If you look carefully after running the command, the tiles below the furnace (the light brown) will replace the darker brown 10 tiles away (up and to the left).
Meaning that the tiles were cloned to the right position, but not the entity.
Re: [1.1.33] LuaSurface.clone_brush clones entities to the wrong location.
Thanks for the report. It's now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.