mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2024-12-12 10:13:58 +02:00
Rolling back RSO changes, pre global var catching mechanism
This commit is contained in:
parent
ce2b093471
commit
7fd373c7b6
13
control.lua
13
control.lua
@ -127,12 +127,13 @@ script.on_init(function(event)
|
|||||||
|
|
||||||
--If any (not global.) globals are written to at this point, an error will be thrown.
|
--If any (not global.) globals are written to at this point, an error will be thrown.
|
||||||
--eg, x = 2 will throw an error because it's not global.x
|
--eg, x = 2 will throw an error because it's not global.x
|
||||||
setmetatable(_G, {
|
-- setmetatable(_G, {
|
||||||
__newindex = function(_, n)
|
-- __newindex = function(_, n)
|
||||||
log("Attempt to write to undeclared var " .. n)
|
-- log("Attempt to write to undeclared var " .. n)
|
||||||
game.print("Attempt to write to undeclared var " .. n)
|
-- game.print("Attempt to write to undeclared var " .. n)
|
||||||
end
|
-- end
|
||||||
})
|
-- })
|
||||||
|
-- -- THIS REQUIRES A LOT OF CHANGES TO RSO SOFT MOD...
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
2
locale
2
locale
@ -1 +1 @@
|
|||||||
Subproject commit 4aa9d1be1da2da485533d1d1e0bc9eb2c3b2aa69
|
Subproject commit 090cd0ca6f9da52ceeffafd03d9a8dd7981a6505
|
@ -17,7 +17,7 @@
|
|||||||
-- 7. For now, oarc spawns are deletion safe as well, but only immediate area.
|
-- 7. For now, oarc spawns are deletion safe as well, but only immediate area.
|
||||||
|
|
||||||
|
|
||||||
REGROWTH_TIMEOUT_TICKS = 60*60*60 -- 1 hour
|
REGROWTH_TIMEOUT_TICKS = 60*10 -- 1 hour
|
||||||
|
|
||||||
-- Init globals and set player join area to be off limits.
|
-- Init globals and set player join area to be off limits.
|
||||||
function OarcRegrowthInit()
|
function OarcRegrowthInit()
|
||||||
@ -55,6 +55,24 @@ function OarcRegrowthChunkGenerate(event)
|
|||||||
global.chunk_regrow.num_chunks = global.chunk_regrow.num_chunks + 1
|
global.chunk_regrow.num_chunks = global.chunk_regrow.num_chunks + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Mark an area for removal
|
||||||
|
-- Intended to be used for cleaning abandoned spawns
|
||||||
|
function OarcRegrowthMarkForRemoval(pos, chunk_radius)
|
||||||
|
local c_pos = {x=pos.x-(pos.x % 32),
|
||||||
|
y=pos.y-(pos.y % 32)}
|
||||||
|
for i=-chunk_radius,chunk_radius do
|
||||||
|
for k=-chunk_radius,chunk_radius do
|
||||||
|
local x = c_pos.x+(i*32)
|
||||||
|
local y = c_pos.y+(k*32)
|
||||||
|
|
||||||
|
if (global.chunk_regrow.map[x] == nil) then
|
||||||
|
global.chunk_regrow.map[x] = {}
|
||||||
|
end
|
||||||
|
global.chunk_regrow.map[x][y] = 1
|
||||||
|
table.insert(global.chunk_regrow.list, c_pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Marks a safe area around around a position that won't ever be deleted.
|
-- Marks a safe area around around a position that won't ever be deleted.
|
||||||
function OarcRegrowthOffLimits(pos, chunk_radius)
|
function OarcRegrowthOffLimits(pos, chunk_radius)
|
||||||
|
@ -68,8 +68,10 @@ function FindUnusedSpawns(event)
|
|||||||
|
|
||||||
-- If a uniqueSpawn was created for the player, mark it as unused.
|
-- If a uniqueSpawn was created for the player, mark it as unused.
|
||||||
if (global.uniqueSpawns[player.name] ~= nil) then
|
if (global.uniqueSpawns[player.name] ~= nil) then
|
||||||
table.insert(global.unusedSpawns, global.uniqueSpawns[player.name])
|
-- table.insert(global.unusedSpawns, global.uniqueSpawns[player.name])
|
||||||
SendBroadcastMsg(player.name .. " base was freed up because they left within 5 minutes of joining.")
|
OarcRegrowthMarkForRemoval(global.uniqueSpawns[player.name].pos, 5)
|
||||||
|
|
||||||
|
SendBroadcastMsg(player.name .. " base was marked for clean up because they left within 5 minutes of joining.")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- remove that player's cooldown setting
|
-- remove that player's cooldown setting
|
||||||
|
Loading…
Reference in New Issue
Block a user