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

Added a abandoned base removal that takes advantage of the regrowth map removal code. Disabled regrowth by default now.

This commit is contained in:
oarcinae 2017-11-08 09:13:34 -05:00
parent 896e2ad927
commit 351ae41d2b
5 changed files with 30 additions and 34 deletions

View File

@ -11,18 +11,18 @@
WELCOME_MSG = "[INSERT SERVER OWNER MSG HERE!]"
GAME_MODE_MSG = "In the current game mode, a satellite must be launched from an existing far away rocket silo to win!"
MODULES_ENABLED = "Mods Enabled: Separate Spawns, Regrowth, RSO, Long-Reach, Autofill, Undecorator, Player List"
MODULES_ENABLED = "Mods Enabled: Separate Spawns, RSO, Long-Reach, Autofill, Undecorator, Player List"
WELCOME_MSG_TITLE = "[INSERT SERVER OWNER MSG HERE!]"
WELCOME_MSG1 = "Rules: Be polite. Ask before changing other players's stuff. Have fun!"
WELCOME_MSG2 = "This server is running a custom scenario that changes spawn locations."
OTHER_MSG1 = "Latest updates in this scenario version (0.5.5):"
OTHER_MSG2 = "Regrowth release, done with beta testing."
OTHER_MSG2 = "Regrowth fixes (disabled). Abandoned base removal."
-- Optional other messages below:
OTHER_MSG3 = "Regrowth mode will slowly delete unused portions of the map."
OTHER_MSG4 = "If you re-explore deleted parts of the map, resources will be in new locations."
OTHER_MSG5 = "If you leave in the first 15 minutes, your base will be deleted!"
OTHER_MSG3 = "Standard multiplayer spawn allows spawning in far locations."
OTHER_MSG4 = "You can be on the main team or your own."
OTHER_MSG5 = "If you leave in the first 15 minutes, your base and character will be deleted!"
WELCOME_MSG3 = "Due to the way this scenario works, it may take some time for the land"
@ -38,7 +38,7 @@ SPAWN_MSG3 = "Resources are spread out far apart but are quite rich."
-- that creates the game.
SERVER_OWNER_IS_OARC = true -- This should be false for you, it's just a convenience for me.
WELCOME_MSG_OARC = "Welcome to Oarc's official server! Join the discord here: discord.gg/TPYxRrS"
WELCOME_MSG_TITLE_OARC = "Welcome to Oarc's Server - Regrowth!"
WELCOME_MSG_TITLE_OARC = "Welcome to Oarc's Server!"
--------------------------------------------------------------------------------
@ -66,10 +66,10 @@ ENABLE_UNDECORATOR = true
ENABLE_TAGS = true
-- Enable Long Reach
ENABLE_LONGREACH = true
ENABLE_LONGREACH = false
-- Enable Autofill
ENABLE_AUTOFILL = true
ENABLE_AUTOFILL = false
-- Enable Playerlist
ENABLE_PLAYER_LIST = true
@ -89,7 +89,11 @@ ENABLE_POWER_ARMOR_QUICK_START = false
ENABLE_SHARED_TEAM_VISION = true
-- Enable map regrowth, see regrowth_map.lua for more info.
ENABLE_REGROWTH = true
ENABLE_REGROWTH = false
-- If you have regrowth enabled, this should also be enabled.
-- It removes bases for players that join and leave the game quickly.
-- This can also be used without enabling regrowth.
ENABLE_ABANDONED_BASE_REMOVAL = true
--------------------------------------------------------------------------------
-- Spawn Options
@ -271,7 +275,7 @@ ENEMY_EXPANSION = false
-- Divide the alien factors by this number to reduce it (or multiply if < 1)
ENEMY_POLLUTION_FACTOR_DIVISOR = 10
ENEMY_DESTROY_FACTOR_DIVISOR = 5
ENEMY_DESTROY_FACTOR_DIVISOR = 10
--------------------------------------------------------------------------------

View File

@ -121,7 +121,7 @@ script.on_init(function(event)
SetServerWelcomeMessages()
if ENABLE_REGROWTH then
if ENABLE_REGROWTH or ENABLE_ABANDONED_BASE_REMOVAL then
OarcRegrowthInit()
end
@ -285,7 +285,11 @@ script.on_event(defines.events.on_tick, function(event)
end
if ENABLE_REGROWTH then
OarcRegrowthOnTick(event)
OarcRegrowthOnTick()
end
if ENABLE_ABANDONED_BASE_REMOVAL then
OarcRegrowthForceRemovalOnTick()
end
end)

View File

@ -1,18 +0,0 @@
# FactorioUtils
My softmod utilities for factorio
## Instructions
Include this repo inside a folder named "locale". This is the only folder that can be included in a scenario.
## Note
This is meant to be used with my own scenarios. It's hacky but convenient for myself.
## Credit
RSO is not my own creation. It was done by Orzelek. I requested permission to include it in my scenario.
https://mods.factorio.com/mods/orzelek/rso-mod
Several other portions of the code (tags, frontier style rocket silo) have also been adapted from other scenario code.
Credit to 3Ra as well: https://github.com/3RaGaming/3Ra-Enhanced-Vanilla

View File

@ -302,7 +302,7 @@ end
-- This is the main work function, it checks a single chunk in the list
-- per tick. It works according to the rules listed in the header of this
-- file.
function OarcRegrowthOnTick(event)
function OarcRegrowthOnTick()
-- Every half a second, refresh all chunks near a single player
-- Cyles through all players. Tick is offset by 2
@ -331,7 +331,12 @@ function OarcRegrowthOnTick(event)
SendBroadcastMsg("Map cleanup done...")
end
end
end
-- This function removes any chunks flagged but on demand.
-- Controlled by the global.chunk_regrow.force_removal_flag
-- This function may be used outside of the normal regrowth modse.
function OarcRegrowthForceRemovalOnTick()
-- Catch force remove flag
if (game.tick == global.chunk_regrow.force_removal_flag+60) then
SendBroadcastMsg("Map cleanup in 10 seconds...")

View File

@ -68,15 +68,16 @@ function FindUnusedSpawns(event)
-- If a uniqueSpawn was created for the player, mark it as unused.
if (global.uniqueSpawns[player.name] ~= nil) then
if ENABLE_REGROWTH then
if ENABLE_ABANDONED_BASE_REMOVAL 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.")
SendBroadcastMsg(player.name .. "'s base was marked for immediate clean up because they left within "..MIN_ONLINE_TIME_IN_MINUTES.." 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.")
global.uniqueSpawns[player.name] = nil
SendBroadcastMsg(player.name .. " base was freed up because they left within "..MIN_ONLINE_TIME_IN_MINUTES.." minutes of joining.")
end
end