mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
6aed6d6317
Add map loader
22 lines
562 B
Lua
22 lines
562 B
Lua
-- Author: flowild
|
|
|
|
local arm_width = 96
|
|
|
|
local function is_on_spiral(x, y, distance, angle_offset)
|
|
local angle = angle_offset + math.deg(math.atan2(x, y))
|
|
|
|
local offset = distance
|
|
if angle ~= 0 then
|
|
offset = offset + angle / 3.75 * 2
|
|
end
|
|
return offset % 96 * 2 >= 48 * 2
|
|
end
|
|
|
|
return function(x, y)
|
|
local pseudo_x = x / (arm_width / 48)
|
|
local pseudo_y = y / (arm_width / 48)
|
|
local distance = math.sqrt(pseudo_x * pseudo_x + pseudo_y * pseudo_y)
|
|
|
|
return not (distance > 100 and not is_on_spiral(x, y, distance, 0))
|
|
end
|