Code: Select all
-- Thanks to Loren1350 for helping me learn some of these settings!
-- constant amount of PUs that are eaten by the chunk
game.mapsettings.pollution.ageing = 1/256
-- this much PUs must be on the chunk to start diffusing
game.mapsettings.pollution.min_to_diffuse = 10
-- amount that is diffused to neighboring chunk
-- (possibly repeated for other directions as well)
game.mapsettings.pollution.diffusion_ratio = 5/256
-- percentual increase in the evolve factor for every second (60 ticks)
game.mapsettings.enemy_evolution.time_factor = 0
-- percentual increase in the evolve factor for every destroyed spawner
game.mapsettings.enemy_evolution.destroy_factor = 0
-- percentual increase in the evolve factor for 1000 PU
game.mapsettings.enemy_evolution.pollution_factor = 0.00001
-- Minimal distance of expansion point in chunks from player base
game.mapsettings.enemy_expansion.min_player_base_distance=0
require "defines"
function init()
if not glob.deadPlayers then
glob.deadPlayers = {}
end
end
game.oninit(init)
game.onload(init)
game.onevent(defines.events.onentitydied, function(event)
if event.entity.type == "player" then
for index, player in ipairs(game.players) do
if not player.character and not glob.deadPlayers[index] then
glob.deadPlayers[index] = true
break
end
end
end
end)
game.onevent(defines.events.ontick, function(event)
for playerIndex, value in pairs(glob.deadPlayers) do
local player = game.players[playerIndex]
if player.character then
if playerIndex % 2 == 0 then
local position = game.findnoncollidingposition("player", {-63,67}, 50, 1)
if position ~= nil then player.teleport(position) end
else
local position = game.findnoncollidingposition("player", {-159,-8105}, 50, 1)
if position ~= nil then player.teleport(position) end
end
glob.deadPlayers[playerIndex] = nil
end
end
end)
game.onevent(defines.events.onplayercreated, function(event)
local player = game.players[event.playerindex]
if player.character then
if event.playerindex % 2 == 0 then
local position = game.findnoncollidingposition("player", {-63,67}, 50, 1)
if position ~= nil then player.teleport(position) end
else
local position = game.findnoncollidingposition("player", {-159,-8105}, 50, 1)
if position ~= nil then player.teleport(position) end
end
end
end)