Created by
Doug Freed
last modified
| (function()
place_array = {}
local place = function(x, y)
if #place_array % 1000 == 0 then
game.player.print("#place_array: " .. #place_array)
end
place_array[#place_array + 1] = {x, y}
end
local normal_row = function(sub_x, y)
for x=sub_x,sub_x+12,2 do
place(x, y)
end
end
local special_row = function(sub_x, y)
for x=sub_x,sub_x+4,2 do
place(x, y)
end
for x=sub_x+8,sub_x+12,2 do
place(x, y)
end
end
local row = function(sub_x, sub_y)
for y=sub_y,sub_y+12,2 do
if y == sub_y+6 then
special_row(sub_x, y)
else
normal_row(sub_x, y)
end
end
end
local full_length = function(sub_y)
for sub_x=-925,517,14 do
row(sub_x, sub_y)
end
end
local ends_only = function(sub_y)
row(-925, sub_y)
row(517, sub_y)
end
for sub_y=-925,517,14 do
if sub_y == -925 or sub_y == 517 then
full_length(sub_y)
else
ends_only(sub_y)
end
end
game.player.print("#place_array: " .. #place_array)
game.speed = 25
game.player.print("Calling script.on_event")
script.on_event(defines.events.on_tick, function(event)
if #place_array == 19776 then
game.players[1].print("first on_tick")
end
local pos = table.remove(place_array, #place_array)
game.surfaces.nauvis.create_entity{name="accumulator", position=pos, force=game.forces.player}
if #place_array == 0 then
game.players[1].print("on_tick done")
game.speed = 1
script.on_event(defines.events.on_tick, nil)
end
end)
end)()
|
| (function()
place_array = {}
local place = function(x, y)
if #place_array % 1000 == 0 then
game.player.print("#place_array: " .. #place_array)
end
place_array[#place_array + 1] = {x, y}
end
local normal_row = function(sub_x, y)
for x=sub_x,sub_x+13 do
place(x, y)
end
end
local special_row = function(sub_x, y)
for x=sub_x,sub_x+5 do
place(x, y)
end
for x=sub_x+8,sub_x+13 do
place(x, y)
end
end
local row = function(sub_x, sub_y)
for y=sub_y,sub_y+13 do
if y == sub_y+6 or y == sub_y+7 then
special_row(sub_x, y)
else
normal_row(sub_x, y)
end
end
end
local full_length = function(sub_y)
for sub_x=-939.5,530.5,14 do
row(sub_x, sub_y)
end
end
local ends_only = function(sub_y)
row(-939.5, sub_y)
row(530.5, sub_y)
end
for sub_y=-939.5,530.5,14 do
if sub_y == -939.5 or sub_y == 530.5 then
full_length(sub_y)
else
ends_only(sub_y)
end
end
game.player.print("#place_array: " .. #place_array)
game.speed = 25
game.player.print("Calling script.on_event")
script.on_event(defines.events.on_tick, function(event)
if #place_array == 19776 then
game.players[1].print("first on_tick")
end
local pos = table.remove(place_array, #place_array)
game.surfaces.nauvis.create_entity{name="small-lamp", position=pos, force=game.forces.player}
if #place_array == 0 then
game.players[1].print("on_tick done")
game.speed = 1
script.on_event(defines.events.on_tick, nil)
end
end)
end)()
|
| (function()
local start_x, start_y = -898.5, -898.5
place_array = {}
local place = function(x, y)
if #place_array % 10000 == 0 then
game.player.print("#place_array: " .. #place_array)
end
place_array[#place_array + 1] = {x, y}
end
local normal_row = function(y)
for x=start_x,502.5,3 do
place(x, y)
end
end
local special_row = function(y)
for i=0,1 do
place(start_x+3*i, y)
end
for i=0,98 do
for j=0,3 do
place(start_x+10+i*14+j*3, y)
end
end
for i=0,1 do
place(start_x+1398+i*3, y)
end
end
for i=0,33 do
for j=0,13 do
if i == 33 and j == 6 then
game.player.print("#place_array: " .. #place_array)
game.speed = 25
game.player.print("Calling script.on_event")
script.on_event(defines.events.on_tick, function(event)
if #place_array == 209912 then
game.players[1].print("first on_tick")
end
local pos = table.remove(place_array, #place_array)
game.surfaces.nauvis.create_entity{name="solar-panel", position=pos, force=game.forces.player}
if #place_array == 0 then
game.players[1].print("on_tick done")
game.speed = 1
script.on_event(defines.events.on_tick, nil)
end
end)
return
end
if j == 2 or j == 3 or j == 7 or j == 12 then
special_row(start_y+(i*14+j)*3)
else
normal_row(start_y+(i*14+j)*3)
end
end
end
end)()
|