User:Darkfrei/script: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=== Add new oil patch === This creates 9 crude oil patches randomly without collisions: /c local position = nil for i=1,9 do position = game.player.surface.find_non_colli...") |
|||
Line 7: | Line 7: | ||
if position then | if position then | ||
game.player.surface.create_entity({name="crude-oil", amount=5000, position=position}) | game.player.surface.create_entity({name="crude-oil", amount=5000, position=position}) | ||
end | |||
end | |||
=== Respawn enemies === | |||
This creates one respawner every 32x32 tiles: | |||
/c local surface = game.player.surface | |||
for c in surface.get_chunks() do | |||
local position = surface.find_non_colliding_position("biter-spawner", {x=c.x*32+16, y=c.y*32+16}, 10, 3) | |||
if position and surface.is_chunk_generated(c) then | |||
surface.create_entity{name="biter-spawner", position=position} | |||
else | |||
end | end | ||
end | end |
Revision as of 20:25, 8 February 2017
Add new oil patch
This creates 9 crude oil patches randomly without collisions:
/c local position = nil for i=1,9 do position = game.player.surface.find_non_colliding_position("crude-oil", game.player.position, 0, i/2+1.5) if position then game.player.surface.create_entity({name="crude-oil", amount=5000, position=position}) end end
Respawn enemies
This creates one respawner every 32x32 tiles:
/c local surface = game.player.surface for c in surface.get_chunks() do local position = surface.find_non_colliding_position("biter-spawner", {x=c.x*32+16, y=c.y*32+16}, 10, 3) if position and surface.is_chunk_generated(c) then surface.create_entity{name="biter-spawner", position=position} else end end