mirror of
https://github.com/factoriolib/flib.git
synced 2025-09-04 08:26:22 +00:00
Properly update flib_direction.from_positions for 16 directions (#74)
This commit is contained in:

committed by
GitHub

parent
62a2b5c231
commit
b26ff4a7f6
@@ -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
|
||||
|
Reference in New Issue
Block a user