Skip to content

Instantly share code, notes, and snippets.

@Glavak
Created April 19, 2019 11:54
Show Gist options
  • Save Glavak/9eb0a2fb9b9d5625dafdad0ffb816cd3 to your computer and use it in GitHub Desktop.
Save Glavak/9eb0a2fb9b9d5625dafdad0ffb816cd3 to your computer and use it in GitHub Desktop.
Скрипт для проверки производительности Factorio, для туториала https://youtu.be/L_uwDygZe48
/c
for _, ent in pairs(game.surfaces.nauvis.find_entities_filtered{name = 'transport-belt'}) do
ent.destroy()
end
for _, ent in pairs(game.surfaces.nauvis.find_entities_filtered{name = 'burner-inserter'}) do
ent.destroy()
end
for _, ent in pairs(game.surfaces.nauvis.find_entities_filtered{name = 'item-on-ground'}) do
ent.destroy()
end
for i = 1, 100000 do
for j = 1, 10 do
local position = {i*2, j}
if i % 2 == 0 then
game.surfaces.nauvis.create_entity {name = 'transport-belt', direction=defines.direction.north, position = position, force=game.player.force}
else
game.surfaces.nauvis.create_entity {name = 'transport-belt', direction=defines.direction.south, position = position, force=game.player.force}
end
game.surfaces.nauvis.create_entity {name = 'item-on-ground', position = position, stack={name="steel-plate"}, force=game.player.force}
end
end
for i = 1, 99999 do
if i % 2 == 0 then
local position = {i*2+1, 1}
ins = game.surfaces.nauvis.create_entity {name = 'burner-inserter', direction=defines.direction.west, position = position, force=game.player.force}
ins.insert{name="coal", count=100}
else
local position = {i*2+1, 10}
ins = game.surfaces.nauvis.create_entity {name = 'burner-inserter', direction=defines.direction.west, position = position, force=game.player.force}
ins.insert{name="coal", count=100}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment