Properly update flib_direction.from_positions for 16 directions (#74)

This commit is contained in:
Patrick 'Quezler' Mounier
2024-10-31 08:33:19 +01:00
committed by GitHub
parent 62a2b5c231
commit b26ff4a7f6

View File

@@ -92,7 +92,7 @@ end
--- @return defines.direction
function flib_direction.from_positions(source, target, round)
local deg = math.deg(math.atan2(target.y - source.y, target.x - source.x))
local direction = (deg + 90) / 45
local direction = (deg + 90) / 22.5
if direction < 0 then
direction = direction + 16
end