starting spawn

This commit is contained in:
Brevven 2022-12-04 16:16:26 -08:00
parent bd292e4489
commit b78485eaa5
5 changed files with 26 additions and 1 deletions

View file

@ -14,3 +14,18 @@ function on_console_chat(event)
end
end
script.on_event(defines.events.on_console_chat, on_console_chat)
function on_init()
if global.starting_spawn then return end
if settings.global["bzgas-force-spawn"].value then
local gas = game.surfaces["nauvis"].find_entities_filtered({area = {{-100, -100}, {100, 100}}, name="gas"})
if #gas == 0 then
local position=game.surfaces["nauvis"].find_non_colliding_position("gas", {math.random(-100,100),math.random(-100,100)}, 0, 1)
if position then
game.surfaces["nauvis"].create_entity({name="gas", amount=math.random(400000, 999999), position=position})
end
end
end
global.starting_spawn = true
end
script.on_init(on_init)