[2.1.17] LuaRenderObject::dash_offset causes overextension when dash + gap > length

Post your bugs and problems so we can fix them.
User avatar
_CodeGreen
Fast Inserter
Fast Inserter
Posts: 110
Joined: Sat Mar 05, 2022 11:30 am
Contact:

[2.1.17] LuaRenderObject::dash_offset causes overextension when dash + gap > length

Post by _CodeGreen »

When gap_length and dash_length combined are larger than the actual length of the line, setting dash_offset to a higher value causes one of the dashes to overextend past the "to" target.

Reproduction:

Code: Select all

/c
local surface = game.player.surface
local a = surface.create_entity{name = "wooden-chest", position = {0, 0}}
local b = surface.create_entity{name = "wooden-chest", position = {2, 0}}
local render = rendering.draw_line{color = {1, 1, 1}, width = 4, from = a, to = b, surface = surface, gap_length = 1, dash_length = 7}
script.on_event(defines.events.on_tick, function(event)
    render.dash_offset = (event.tick % 120) / 120 * 8
end)
render.gif
render.gif (25.21 MiB) Viewed 39 times
My Mods | If you can't make it perfect, make it adjustable
Post Reply

Return to “Bug Reports”