2017-07-14 20:12:28 +02:00
|
|
|
|
|
|
|
function run_shape_module(event)
|
2017-07-18 21:29:12 +02:00
|
|
|
local area = event.area
|
2017-07-14 20:12:28 +02:00
|
|
|
local surface = event.surface
|
|
|
|
local tiles = {}
|
2017-07-18 21:29:12 +02:00
|
|
|
|
2017-07-14 20:12:28 +02:00
|
|
|
top_left = area.left_top --make a more direct reference
|
2017-07-18 21:29:12 +02:00
|
|
|
|
2017-07-14 20:12:28 +02:00
|
|
|
--if top_left.y > 80 or top_left.x > 180 or top_left.x < -180 then
|
|
|
|
for x = top_left.x-1, top_left.x + 32 do
|
2017-07-18 21:29:12 +02:00
|
|
|
for y = top_left.y-1, top_left.y + 32 do
|
2017-07-14 20:12:28 +02:00
|
|
|
|
|
|
|
local distance = math.sqrt(x*x + y*y)
|
|
|
|
if distance > 128 then
|
|
|
|
local angle = (180 + math.deg(math.atan2(x,y)))*3
|
2017-07-18 21:29:12 +02:00
|
|
|
|
2017-07-14 20:12:28 +02:00
|
|
|
local offset = distance * 0.75
|
|
|
|
if angle ~= 0 then offset = offset + angle /3.75 end
|
|
|
|
--if angle ~= 0 then offset = offset + angle /1.33333333 end
|
2017-07-18 21:29:12 +02:00
|
|
|
|
2017-07-14 20:12:28 +02:00
|
|
|
if offset % 96 < 48 then
|
|
|
|
local offset2 = distance * 0.125
|
|
|
|
if angle ~= 0 then offset2 = offset2 - angle /3.75 end
|
2017-07-18 21:29:12 +02:00
|
|
|
|
2017-07-14 20:12:28 +02:00
|
|
|
if offset2 % 96 < 80 then
|
2017-07-18 21:29:12 +02:00
|
|
|
table.insert(tiles, {name = "out-of-map", position = {x,y}})
|
2017-07-14 20:12:28 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
surface.set_tiles(tiles)
|
2017-07-18 21:29:12 +02:00
|
|
|
|
2017-07-14 20:12:28 +02:00
|
|
|
--return false
|
|
|
|
--end
|
2017-07-18 21:29:12 +02:00
|
|
|
|
2017-07-14 20:12:28 +02:00
|
|
|
return true
|
2017-07-18 21:29:12 +02:00
|
|
|
end
|