[2.0.72] LuaSurface::clone_area skips some trees on ore during cloning

Post your bugs and problems so we can fix them.
Data
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Nov 23, 2024 10:36 am
Contact:

[2.0.72] LuaSurface::clone_area skips some trees on ore during cloning

Post by Data »

What did you do?
  • Run Factorio 2.0.72, base game without mods and without Space age DLC
  • Single Player > New Game > Freeplay
  • Set seed to 4288898516 (any seed will work, but you need to find an ore patch with fair amount of trees over it)
  • Start the game with default settings
  • Skip the cutscene
  • Run the command (twice to suppress achievements disable warning):

    Code: Select all

    /editor
  • Run the command, which will position you on an ore patch with some trees:

    Code: Select all

    /c game.player.teleport({255,560})
  • Don't move and wait for nearby chunks to be generated
  • Run the command, which will copy using LuaSurface::clone_area the middle of the observed area to the right side and create some out-of-map gaps for easier visual inspection:

    Code: Select all

    /c
    local pos = {x = math.floor(game.player.position.x), y = math.floor(game.player.position.y)}
    
    local size = 64
    local gap = 8
    
    local area = {left_top = {pos.x - size/2, pos.y - size/2}, right_bottom = {pos.x + size/2, pos.y + size/2},}
    local dest_area = {
        left_top = {area.left_top[1] + size + gap, area.left_top[2]},
        right_bottom = {area.right_bottom[1] + size + gap, area.right_bottom[2]},
    }
    
    local gap_tiles = {}
    for y = 0, size-1 do
        for x = 0, gap-1 do
            gap_tiles[#gap_tiles+1] = { name = 'out-of-map', position = { area.left_top[1] - gap + x, area.left_top[2] + y } }
        end
    end
    for y = 0, size-1 do
        for x = 0, gap-1 do
            gap_tiles[#gap_tiles+1] = { name = 'out-of-map', position = { area.right_bottom[1] + x, area.left_top[2] + y } }
        end
    end
    for y = 0, size-1 do
        for x = 0, gap-1 do
            gap_tiles[#gap_tiles+1] = { name = 'out-of-map', position = { dest_area.right_bottom[1] + x, dest_area.left_top[2] + y } }
        end
    end
    game.player.surface.set_tiles(gap_tiles)
    
    local request = {
        source_area = area,
        destination_area = dest_area,
        destination_surface = game.player.surface,
        clone_tiles = true,
        clone_entities = true,
        clone_decoratives = true,
        clear_destination_entities = true,
        clear_destination_decoratives = true,
        create_build_effect_smoke = false,
        expand_map = true,
    }
    game.player.surface.clone_area(request)
    
  • Observe how destination area has less trees on ore patch than original source area
What happened?
LuaSurface::clone_area has failed to properly clone trees on ore (see screenshots attached)

What did you expect to happen instead?
All trees are copied

Does it happen always, once, or sometimes?
It always happens, but unfortunately it's not 1-to-1 reproducible on default map generation duo to this bug, which was marked as duplicate of another bug

Notes
  • Bug is reproducible in it's nature, you can save before running the last command, reload and run the command again: given same ores and trees it will fail to clone the same trees. But if you run the command without reloading (effectively overriding the copy of the original area), each time clone_area will skip different trees
  • Seems like trees outside of ore are unaffected and properly cloned
  • Painfully resembles already mentioned bug
Attachments
no markers.png
no markers.png (1.09 MiB) Viewed 81 times
markers.png
markers.png (1.13 MiB) Viewed 81 times
Post Reply

Return to “Bug Reports”