diff --git a/control.lua b/control.lua index 6f7d3fd..971571c 100755 --- a/control.lua +++ b/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. --eg, x = 2 will throw an error because it's not global.x - setmetatable(_G, { - __newindex = function(_, n) - log("Attempt to write to undeclared var " .. n) - game.print("Attempt to write to undeclared var " .. n) - end - }) + -- setmetatable(_G, { + -- __newindex = function(_, n) + -- log("Attempt to write to undeclared var " .. n) + -- game.print("Attempt to write to undeclared var " .. n) + -- end + -- }) + -- -- THIS REQUIRES A LOT OF CHANGES TO RSO SOFT MOD... end) diff --git a/locale b/locale index 4aa9d1b..090cd0c 160000 --- a/locale +++ b/locale @@ -1 +1 @@ -Subproject commit 4aa9d1be1da2da485533d1d1e0bc9eb2c3b2aa69 +Subproject commit 090cd0ca6f9da52ceeffafd03d9a8dd7981a6505 diff --git a/regrowth_map.lua b/regrowth_map.lua index 8a6bfdd..e15e29d 100644 --- a/regrowth_map.lua +++ b/regrowth_map.lua @@ -17,7 +17,7 @@ -- 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. function OarcRegrowthInit() @@ -55,6 +55,24 @@ function OarcRegrowthChunkGenerate(event) global.chunk_regrow.num_chunks = global.chunk_regrow.num_chunks + 1 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. function OarcRegrowthOffLimits(pos, chunk_radius) diff --git a/separate_spawns.lua b/separate_spawns.lua index 1803830..5128f9e 100644 --- a/separate_spawns.lua +++ b/separate_spawns.lua @@ -68,8 +68,10 @@ 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]) - SendBroadcastMsg(player.name .. " base was freed up because they left within 5 minutes of joining.") + -- table.insert(global.unusedSpawns, global.uniqueSpawns[player.name]) + 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 -- remove that player's cooldown setting