[1.1.33] LuaSurface.clone_brush clones entities to the wrong location.

This subforum contains all the issues which we already resolved.
Post Reply
test447
Burner Inserter
Burner Inserter
Posts: 7
Joined: Wed May 05, 2021 8:11 am
Contact:

[1.1.33] LuaSurface.clone_brush clones entities to the wrong location.

Post by test447 »

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:
original.png
original.png (7.28 MiB) Viewed 2293 times
The second image shows the tiles that were attempted to be copied being placed with respect to the passed source_offset and destination_offset:
tile_placement.png
tile_placement.png (6.36 MiB) Viewed 2293 times
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:
entity_placement.png
entity_placement.png (7.08 MiB) Viewed 2293 times
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.
Attachments
factorio-current.log
(164.8 KiB) Downloaded 146 times

test447
Burner Inserter
Burner Inserter
Posts: 7
Joined: Wed May 05, 2021 8:11 am
Contact:

Re: [1.1.33] LuaSurface.clone_brush clones entities to the wrong location.

Post by test447 »

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.
factorio-current.log
(7.38 KiB) Downloaded 141 times
clone_brush.zip
(2.21 MiB) Downloaded 134 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.33] LuaSurface.clone_brush clones entities to the wrong location.

Post by Rseding91 »

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.

Post Reply

Return to “Resolved Problems and Bugs”