1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2024-12-14 10:23:17 +02:00

Closes #32 - use Regrowth for cleanup iff enabled

Only use OarcRegrwothMarkForRemoval is ENABLE_REGROWTH is set; otherwise, use the old method to mark a spawn as unused.
This commit is contained in:
Will Crawford 2017-08-23 23:42:51 -07:00 committed by GitHub
parent 30c564442c
commit 85863cead2

View File

@ -68,12 +68,16 @@ function FindUnusedSpawns(event)
-- If a uniqueSpawn was created for the player, mark it as unused.
if (global.uniqueSpawns[player.name] ~= nil) then
-- table.insert(global.unusedSpawns, global.uniqueSpawns[player.name])
local spawnPos = global.uniqueSpawns[player.name].pos
global.uniqueSpawns[player.name] = nil
SendBroadcastMsg(player.name .. "'s base was marked for immediate clean up because they left within 15 minutes of joining.")
OarcRegrowthMarkForRemoval(spawnPos, 10)
global.chunk_regrow.force_removal_flag = game.tick
if ENABLE_REGROWTH then
local spawnPos = global.uniqueSpawns[player.name].pos
global.uniqueSpawns[player.name] = nil
SendBroadcastMsg(player.name .. "'s base was marked for immediate clean up because they left within 15 minutes of joining.")
OarcRegrowthMarkForRemoval(spawnPos, 10)
global.chunk_regrow.force_removal_flag = game.tick
else
table.insert(global.unusedSpawns, global.uniqueSpawns[player.name])
SendBroadcastMsg(player.name .. " base was freed up because they left within 5 minutes of joining.")
end
end
-- remove that player's cooldown setting