1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2024-12-04 09:43:00 +02:00

MAJOR work to do conversion to a proper mod! Started to connect surface selection in GUI to implementation.

This commit is contained in:
Oarcinae 2024-08-16 01:40:16 -04:00
parent b462f17659
commit f3e04c88ce
26 changed files with 1104 additions and 966 deletions

244
control.lua Normal file
View File

@ -0,0 +1,244 @@
-- control.lua
-- Aug 2024
-- ____ _____ _____
-- / __ \ /\ | __ \ / ____|
-- | | | | / \ | |__) | |
-- | | | |/ /\ \ | _ /| |
-- | |__| / ____ \| | \ \| |____
-- \____/_/ \_\_| \_\\_____|
-- Oarc's Separated Spawn MOD V2
-- I decided to rewrite my old scenario due to the coming changes in Factorio V2.0 and its new Space Age Expansion.
-- Change Overview:
-- Support the scenario "as a mod" ONLY. Scenario merely provides a way to overwrite settings on_init.
-- Removed a lot of unnecessary feature bloat.
-- Move text to locale files where possible.
-- Feature List:
-- Core feature allows for a safe, separate spawn area for each player.
-- Players can choose to spawn with friends (buddy spawn) or join other bases.
-- Offline protection from enemy attacks.
-- Chunk cleanup to keep save file size down.
-- (TENTATIVE) Support for multiple vanilla-style spawn points.
-- TODO NOTES:
-- Add more tooltips?!
-- on_runtime_mod_setting_changed
-- Start Flow:
-- Display scenario welcome info.
-- Display main spawn options.
-- Display buddy spawn options. (OPTIONAL)
-- Create spawn area.
-- Send player to spawn area.
-- Options Menu:
-- Display scenario info. (Dupe of welcome info?)
-- Admin tools to restart or ban players.
-- Personal settings for player (Allow shared base)
require("lib/oarc_utils")
require("lib/config")
require("lib/config_parser")
require("lib/game_opts")
require("lib/regrowth_map")
require("lib/holding_pen")
require("lib/separate_spawns")
require("lib/separate_spawns_guis")
require("lib/oarc_gui_tabs")
--------------------------------------------------------------------------------
-- On Init - Only runs once the first time the game starts
--------------------------------------------------------------------------------
script.on_init(function(event)
ValidateAndLoadConfig()
RegrowthInit()
-- Test create some other surfaces
-- TODO: Remove this later.
game.create_surface("vulcanus")
game.create_surface("fulgora")
game.create_surface("gleba")
game.create_surface("aquilo")
InitSpawnGlobalsAndForces()
CreateHoldingPenSurface() -- Must be after init spawn globals?
-- Useful for debugging and if players choose not to use the provided empty scenario.
if remote.interfaces["freeplay"] then
log("Freeplay interface detected. Disabling various freeplay features now!")
remote.call("freeplay", "set_skip_intro", true)
remote.call("freeplay", "set_disable_crashsite", true)
remote.call("freeplay", "set_created_items", {})
remote.call("freeplay", "set_respawn_items", {})
end
end)
----------------------------------------
-- Player Events
----------------------------------------
script.on_event(defines.events.on_player_created, function(event)
local player = game.players[event.player_index]
player.teleport({x=0,y=0}, HOLDING_PEN_SURFACE_NAME)
SeparateSpawnsInitPlayer(event.player_index, true)
end)
script.on_event(defines.events.on_player_respawned, function(event)
SeparateSpawnsPlayerRespawned(event)
end)
script.on_event(defines.events.on_player_left_game, function(event)
SeparateSpawnsPlayerLeft(event)
end)
----------------------------------------
-- On tick events. Stuff that needs to happen at regular intervals.
-- Delayed events, delayed spawns, ...
----------------------------------------
script.on_event(defines.events.on_tick, function(event)
DelayedSpawnOnTick()
FadeoutRenderOnTick()
if global.ocfg.regrowth.enable_regrowth then
RegrowthOnTick()
RegrowthForceRemovalOnTick()
end
end)
----------------------------------------
-- Chunk Generation
----------------------------------------
script.on_event(defines.events.on_chunk_generated, function(event)
CreateHoldingPenChunks(event.surface, event.area)
SeparateSpawnsGenerateChunk(event)
-- TODO: Decide if this should always be enabled (to track chunks).
if global.ocfg.regrowth.enable_regrowth then
RegrowthChunkGenerate(event)
end
end)
script.on_event(defines.events.on_sector_scanned, function (event)
if global.ocfg.regrowth.enable_regrowth then
RegrowthSectorScan(event)
end
end)
----------------------------------------
-- Surface Generation
----------------------------------------
-- This is not called when the default surface "nauvis" is created as it will always exist!
script.on_event(defines.events.on_surface_created, function(event)
log("Surface created: " .. game.surfaces[event.surface_index].name)
SeparateSpawnsSurfaceCreated(event)
-- RegrowthSurfaceCreated(event)
end)
script.on_event(defines.events.on_surface_deleted, function(event)
log("Surface deleted: " .. game.surfaces[event.surface_index].name)
SeparateSpawnsSurfaceDeleted(event)
-- RegrowthSurfaceDeleted(event)
end)
----------------------------------------
-- Various on "built" events
----------------------------------------
script.on_event(defines.events.on_built_entity, function(event)
if global.ocfg.regrowth.enable_regrowth then
-- if (event.created_entity.surface.name ~= GAME_SURFACE_NAME) then return end
RegrowthMarkAreaSafeGivenTilePos(event.created_entity.position, 2, false)
end
-- if global.ocfg.enable_anti_grief then
-- SetItemBlueprintTimeToLive(event)
-- end
end)
script.on_event(defines.events.on_robot_built_entity, function (event)
if global.ocfg.regrowth.enable_regrowth then
-- if (event.created_entity.surface.name ~= GAME_SURFACE_NAME) then return end
RegrowthMarkAreaSafeGivenTilePos(event.created_entity.position, 2, false)
end
end)
script.on_event(defines.events.on_player_built_tile, function (event)
if global.ocfg.regrowth.enable_regrowth then
-- if (game.surfaces[event.surface_index].name ~= GAME_SURFACE_NAME) then return end
for k,v in pairs(event.tiles) do
RegrowthMarkAreaSafeGivenTilePos(v.position, 2, false)
end
end
end)
----------------------------------------
-- On script_raised_built. This should help catch mods that
-- place items that don't count as player_built and robot_built.
-- Specifically FARL.
----------------------------------------
script.on_event(defines.events.script_raised_built, function(event)
if global.ocfg.regrowth.enable_regrowth then
-- if (event.entity.surface.name ~= GAME_SURFACE_NAME) then return end
RegrowthMarkAreaSafeGivenTilePos(event.entity.position, 2, false)
end
end)
----------------------------------------
-- On Entity Spawned and On Biter Base Built
-- This is where I modify biter spawning based on location and other factors.
----------------------------------------
script.on_event(defines.events.on_entity_spawned, function(event)
if (global.ocfg.gameplay.modified_enemy_spawning) then
ModifyEnemySpawnsNearPlayerStartingAreas(event)
end
end)
script.on_event(defines.events.on_biter_base_built, function(event)
if (global.ocfg.gameplay.modified_enemy_spawning) then
ModifyEnemySpawnsNearPlayerStartingAreas(event)
end
end)
----------------------------------------
-- Gui Events
----------------------------------------
script.on_event(defines.events.on_gui_click, function(event)
WelcomeTextGuiClick(event)
SpawnOptsGuiClick(event)
SpawnCtrlGuiClick(event)
SharedSpwnOptsGuiClick(event)
BuddySpawnOptsGuiClick(event)
BuddySpawnWaitMenuClick(event)
BuddySpawnRequestMenuClick(event)
SharedSpawnJoinWaitMenuClick(event)
ClickOarcGuiButton(event)
GameOptionsGuiClick(event)
end)
--- Called when LuaGuiElement checked state is changed (related to checkboxes and radio buttons).
script.on_event(defines.events.on_gui_checked_state_changed, function (event)
SpawnOptsRadioSelect(event)
SpawnCtrlGuiOptionsSelect(event)
end)
script.on_event(defines.events.on_gui_selected_tab_changed, function (event)
TabChangeOarcGui(event)
end)
-- For capturing player escaping custom GUI so we can close it using ESC key.
script.on_event(defines.events.on_gui_closed, function(event)
OarcGuiOnGuiClosedEvent(event)
end)
local oarc_mod_interface =
{
get_mod_settings = function()
return OCFG
end
}
remote.add_interface("oarc_mod", oarc_mod_interface)

View File

@ -1,12 +1,13 @@
4. Go through separate spawns code carefully and make sure it can support MULTIPLE SURFACES!
8. Add multiple surfaces to Spawn GUI (Drop down selection?)
9. Add multiple surfaces to all core code
10. Check and update all functions using surfaces to clearly use either the LuaSurface obj OR a string name.
11. Expose more config options in admin GUI
12. Tooltips for GUI elements in spawn menu options!
13. Change Near/Far buttons to radio selection w/ text explanation and have a single Spawn button.
14. Configurable welcome/server messages in admin GUI.
8. Check and update all functions using surfaces to clearly use either the LuaSurface obj OR a string name.
9. Expose more config options in admin GUI
10. Tooltips for GUI elements in spawn menu options!
11. Change Near/Far buttons to radio selection w/ text explanation and have a single Spawn button.
13.
14.
Other Ideas, Not Committed:
Add option to spawn on existing chunks (look for chunks with any entities in them, or use regrowth logic)
@ -22,5 +23,8 @@ Separate chest sharing and electricity ()
5. (DONE) Document config and mod settings using Lua annotation as a custom class
6. (DONE) Document global ocore as a custom class (with subclasses/types as needed)
7. (DONE) Add multiple surfaces to options/settings [As a single boolean.]
15. (DONE) Convert scenario to a mod.
4. (DONE) Add multiple surfaces to Spawn GUI (Drop down selection?)
12. (DONE) Configurable welcome/server messages in mod settings.
(DONE) Figure out how to define custom lua table/data structs to make syntax/linting work?

View File

@ -7,5 +7,5 @@
"contact": "Mod Discussion Page, oarcinae@gmail.com, Discord:oarc",
"homepage": "https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn",
"description": "[[Description is in locale file!]]",
"dependencies": ["base >= 1.1.0"]
"dependencies": ["base >= 1.1.0", "? dangOreus"]
}

View File

@ -7,38 +7,18 @@
| |\/| | (_) | |) | \ \/\/ / _ \| / .` || || .` | (_ |
|_| |_|\___/|___/ \_/\_/_/ \_\_|_\_|\_|___|_|\_|\___|
IF YOU ARE USING THE MOD VERSION OF THIS SCENARIO, DO NOT EDIT THIS FILE!
If you want to customize this, copy JUST the scenario folder to your scenarios folder.
DO NOT EDIT THIS FILE! If you want to customize this, edit the config-scenario.lua file and load that scenario!
]]
-- This file provides a way to configure the scenario settings.
-- More settings are available here than are provided in the mod settings.
-- This is where you can modify what resources spawn, how much, where, etc.
-- Once you have a config you like, it's a good idea to save it for later use so you don't lose it if you update the
-- scenario. I will try to avoid making breaking changes to this, but no guarantees.
-- More settings are available here than are provided in the mod settings menu.
-- Additionally, many settings are exposed in the game itself and can be chanced once you launch.
-- For convenience you can provide you own config-scenario.lua file in the scenarios/OARC folder to override these settings.
---@type OarcConfigStartingItems
NAUVIS_STARTER_ITEMS =
{
-- Add a crashed ship like a vanilla game (create_crash_site)
-- Resources go in the ship itself. (5 slots max!)
-- Wreakage is distributed in small pieces. (I recommend only 1 item type.)
crashed_ship = true,
crashed_ship_resources = {
["electronic-circuit"] = 200,
["iron-gear-wheel"] = 100,
["copper-cable"] = 200,
["steel-plate"] = 100
},
crashed_ship_wreakage = {
["iron-plate"] = 100
},
-- Items provided to the player the first time they join
player_spawn_start_items = {
player_start_items = {
["pistol"]=1,
["firearm-magazine"]=200,
["iron-plate"]=100,
@ -47,12 +27,21 @@ NAUVIS_STARTER_ITEMS =
["coal"] = 50,
["stone"] = 50,
},
-- Items provided after EVERY respawn (disabled by default)
player_respawn_start_items = {
player_respawn_items = {
-- ["pistol"]=1,
-- ["firearm-magazine"]=100,
},
crashed_ship = true,
crashed_ship_resources = {
["electronic-circuit"] = 200,
["iron-gear-wheel"] = 100,
["copper-cable"] = 200,
["steel-plate"] = 100
},
crashed_ship_wreakage = {
["iron-plate"] = 100 -- I don't recommend more than 1 item type here!
},
}
---@type OarcConfigSpawn
@ -60,11 +49,9 @@ NAUVIS_SPAWN_CONFIG =
{
general = {
---TODO: Rename land_area_tiles to spawn_circle_size or something more descriptive.
-- THIS IS WHAT SETS THE SPAWN CIRCLE SIZE!
-- Create a circle of land area for the spawn
-- If you make this much bigger than a few chunks, good luck.
land_area_tiles = CHUNK_SIZE*2,
spawn_radius_tiles = CHUNK_SIZE*2,
-- If you change the spawn area size, you might have to adjust this as well
moat_size_modifier = 1,
@ -114,8 +101,8 @@ NAUVIS_SPAWN_CONFIG =
resource_rand_pos_settings =
{
-- Autoplace resources (randomly in circle)
-- This will ignore the fixed x_offset/y_offset values in resource_tiles.
-- Only works for resource_tiles at the moment, not oil patches/water.
-- This will ignore the fixed x_offset/y_offset values in solid_resources.
-- Only works for solid_resources at the moment, not oil patches/water.
enabled = true,
-- Distance from center of spawn that resources are placed.
radius = 45,
@ -128,11 +115,9 @@ NAUVIS_SPAWN_CONFIG =
angle_final = 4.46 -- 4.46 is approx NNW.
},
-- TODO: Rename resources tiles to solid resources and resource_patches to fluid resources.
-- Resource tiles
-- Solid resource tiles
-- If you are running with mods that add or change resources, you'll want to customize this.
resource_tiles = {
solid_resources = {
["iron-ore"] = {
amount = 1500,
size = 18,
@ -156,38 +141,12 @@ NAUVIS_SPAWN_CONFIG =
size = 16,
x_offset = -27,
y_offset = -20
}--,
-- ["uranium-ore"] =
-- {
-- amount = 0,
-- size = 0,
-- x_offset = 17,
-- y_offset = -34
-- }
-- ####### Bobs + Angels #######
-- DISABLE STARTING OIL PATCHES!
-- Coal = coal
-- Saphirite = angels-ore1
-- Stiratite = angels-ore3
-- Rubyte = angels-ore5
-- Bobmonium = angels-ore6
-- ########## Bobs Ore ##########
-- Iron = iron-ore
-- Copper = copper-ore
-- Coal = coal
-- Stone = stone
-- Tin = tin-ore
-- Lead (Galena) = lead-ore
-- See https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn/issues/11#issuecomment-479724909
-- for full examples.
}
},
-- Fluid resource patches like oil
-- If you are running with mods that add or change resources, you'll want to customize this.
resource_patches =
fluid_resources =
{
["crude-oil"] =
{
@ -201,18 +160,32 @@ NAUVIS_SPAWN_CONFIG =
},
}
---@type OarcConfigSurface
NAUVIS_SURFACE_CONFIG =
{
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
}
---@type OarcConfig
OCFG = {
-- Mod Settings
-- These settings will be overridden by the mod settings IF you are using the mod version of this scenario.
-- If you're using the mod, you shouldn't be messing with this file anyway.
mod_overlap = {
-- Server Info - This stuff is shown in the welcome GUI and Info panel.
---@type OarcConfigServerInfo
server_info = {
welcome_msg_title = "OARC V2 - TEST SERVER",
welcome_msg = "TEMPORARY BETA TESTING OF V2 MOD!", -- Printed to player on join as well.
server_msg = "Rules: Be polite. Ask before changing other players's stuff. Have fun!\n"..
"This server is running a custom mod that allows individual starting areas on the map."
},
-- General gameplay related settings that I didn't want to expose in the mod settings since these should
-- basically always be enabled unless you're making serious changes.
gameplay = {
-- At least one of these must be enabled! (enable_main_team and enable_separate_teams)
-- Otherwise we default to enable_main_team = true
-- Allow all players to join a primary force(team).
enable_main_team = true,
@ -222,41 +195,6 @@ OCFG = {
-- Enable spawning on other surfaces other than the default "nauvis".
enable_spawning_on_other_surfaces = true,
-- This allows 2 players to spawn next to each other, each with their own starting area.
enable_buddy_spawn = true,
-- TODO: Vanilla spawn point are not implemented yet.
-- enable_vanilla_spawn_points = true,
-- number_of_vanilla_spawn_points = 10,
-- vanilla_spawn_point_spacing = 100,
-- Cleans up unused chunks periodically. Helps keep map size down.
-- See description in regrowth_map.lua for more details.
enable_regrowth = false,
-- This inhibits enemy attacks on bases where all players are offline. Not 100% guaranteed!
enable_offline_protection = true,
-- Enable shared vision between teams (all teams are COOP regardless)
enable_shared_team_vision = true,
-- Share local team chat with all teams
-- This makes it so you don't have to use /s
-- But it also means you can't talk privately with your own team.
enable_shared_team_chat = true,
-- Enable if players can allow others to join their base.
-- And specify how many including the host are allowed.
enable_shared_spawns = true,
number_of_players_per_shared_spawn = 3,
-- This removes player bases when they leave shortly after joining.
-- TODO: verify if this requires regrowth to be enabled!
enable_abandoned_base_cleanup = true,
-- I like keeping this off... set to true if you want to shoot your own chests and stuff.
enable_friendly_fire = true,
-- Allow players to choose to spawn with a moat
allow_moats_around_spawns = true,
@ -279,28 +217,39 @@ OCFG = {
-- This is the distance in chunks to the origin.
far_spawn_min_distance = 500,
far_spawn_max_distance = 1000,
},
-- Server Info
server_info = {
-- This allows 2 players to spawn next to each other, each with their own starting area.
enable_buddy_spawn = true,
-- This stuff is shown in the welcome GUI and Info panel. Make sure it's valid.
welcome_msg_title = "OARC V2 - TEST SERVER",
welcome_msg = "TEMPORARY BETA TESTING OF V2 MOD & SCENARIO!", -- Printed to player on join as well.
server_msg = "Rules: Be polite. Ask before changing other players's stuff. Have fun!\n"..
"This server is running a custom scenario that allows individual starting areas on the map."
-- TODO: Vanilla spawn point are not implemented yet.
-- enable_vanilla_spawn_points = true,
-- number_of_vanilla_spawn_points = 10,
-- vanilla_spawn_point_spacing = 100,
},
-- This inhibits enemy attacks on bases where all players are offline. Not 100% guaranteed!
enable_offline_protection = true,
-- General gameplay related settings that I didn't want to expose in the mod settings since these should
-- basically always be enabled unless you're making serious changes.
gameplay = {
-- Enable shared vision between teams (all teams are COOP regardless)
enable_shared_team_vision = true,
-- Share local team chat with all teams
-- This makes it so you don't have to use /s
-- But it also means you can't talk privately with your own team.
enable_shared_team_chat = true,
-- Enable if players can allow others to join their base.
-- And specify how many including the host are allowed.
enable_shared_spawns = true,
number_of_players_per_shared_spawn = 3,
-- I like keeping this off... set to true if you want to shoot your own chests and stuff.
enable_friendly_fire = true,
-- The name of the main force.
main_force_name = "Main Force",
-- The starting surface of the main force.
main_force_surface = "nauvis",
-- The default starting surface.
default_surface = "nauvis",
-- This scales resources so that even if you spawn "far away" from the center
-- of the map, resources near to your spawn point scale so you aren't
@ -312,7 +261,7 @@ OCFG = {
-- more balanced based on your distance and makes the game a little easier.
-- No behemoth worms everywhere just because you spawned far away.
-- If you're trying out the vanilla spawning, you might want to disable this.
oarc_modified_enemy_spawning = true,
modified_enemy_spawning = true,
-- Require playes to be online for at least X minutes
-- Else their character is removed and their spawn point is freed up for use
@ -322,25 +271,51 @@ OCFG = {
-- Respawn cooldown in minutes.
respawn_cooldown_min = 15,
},
-- This is a separate feature that is part of the mod that helps keep the map size down. Not required but useful.
regrowth = {
-- Cleans up unused chunks periodically. Helps keep map size down.
-- See description in regrowth_map.lua for more details.
enable_regrowth = false,
-- This is part of regrowth, and if both are enabled, any chunks which aren't active and have no entities
-- will eventually be deleted over time. If this is disabled, any chunk with a player built entity will be
-- marked permanently safe even if it is removed at a later time.
-- DO NOT USE THIS WITH MODS! (unless you know what you're doing?)
enable_world_eater = false,
-- This removes player bases when they leave shortly after joining.
-- TODO: verify if this requires regrowth to be enabled!
enable_abandoned_base_cleanup = true,
},
-- Starting ITEMS given to the player or placed near the player spawn point.
starting_items = NAUVIS_STARTER_ITEMS,
-- Spawn area configuration. Change size, resources, shape, etc.
spawn_config = NAUVIS_SPAWN_CONFIG
}
---@type OarcConfigSurface
NAUVIS_SURFACE_CONFIG =
{
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
-- Spawn configuration (starting items and spawn area config) for each surface.
---@type table<string, OarcConfigSurface>
surfaces_config =
{
["nauvis"] = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
},
["vulcanus"] = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
},
["fulgora"] = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
},
["gleba"] = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
},
["aquilo"] = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
}
},
}
@ -359,25 +334,20 @@ NAUVIS_SURFACE_CONFIG =
]]
---@class OarcConfig
---@field mod_overlap OarcConfigModSettings
---@field server_info OarcConfigServerInfo
---@field gameplay OarcConfigGameplaySettings
---@field starting_items OarcConfigStartingItems
---@field spawn_config OarcConfigSpawn
---@field server_info OarcConfigServerInfo Personalized server info for the welcome GUI and Info panel.
---@field gameplay OarcConfigGameplaySettings Various mod gameplay settings
---@field regrowth OarcConfigRegrowth Regrowth specific settings (keeps map size down)
---@field surfaces_config table<string, OarcConfigSurface> Spawn configuration (starting items and spawn area config) for each surface.
---@class OarcConfigModSettings
---@class OarcConfigServerInfo
---@field welcome_msg_title string Title of welcome GUI window.
---@field welcome_msg string Main welcome message. (Should provide mod info.)
---@field server_msg string Server specific message. (Rules, etc.)
---@class OarcConfigGameplaySettings
---@field enable_main_team boolean Allows all players to join a primary force(team).
---@field enable_separate_teams boolean Allows players to create their own force(team).
---@field enable_spawning_on_other_surfaces boolean Enable spawning on other surfaces other than the default.
---@field enable_buddy_spawn boolean Allow 2 players to spawn next to each other, each with their own starting area.
---@field enable_regrowth boolean Cleans up unused chunks periodically. Helps keep map size down.
---@field enable_offline_protection boolean Inhibits enemy attacks on bases where all players are offline. Not 100% guaranteed!
---@field enable_shared_team_vision boolean Enable shared vision between teams (all teams are COOP regardless)
---@field enable_shared_team_chat boolean Share local team chat with all teams
---@field enable_shared_spawns boolean Enable if players can allow others to join their spawn.
---@field number_of_players_per_shared_spawn number Number of players allowed to join a shared spawn.
---@field enable_abandoned_base_cleanup boolean Removes player bases when they leave shortly after joining.
---@field enable_friendly_fire boolean Set to true if you want to shoot your own chests and stuff.
---@field allow_moats_around_spawns boolean Allow players to choose to spawn with a moat
---@field enable_moat_bridging boolean If there is a moat, this makes a small path to land to avoid "turtling", but if the spawn is in the middle of water, it won't do anything.
---@field minimum_distance_to_existing_chunks number The radius, in chunks, that a spawn area is from any other generated chunks. It ensures the spawn area isn't too near generated/explored/existing area.
@ -385,42 +355,47 @@ NAUVIS_SURFACE_CONFIG =
---@field near_spawn_max_distance number When a player selects "near" spawn, they will be within or as close to this range as possible.
---@field far_spawn_min_distance number When a player selects "far" spawn, they will be AT LEAST this distance away.
---@field far_spawn_max_distance number When a player selects "far" spawn, they will be AT LEAST this distance away.
---@class OarcConfigServerInfo
---@field welcome_msg_title string
---@field welcome_msg string
---@field server_msg string
---@class OarcConfigGameplaySettings
---@field enable_buddy_spawn boolean Allow 2 players to spawn next to each other, each with their own starting area.
---@field enable_offline_protection boolean Inhibits enemy attacks on bases where all players are offline. Not 100% guaranteed!
---@field enable_shared_team_vision boolean Enable shared vision between teams (all teams are COOP regardless)
---@field enable_shared_team_chat boolean Share local team chat with all teams
---@field enable_shared_spawns boolean Enable if players can allow others to join their spawn.
---@field number_of_players_per_shared_spawn number Number of players allowed to join a shared spawn.
---@field enable_friendly_fire boolean Set to true if you want to shoot your own chests and stuff.
---@field main_force_name string The name of the main force.
---@field main_force_surface string The starting surface of the main force.
---@field default_surface string The starting surface of the main force.
---@field scale_resources_around_spawns boolean Scales resources so that even if you spawn "far away" from the center of the map, resources near to your spawn point scale so you aren't surrounded by 100M patches or something. This is useful depending on what map gen settings you pick.
---@field oarc_modified_enemy_spawning boolean Adjust enemy spawning based on distance to spawns. All it does it make things more balanced based on your distance and makes the game a little easier. No behemoth worms everywhere just because you spawned far away.
---@field modified_enemy_spawning boolean Adjust enemy spawning based on distance to spawns. All it does it make things more balanced based on your distance and makes the game a little easier. No behemoth worms everywhere just because you spawned far away.
---@field minimum_online_time number Require playes to be online for at least X minutes Else their character is removed and their spawn point is freed up for use
---@field respawn_cooldown_min number Respawn cooldown in minutes.
---@class OarcConfigRegrowth
---@field enable_regrowth boolean Cleans up unused chunks periodically. Helps keep map size down.
---@field enable_world_eater boolean Checks inactive chunks to see if they are empty of entities and deletes them periodically.
---@field enable_abandoned_base_cleanup boolean Removes player bases when they leave shortly after joining.
---@class OarcConfigSurface
---@field starting_items OarcConfigStartingItems
---@field spawn_config OarcConfigSpawn
---@field starting_items OarcConfigStartingItems Starting items for players on this surface (including crashed ship items)
---@field spawn_config OarcConfigSpawn Spawn area config for this surface
---@class OarcConfigStartingItems
---@field crashed_ship boolean Add a crashed ship like a vanilla game (create_crash_site) Resources go in the ship itself. (5 slots max!) Wreakage is distributed in small pieces. (I recommend only 1 item type.)
---@field crashed_ship_resources table Items to be placed in the crashed ship.
---@field crashed_ship_wreakage table Items to be placed in the crashed ship.
---@field player_spawn_start_items table Items provided to the player the first time they join
---@field player_respawn_start_items table Items provided after EVERY respawn (disabled by default)
---@field crashed_ship_wreakage table Items to be placed in the crashed ship. (Recommend only 1 item type!)
---@field player_start_items table Items provided to the player the first time they join
---@field player_respawn_items table Items provided after EVERY respawn (disabled by default)
---@class OarcConfigSpawn
---@field general OarcConfigSpawnGeneral
---@field safe_area OarcConfigSpawnSafeArea
---@field water OarcConfigSpawnWater
---@field resource_rand_pos_settings OarcConfigSpawnResourceRandPosSettings
---@field resource_tiles table<string, OarcConfigResourceTiles>
---@field resource_patches table<string, OarcConfigResourcePatches>
---@field general OarcConfigSpawnGeneral General spawn settings (size, shape, etc.)
---@field safe_area OarcConfigSpawnSafeArea How safe is the spawn area?
---@field water OarcConfigSpawnWater Water strip settings
---@field resource_rand_pos_settings OarcConfigSpawnResourceRandPosSettings Resource placement settings
---@field solid_resources table<string, OarcConfigSolidResource> Spawn area config for solid resource tiles
---@field fluid_resources table<string, OarcConfigFluidResource> Spawn area config for fluid resource patches (like oil)
---@class OarcConfigSpawnGeneral
---@field land_area_tiles number THIS IS WHAT SETS THE SPAWN CIRCLE SIZE! Create a circle of land area for the spawn If you make this much bigger than a few chunks, good luck.
---@field spawn_radius_tiles number THIS IS WHAT SETS THE SPAWN CIRCLE SIZE! Create a circle of land area for the spawn If you make this much bigger than a few chunks, good luck.
---@field moat_size_modifier number If you change the spawn area size, you might have to adjust this as well
---@field resources_circle_shape boolean Start resource shape. true = circle, false = square.
---@field force_grass boolean Force the land area circle at the spawn to be fully grass, otherwise it defaults to the existing terrain.
@ -440,10 +415,10 @@ NAUVIS_SURFACE_CONFIG =
---@field length number Length of water strip within the spawn area
---@class OarcConfigSpawnResourceRandPosSettings
---@field enabled boolean Autoplace resources (randomly in circle) This will ignore the fixed x_offset/y_offset values in resource_tiles. Only works for resource_tiles at the moment, not oil patches/water.
---@field enabled boolean Autoplace resources (randomly in circle) This will ignore the fixed x_offset/y_offset values in solid_resources. Only works for solid_resources at the moment, not oil patches/water.
---@field radius number Distance from center of spawn that resources are placed.
---@field angle_offset number At what angle (in radians) do resources start. 0 means starts directly east. Resources are placed clockwise from there.
---@field angle_final number At what andle do we place the last resource. angle_offset and angle_final determine spacing and placement.
---@alias OarcConfigResourceTiles { amount: integer, size: integer, x_offset: integer, y_offset: integer }
---@alias OarcConfigResourcePatches { num_patches: integer, amount: integer, x_offset_start: integer, y_offset_start: integer, x_offset_next: integer, y_offset_next: integer }
---@alias OarcConfigSolidResource { amount: integer, size: integer, x_offset: integer, y_offset: integer } Amount and placement of solid resource tiles in the spawn area.
---@alias OarcConfigFluidResource { num_patches: integer, amount: integer, x_offset_start: integer, y_offset_start: integer, x_offset_next: integer, y_offset_next: integer } Amount and placement of fluid resource patches in the spawn area.

92
lib/config_parser.lua Normal file
View File

@ -0,0 +1,92 @@
-- config_parser.lua
-- Aug 2024
-- This file is used to validate the config.lua file and handle any mod conflicts.
function ValidateAndLoadConfig()
-- Save the config into the global table.
---@class OarcConfig
global.ocfg = OCFG
CacheModSettings()
GetScenarioOverrideSettings()
-- Validate enable_main_team and enable_separate_teams.
-- Force enable_main_team if both are disabled.
if (not global.ocfg.gameplay.enable_main_team and not global.ocfg.gameplay.enable_separate_teams) then
log("Both main force and separate teams are disabled! Enabling main force. Please check your mod settings or config!")
global.ocfg.gameplay.enable_main_team = true
end
-- TODO: Vanilla spawn point are not implemented yet.
-- Validate enable_shared_spawns and enable_buddy_spawn.
-- if (global.ocfg.enable_vanilla_spawns) then
-- global.ocfg.enable_buddy_spawn = false
-- end
end
-- Read in the mod settings and copy them to the OARC_CFG table, overwriting the defaults in config.lua.
function CacheModSettings()
log("Copying mod settings to OCFG table...")
-- TODO: Vanilla spawn point are not implemented yet.
-- settings.global["oarc-mod-enable-vanilla-spawn-points"].value
-- settings.global["oarc-mod-number-of-vanilla-spawn-points"].value
-- settings.global["oarc-mod-vanilla-spawn-point-spacing"].value
-- Copy in the global settings from the mod settings.
global.ocfg.server_info.welcome_msg_title = settings.global["oarc-mod-welcome-msg-title"].value --[[@as string]]
global.ocfg.server_info.welcome_msg = settings.global["oarc-mod-welcome-msg"].value --[[@as string]]
global.ocfg.server_info.server_msg = settings.global["oarc-mod-server-msg"].value --[[@as string]]
global.ocfg.gameplay.enable_main_team = settings.global["oarc-mod-enable-main-team"].value --[[@as boolean]]
global.ocfg.gameplay.enable_separate_teams = settings.global["oarc-mod-enable-separate-teams"].value --[[@as boolean]]
global.ocfg.gameplay.enable_spawning_on_other_surfaces = settings.global["oarc-mod-enable-spawning-on-other-surfaces"].value --[[@as boolean]]
global.ocfg.gameplay.allow_moats_around_spawns = settings.global["oarc-mod-allow-moats-around-spawns"].value --[[@as boolean]]
global.ocfg.gameplay.enable_moat_bridging = settings.global["oarc-mod-enable-moat-bridging"].value --[[@as boolean]]
global.ocfg.gameplay.minimum_distance_to_existing_chunks = settings.global["oarc-mod-minimum-distance-to-existing-chunks"].value --[[@as integer]]
global.ocfg.gameplay.near_spawn_min_distance = settings.global["oarc-mod-near-spawn-min-distance"].value --[[@as integer]]
global.ocfg.gameplay.near_spawn_max_distance = settings.global["oarc-mod-near-spawn-max-distance"].value --[[@as integer]]
global.ocfg.gameplay.far_spawn_min_distance = settings.global["oarc-mod-far-spawn-min-distance"].value --[[@as integer]]
global.ocfg.gameplay.far_spawn_max_distance = settings.global["oarc-mod-far-spawn-max-distance"].value --[[@as integer]]
global.ocfg.gameplay.enable_buddy_spawn = settings.global["oarc-mod-enable-buddy-spawn"].value --[[@as boolean]]
global.ocfg.gameplay.enable_offline_protection = settings.global["oarc-mod-enable-offline-protection"].value --[[@as boolean]]
global.ocfg.gameplay.enable_shared_team_vision = settings.global["oarc-mod-enable-shared-team-vision"].value --[[@as boolean]]
global.ocfg.gameplay.enable_shared_team_chat = settings.global["oarc-mod-enable-shared-team-chat"].value --[[@as boolean]]
global.ocfg.gameplay.enable_shared_spawns = settings.global["oarc-mod-enable-shared-spawns"].value --[[@as boolean]]
global.ocfg.gameplay.number_of_players_per_shared_spawn = settings.global["oarc-mod-number-of-players-per-shared-spawn"].value --[[@as integer]]
global.ocfg.gameplay.enable_friendly_fire = settings.global["oarc-mod-enable-friendly-fire"].value --[[@as boolean]]
global.ocfg.gameplay.main_force_name = settings.global["oarc-mod-main-force-name"].value --[[@as string]]
global.ocfg.gameplay.default_surface = settings.global["oarc-mod-default-surface"].value --[[@as string]]
global.ocfg.gameplay.scale_resources_around_spawns = settings.global["oarc-mod-scale-resources-around-spawns"].value --[[@as boolean]]
global.ocfg.gameplay.modified_enemy_spawning = settings.global["oarc-mod-modified-enemy-spawning"].value --[[@as boolean]]
global.ocfg.gameplay.minimum_online_time = settings.global["oarc-mod-minimum-online-time"].value --[[@as integer]]
global.ocfg.gameplay.respawn_cooldown_min = settings.global["oarc-mod-respawn-cooldown-min"].value --[[@as integer]]
global.ocfg.regrowth.enable_regrowth = settings.global["oarc-mod-enable-regrowth"].value --[[@as boolean]]
global.ocfg.regrowth.enable_world_eater = settings.global["oarc-mod-enable-world-eater"].value --[[@as string]]
global.ocfg.regrowth.enable_abandoned_base_cleanup = settings.global["oarc-mod-enable-abandoned-base-cleanup"].value --[[@as boolean]]
end
function GetScenarioOverrideSettings()
if remote.interfaces["oarc_scenario"] then
log("Getting scenario override settings...")
local scenario_settings = remote.call("oarc_scenario", "get_scenario_settings")
-- Overwrite the non mod settings with the scenario settings.
global.ocfg = scenario_settings
else
log("No scenario settings found.")
end
end

View File

@ -2,11 +2,6 @@
-- Jan 2018
-- Display current game options, maybe have some admin controls here
-- Main Configuration File
require("config")
require("lib/oarc_utils")
require("lib/separate_spawns")
function GameOptionsGuiClick(event)
if not (event and event.element and event.element.valid) then return end
local player = game.players[event.player_index]
@ -73,35 +68,35 @@ function CreateGameOptionsTab(tab_container, player)
-- Soft Mods:
local soft_mods_string = "Oarc Core"
if (global.ocfg.mod_overlap.enable_regrowth) then
if (global.ocfg.regrowth.enable_regrowth) then
soft_mods_string = soft_mods_string .. ", Regrowth"
end
if (global.ocfg.mod_overlap.enable_offline_protect) then
if (global.ocfg.gameplay.enable_offline_protection) then
soft_mods_string = soft_mods_string .. ", Offline Attack Inhibitor"
end
local game_info_str = "Soft Mods: " .. soft_mods_string
-- Spawn options:
if (global.ocfg.mod_overlap.enable_separate_teams) then
if (global.ocfg.gameplay.enable_separate_teams) then
game_info_str = game_info_str.."\n".."You are allowed to spawn on your own team (have your own research tree). All teams are friendly!"
end
-- if (global.ocfg.enable_vanilla_spawns) then
-- game_info_str = game_info_str.."\n".."You are spawned in a default style starting area."
-- else
game_info_str = game_info_str.."\n".."You are spawned with a fix set of starting resources."
if (global.ocfg.mod_overlap.enable_buddy_spawn) then
if (global.ocfg.gameplay.enable_buddy_spawn) then
game_info_str = game_info_str.."\n".."You can chose to spawn alongside a buddy if you spawn together at the same time."
end
-- end
if (global.ocfg.mod_overlap.enable_shared_spawns) then
if (global.ocfg.gameplay.enable_shared_spawns) then
game_info_str = game_info_str.."\n".."Spawn hosts may choose to share their spawn and allow other players to join them."
end
if (global.ocfg.mod_overlap.enable_separate_teams and global.ocfg.mod_overlap.enable_shared_team_vision) then
if (global.ocfg.gameplay.enable_separate_teams and global.ocfg.gameplay.enable_shared_team_vision) then
game_info_str = game_info_str.."\n".."Everyone (all teams) have shared vision."
end
if (global.ocfg.mod_overlap.enable_regrowth) then
if (global.ocfg.gameplay.enable_regrowth) then
game_info_str = game_info_str.."\n".."Old parts of the map will slowly be deleted over time (chunks without any player buildings)."
end
-- if (global.ocfg.enable_power_armor_start or global.ocfg.enable_modular_armor_start) then
@ -115,7 +110,7 @@ function CreateGameOptionsTab(tab_container, player)
AddLabel(tab_container, "game_info_label", game_info_str, my_longer_label_style)
if (global.ocfg.mod_overlap.enable_abandoned_base_removal) then
if (global.ocfg.gameplay.enable_abandoned_base_removal) then
AddLabel(tab_container, "leave_warning_msg", "If you leave within " .. global.ocfg.gameplay.minimum_online_time .. " minutes of joining, your base and character will be deleted.", my_longer_label_style)
tab_container.leave_warning_msg.style.font_color=my_color_red
end

View File

@ -1,6 +1,7 @@
-- oarc_gui_tabs.lua
local mod_gui = require("mod-gui")
require("lib/game_opts")
--------------------------------------------------------------------------------
-- GUI Tab Handler

View File

@ -297,7 +297,15 @@ end
---@param player LuaPlayer
---@return nil
function GivePlayerRespawnItems(player)
for name, count in pairs(global.ocfg.starting_items.player_respawn_start_items) do
local playerSpawn = global.ocore.playerSpawns[player.name]
if (playerSpawn == nil) then
error("ERROR - GivePlayerRespawnItems - No player spawn found for player: " .. player.name)
return
end
local respawnItems = global.ocfg.surfaces_config[playerSpawn.surface].starting_items.player_respawn_items
for name, count in pairs(respawnItems) do
player.insert({ name = name, count = count })
end
end
@ -308,7 +316,15 @@ end
---@param player LuaPlayer
---@return nil
function GivePlayerStarterItems(player)
for name, count in pairs(global.ocfg.starting_items.player_spawn_start_items) do
local playerSpawn = global.ocore.playerSpawns[player.name]
if (playerSpawn == nil) then
error("ERROR - GivePlayerStarterItems - No player spawn found for player: " .. player.name)
return
end
local respawnItems = global.ocfg.surfaces_config[playerSpawn.surface].starting_items.player_start_items
for name, count in pairs(respawnItems) do
player.insert({ name = name, count = count })
end
end
@ -637,7 +653,7 @@ function FindUngeneratedCoordinates(minDistChunks, maxDistChunks, surface)
-- Keep searching!
-- Check there are no generated chunks in a square area defined by the config:
elseif IsChunkAreaUngenerated(chunkPos, global.ocfg.mod_overlap.minimum_distance_to_existing_chunks, surface) then
elseif IsChunkAreaUngenerated(chunkPos, global.ocfg.gameplay.minimum_distance_to_existing_chunks, surface) then
position.x = (chunkPos.x*CHUNK_SIZE) + (CHUNK_SIZE/2)
position.y = (chunkPos.y*CHUNK_SIZE) + (CHUNK_SIZE/2)
break -- SUCCESS
@ -961,14 +977,14 @@ end
---@return nil
function DowngradeWormsDistanceBasedOnChunkGenerate(event)
---@type OarcConfigModSettings
local mod_overlap = global.ocfg.mod_overlap
---@type OarcConfigGameplaySettings
local gameplay = global.ocfg.gameplay
if (util.distance({ x = 0, y = 0 }, event.area.left_top) < (mod_overlap.near_spawn_min_distance * CHUNK_SIZE)) then
if (util.distance({ x = 0, y = 0 }, event.area.left_top) < (gameplay.near_spawn_min_distance * CHUNK_SIZE)) then
DowngradeWormsInArea(event.surface, event.area, 100, 100, 100)
elseif (util.distance({ x = 0, y = 0 }, event.area.left_top) < (mod_overlap.far_spawn_min_distance * CHUNK_SIZE)) then
elseif (util.distance({ x = 0, y = 0 }, event.area.left_top) < (gameplay.far_spawn_min_distance * CHUNK_SIZE)) then
DowngradeWormsInArea(event.surface, event.area, 50, 90, 100)
elseif (util.distance({ x = 0, y = 0 }, event.area.left_top) < (mod_overlap.far_spawn_max_distance * CHUNK_SIZE)) then
elseif (util.distance({ x = 0, y = 0 }, event.area.left_top) < (gameplay.far_spawn_max_distance * CHUNK_SIZE)) then
DowngradeWormsInArea(event.surface, event.area, 20, 80, 97)
else
DowngradeWormsInArea(event.surface, event.area, 0, 20, 90)
@ -1273,7 +1289,7 @@ function CreateCropCircle(surface, centerPos, chunkArea, tileRadius, fillTile)
-- Fill in all unexpected water in a circle
if (distSqr < tileRadSqr) then
if (surface.get_tile(i, j).collides_with("water-tile") or
global.ocfg.spawn_config.general.force_grass) then
global.ocfg.surfaces_config[surface.name].spawn_config.general.force_grass) then
table.insert(dirtTiles, { name = fillTile, position = { i, j } })
end
end
@ -1307,7 +1323,7 @@ function CreateCropOctagon(surface, centerPos, chunkArea, tileRadius, fillTile)
-- Fill in all unexpected water in a circle
if (distVar < tileRadius + 2) then
if (surface.get_tile(i, j).collides_with("water-tile") or
global.ocfg.spawn_config.general.force_grass or
global.ocfg.surfaces_config[surface.name].spawn_config.general.force_grass or
(game.active_mods["oarc-restricted-build"])) then
table.insert(dirtTiles, { name = fillTile, position = { i, j } })
end
@ -1346,7 +1362,7 @@ function CreateMoat(surface, centerPos, chunkArea, tileRadius, moatTile, bridge)
local distVar = math.floor((centerPos.x - i) ^ 2 + (centerPos.y - j) ^ 2)
-- Create a circle of water
if ((distVar < tileRadSqr + (1500 * global.ocfg.spawn_config.general.moat_size_modifier)) and
if ((distVar < tileRadSqr + (1500 * global.ocfg.surfaces_config[surface.name].spawn_config.general.moat_size_modifier)) and
(distVar > tileRadSqr)) then
table.insert(tiles, { name = moatTile, position = { i, j } })
end
@ -1382,7 +1398,7 @@ function GenerateResourcePatch(surface, resourceName, diameter, position, amount
end
for y = -midPoint, midPoint do
for x = -midPoint, midPoint do
if (not global.ocfg.spawn_config.general.resources_circle_shape or ((x) ^ 2 + (y) ^ 2 < midPoint ^ 2)) then
if (not global.ocfg.surfaces_config[surface.name].spawn_config.general.resources_circle_shape or ((x) ^ 2 + (y) ^ 2 < midPoint ^ 2)) then
surface.create_entity({
name = resourceName,
amount = amount,
@ -1405,7 +1421,7 @@ end
-- end
-- function CreateHoldingPen(surface, chunkArea)
-- local radiusTiles = global.ocfg.spawn_config.general.land_area_tiles-10
-- local radiusTiles = global.ocfg.spawn_config.general.spawn_radius_tiles-10
-- if (((chunkArea.left_top.x >= -(radiusTiles+2*CHUNK_SIZE)) and (chunkArea.left_top.x <= (radiusTiles+2*CHUNK_SIZE))) and
-- ((chunkArea.left_top.y >= -(radiusTiles+2*CHUNK_SIZE)) and (chunkArea.left_top.y <= (radiusTiles+2*CHUNK_SIZE)))) then

View File

@ -12,9 +12,6 @@
-- the on_sector_scanned event.
-- 5. Chunks timeout after 1 hour-ish, configurable
require("lib/oarc_utils")
require("config")
-- TODO: Make this a mod startup setting?
REGROWTH_TIMEOUT_TICKS = TICKS_PER_HOUR -- TICKS_PER_HOUR TICKS_PER_MINUTE

View File

@ -4,9 +4,6 @@
-- Code that handles everything regarding giving each player a separate spawn
-- Includes the GUI stuff
require("lib/oarc_utils")
require("config")
local util = require("util")
local crash_site = require("crash-site")
@ -34,7 +31,7 @@ function InitSpawnGlobalsAndForces()
if (surface.name == HOLDING_PEN_SURFACE_NAME) then
global.ocore.surfaces[surface.name] = false
else
global.ocore.surfaces[surface.name] = global.ocfg.mod_overlap.enable_spawning_on_other_surfaces
global.ocore.surfaces[surface.name] = global.ocfg.gameplay.enable_spawning_on_other_surfaces
end
end
end
@ -64,26 +61,26 @@ function InitSpawnGlobalsAndForces()
global.ocore.sharedSpawns --[[@as OarcSharedSpawnsTable]] = {}
-- Use this for testing shared spawns...
local sharedSpawnExample1 = {
surface="nauvis",
openAccess=true,
position={x=50,y=50},
players={"ABC", "DEF"}}
local sharedSpawnExample2 = {
surface="vulcanus",
openAccess=false,
position={x=200,y=200},
players={"ABC", "DEF"}}
local sharedSpawnExample3 = {
surface="fulgora",
openAccess=true,
position={x=400,y=400},
players={"A", "B", "C", "D"}}
global.ocore.sharedSpawns = {
testName1=sharedSpawnExample1,
testName2=sharedSpawnExample2,
Oarc=sharedSpawnExample3
}
-- local sharedSpawnExample1 = {
-- surface="nauvis",
-- openAccess=true,
-- position={x=50,y=50},
-- players={"ABC", "DEF"}}
-- local sharedSpawnExample2 = {
-- surface="vulcanus",
-- openAccess=false,
-- position={x=200,y=200},
-- players={"ABC", "DEF"}}
-- local sharedSpawnExample3 = {
-- surface="fulgora",
-- openAccess=true,
-- position={x=400,y=400},
-- players={"A", "B", "C", "D"}}
-- global.ocore.sharedSpawns = {
-- testName1=sharedSpawnExample1,
-- testName2=sharedSpawnExample2,
-- Oarc=sharedSpawnExample3
-- }
end
-- Each player has an option to change their respawn which has a cooldown when used.
@ -127,7 +124,7 @@ function InitSpawnGlobalsAndForces()
-- Name a new force to be the default force.
-- This is what any new player is assigned to when they join, even before they spawn.
local main_force = CreateForce(global.ocfg.gameplay.main_force_name)
main_force.set_spawn_position({ x = 0, y = 0 }, global.ocfg.gameplay.main_force_surface)
main_force.set_spawn_position({ x = 0, y = 0 }, global.ocfg.gameplay.default_surface)
-- Special forces for when players with their own force want a reset.
global.ocore.abandoned_force = "_ABANDONED_"
@ -153,7 +150,7 @@ function SeparateSpawnsSurfaceCreated(event)
end
-- Add the surface to the list of surfaces that allow spawns with value from config.
global.ocore.surfaces[surface.name] = global.ocfg.mod_overlap.enable_spawning_on_other_surfaces
global.ocore.surfaces[surface.name] = global.ocfg.gameplay.enable_spawning_on_other_surfaces
end
---Detects when surfaces are deleted and removes them from the list of surfaces that allow spawns.
@ -260,11 +257,11 @@ end
---@param position TilePosition
---@return nil
function GenerateStartingResources(surface, position)
local rand_settings = global.ocfg.spawn_config.resource_rand_pos_settings
local rand_settings = global.ocfg.surfaces_config[surface.name].spawn_config.resource_rand_pos_settings
-- Generate all resource tile patches
if (not rand_settings.enabled) then
for r_name, r_data in pairs(global.ocfg.spawn_config.resource_tiles --[[@as table<string, OarcConfigResourceTiles>]]) do
for r_name, r_data in pairs(global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources --[[@as table<string, OarcConfigSolidResource>]]) do
local pos = { x = position.x + r_data.x_offset, y = position.y + r_data.y_offset }
GenerateResourcePatch(surface, r_name, r_data.size, pos, r_data.amount)
end
@ -274,7 +271,7 @@ function GenerateStartingResources(surface, position)
-- Create list of resource tiles
---@type table<string>
local r_list = {}
for r_name, _ in pairs(global.ocfg.spawn_config.resource_tiles --[[@as table<string, OarcConfigResourceTiles>]]) do
for r_name, _ in pairs(global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources --[[@as table<string, OarcConfigSolidResource>]]) do
if (r_name ~= "") then
table.insert(r_list, r_name)
end
@ -284,7 +281,7 @@ function GenerateStartingResources(surface, position)
-- This places resources in a semi-circle
local angle_offset = rand_settings.angle_offset
local num_resources = TableLength(global.ocfg.spawn_config.resource_tiles)
local num_resources = TableLength(global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources)
local theta = ((rand_settings.angle_final - rand_settings.angle_offset) / num_resources);
local count = 0
@ -296,14 +293,14 @@ function GenerateStartingResources(surface, position)
local pos = { x = math.floor(tx), y = math.floor(ty) }
local resourceConfig = global.ocfg.spawn_config.resource_tiles[r_name]
local resourceConfig = global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources[r_name]
GenerateResourcePatch(surface, r_name, resourceConfig.size, pos, resourceConfig.amount)
count = count + 1
end
end
-- Generate special fluid resource patches (oil)
for r_name, r_data in pairs(global.ocfg.spawn_config.resource_patches --[[@as table<string, OarcConfigResourcePatches>]]) do
for r_name, r_data in pairs(global.ocfg.surfaces_config[surface.name].spawn_config.fluid_resources --[[@as table<string, OarcConfigFluidResource>]]) do
local oil_patch_x = position.x + r_data.x_offset_start
local oil_patch_y = position.y + r_data.y_offset_start
for i = 1, r_data.num_patches do
@ -325,7 +322,7 @@ function SendPlayerToNewSpawnAndCreateIt(delayedSpawn)
local ocfg --[[@as OarcConfig]] = global.ocfg
-- DOUBLE CHECK and make sure the area is super safe.
ClearNearbyEnemies(delayedSpawn.position, ocfg.spawn_config.safe_area.safe_radius,
ClearNearbyEnemies(delayedSpawn.position, ocfg.surfaces_config[delayedSpawn.surface].spawn_config.safe_area.safe_radius,
game.surfaces[delayedSpawn.surface])
-- TODO: Vanilla spawn point are not implemented yet.
@ -333,7 +330,7 @@ function SendPlayerToNewSpawnAndCreateIt(delayedSpawn)
-- Generate water strip only if we don't have a moat.
if (not delayedSpawn.moat) then
local water_data = ocfg.spawn_config.water
local water_data = ocfg.surfaces_config[delayedSpawn.surface].spawn_config.water
CreateWaterStrip(game.surfaces[delayedSpawn.surface],
{ x = delayedSpawn.position.x + water_data.x_offset, y = delayedSpawn.position.y + water_data.y_offset },
water_data.length)
@ -356,18 +353,18 @@ function SendPlayerToNewSpawnAndCreateIt(delayedSpawn)
DisplayWelcomeGroundTextAtSpawn(player, delayedSpawn.surface, delayedSpawn.position)
-- Chart the area.
ChartArea(player.force, delayedSpawn.position, math.ceil(ocfg.spawn_config.general.land_area_tiles / CHUNK_SIZE),
ChartArea(player.force, delayedSpawn.position, math.ceil(ocfg.surfaces_config[delayedSpawn.surface].spawn_config.general.spawn_radius_tiles / CHUNK_SIZE),
player.surface)
if (player.gui.screen.wait_for_spawn_dialog ~= nil) then
player.gui.screen.wait_for_spawn_dialog.destroy()
end
if (ocfg.starting_items.crashed_ship) then
if (ocfg.surfaces_config[delayedSpawn.surface].starting_items.crashed_ship) then
crash_site.create_crash_site(game.surfaces[delayedSpawn.surface],
{ x = delayedSpawn.position.x + 15, y = delayedSpawn.position.y - 25 },
ocfg.starting_items.crashed_ship_resources,
ocfg.starting_items.crashed_ship_wreakage)
ocfg.surfaces_config[delayedSpawn.surface].starting_items.crashed_ship_resources,
ocfg.surfaces_config[delayedSpawn.surface].starting_items.crashed_ship_wreakage)
end
end
@ -426,7 +423,7 @@ end
---@param chunkArea BoundingBox
---@return nil
function SetupAndClearSpawnAreas(surface, chunkArea)
local spawn_config --[[@as OarcConfigSpawn]] = global.ocfg.spawn_config
local spawn_config --[[@as OarcConfigSpawn]] = global.ocfg.surfaces_config[surface.name].spawn_config
for name, spawn in pairs(global.ocore.uniqueSpawns --[[@as OarcUniqueSpawnsTable]]) do
if (spawn.surface ~= surface.name) then
@ -434,7 +431,7 @@ function SetupAndClearSpawnAreas(surface, chunkArea)
end
-- Create a bunch of useful area and position variables
local landArea = GetAreaAroundPos(spawn.position, spawn_config.general.land_area_tiles + CHUNK_SIZE)
local landArea = GetAreaAroundPos(spawn.position, spawn_config.general.spawn_radius_tiles + CHUNK_SIZE)
-- local safeArea = GetAreaAroundPos(spawn.position, spawn_config.safe_area.safe_radius)
-- local warningArea = GetAreaAroundPos(spawn.position, spawn_config.safe_area.warn_radius)
-- local reducedArea = GetAreaAroundPos(spawn.position, spawn_config.safe_area.danger_radius)
@ -443,8 +440,8 @@ function SetupAndClearSpawnAreas(surface, chunkArea)
y = chunkArea.left_top.y + (CHUNK_SIZE / 2)
}
local spawnPosOffset = {
x = spawn.position.x + spawn_config.general.land_area_tiles,
y = spawn.position.y + spawn_config.general.land_area_tiles
x = spawn.position.x + spawn_config.general.spawn_radius_tiles,
y = spawn.position.y + spawn_config.general.spawn_radius_tiles
}
-- Make chunks near a spawn safe by removing enemies
@ -467,31 +464,31 @@ function SetupAndClearSpawnAreas(surface, chunkArea)
-- TODO: Vanilla spawn point are not implemented yet.
-- if (not spawn.vanilla) then
local enable_test = global.ocfg.mod_overlap.enable_moat_bridging
local enable_test = global.ocfg.gameplay.enable_moat_bridging
-- If the chunk is within the main land area, then clear trees/resources
-- and create the land spawn areas (guaranteed land with a circle of trees)
if CheckIfInArea(chunkAreaCenter, landArea) then
-- Remove trees/resources inside the spawn area
RemoveInCircle(surface, chunkArea, "tree", spawn.position, spawn_config.general.land_area_tiles)
RemoveInCircle(surface, chunkArea, "resource", spawn.position, spawn_config.general.land_area_tiles + 5)
RemoveInCircle(surface, chunkArea, "cliff", spawn.position, spawn_config.general.land_area_tiles + 5)
RemoveInCircle(surface, chunkArea, "tree", spawn.position, spawn_config.general.spawn_radius_tiles)
RemoveInCircle(surface, chunkArea, "resource", spawn.position, spawn_config.general.spawn_radius_tiles + 5)
RemoveInCircle(surface, chunkArea, "cliff", spawn.position, spawn_config.general.spawn_radius_tiles + 5)
local fill_tile = "landfill"
if (spawn_config.general.tree_circle) then
CreateCropCircle(surface, spawn.position, chunkArea, spawn_config.general.land_area_tiles, fill_tile)
CreateCropCircle(surface, spawn.position, chunkArea, spawn_config.general.spawn_radius_tiles, fill_tile)
end
if (spawn_config.general.tree_octagon) then
CreateCropOctagon(surface, spawn.position, chunkArea, spawn_config.general.land_area_tiles, fill_tile)
CreateCropOctagon(surface, spawn.position, chunkArea, spawn_config.general.spawn_radius_tiles, fill_tile)
end
-- TODO: Confirm removal of global setting check of enable_allow_moats_around_spawns is okay?
if (spawn.moat) then
CreateMoat(surface,
spawn.position,
chunkArea,
spawn_config.general.land_area_tiles,
spawn_config.general.spawn_radius_tiles,
"water",
global.ocfg.mod_overlap.enable_moat_bridging)
global.ocfg.gameplay.enable_moat_bridging)
end
end
@ -509,7 +506,7 @@ function SeparateSpawnsGenerateChunk(event)
if (not global.ocore.surfaces[surface.name]) then return end
-- Helps scale worm sizes to not be unreasonable when far from the origin.
if global.ocfg.gameplay.oarc_modified_enemy_spawning then
if global.ocfg.gameplay.modified_enemy_spawning then
DowngradeWormsDistanceBasedOnChunkGenerate(event)
end
@ -535,7 +532,7 @@ function DowngradeResourcesDistanceBasedOnChunkGenerate(surface, chunkArea)
local distance = util.distance(chunkArea.left_top, closestSpawn.position)
-- Adjust multiplier to bring it in or out
local modifier = (distance / (global.ocfg.spawn_config.safe_area.danger_radius * 1)) ^ 3
local modifier = (distance / (global.ocfg.surfaces_config[surface.name].spawn_config.safe_area.danger_radius * 1)) ^ 3
if modifier < 0.1 then modifier = 0.1 end
if modifier > 1 then return end
@ -580,11 +577,11 @@ function ModifyEnemySpawnsNearPlayerStartingAreas(event)
end
-- No enemies inside safe radius!
if (util.distance(enemy_pos, closest_spawn.position) < global.ocfg.spawn_config.safe_area.safe_radius) then
if (util.distance(enemy_pos, closest_spawn.position) < global.ocfg.surfaces_config[surface.name].spawn_config.safe_area.safe_radius) then
event.entity.destroy()
-- Warn distance is all SMALL only.
elseif (util.distance(enemy_pos, closest_spawn.position) < global.ocfg.spawn_config.safe_area.warn_radius) then
elseif (util.distance(enemy_pos, closest_spawn.position) < global.ocfg.surfaces_config[surface.name].spawn_config.safe_area.warn_radius) then
if ((enemy_name == "big-biter") or (enemy_name == "behemoth-biter") or (enemy_name == "medium-biter")) then
event.entity.destroy()
surface.create_entity { name = "small-biter", position = enemy_pos, force = game.forces.enemy }
@ -600,7 +597,7 @@ function ModifyEnemySpawnsNearPlayerStartingAreas(event)
end
-- Danger distance is MEDIUM max.
elseif (util.distance(enemy_pos, closest_spawn.position) < global.ocfg.spawn_config.safe_area.danger_radius) then
elseif (util.distance(enemy_pos, closest_spawn.position) < global.ocfg.surfaces_config[surface.name].spawn_config.safe_area.danger_radius) then
if ((enemy_name == "big-biter") or (enemy_name == "behemoth-biter")) then
event.entity.destroy()
surface.create_entity { name = "medium-biter", position = enemy_pos, force = game.forces.enemy }
@ -695,7 +692,7 @@ function RemoveOrResetPlayer(player, remove_player, remove_force, remove_base, i
-- If this player is staying in the game, lets make sure we don't delete them along with the map chunks being
-- cleared.
player.teleport({ x = 0, y = 0 }, global.ocfg.gameplay.main_force_surface)
player.teleport({ x = 0, y = 0 }, global.ocfg.gameplay.default_surface)
local player_old_force = player.force
player.force = global.ocfg.gameplay.main_force_name
@ -729,22 +726,24 @@ function UniqueSpawnCleanupRemove(playerName, cleanup, immediate)
if (global.ocore.uniqueSpawns[playerName] == nil) then return end -- Safety
log("UniqueSpawnCleanupRemove - " .. playerName)
local spawnPos = global.ocore.uniqueSpawns[playerName].pos
local land_area_tiles = global.ocfg.spawn_config.general.land_area_tiles
---@type OarcUniqueSpawn
local spawn = global.ocore.uniqueSpawns[playerName]
local spawnPos = spawn.position
local spawn_radius_tiles = global.ocfg.surfaces_config[spawn.surface].spawn_config.general.spawn_radius_tiles
-- Check if it was near someone else's base. (Really just buddy base is possible I think.)
nearOtherSpawn = false
for spawnPlayerName, otherSpawnPos in pairs(global.ocore.uniqueSpawns) do
if ((spawnPlayerName ~= playerName) and
(util.distance(spawnPos, otherSpawnPos.pos) < (land_area_tiles * 3))) then
(util.distance(spawnPos, otherSpawnPos.pos) < (spawn_radius_tiles * 3))) then
log("Won't remove base as it's close to another spawn: " .. spawnPlayerName)
nearOtherSpawn = true
end
end
-- Unused Chunk Removal mod (aka regrowth)
if (cleanup and global.ocfg.mod_overlap.enable_abandoned_base_cleanup and
(not nearOtherSpawn) and global.ocfg.mod_overlap.enable_regrowth) then
if (cleanup and global.ocfg.regrowth.enable_abandoned_base_cleanup and
(not nearOtherSpawn) and global.ocfg.regrowth.enable_regrowth) then
-- TODO: Vanilla spawn point are not implemented yet.
-- if (global.ocore.uniqueSpawns[playerName].vanilla) then
-- log("Returning a vanilla spawn back to available.")
@ -753,12 +752,12 @@ function UniqueSpawnCleanupRemove(playerName, cleanup, immediate)
if (immediate) then
log("IMMEDIATE Removing base: " .. spawnPos.x .. "," .. spawnPos.y)
RegrowthMarkAreaForRemoval(spawnPos, math.ceil(land_area_tiles / CHUNK_SIZE))
RegrowthMarkAreaForRemoval(spawnPos, math.ceil(spawn_radius_tiles / CHUNK_SIZE))
TriggerCleanup()
else
log("Removing permanent flags on base: " .. spawnPos.x .. "," .. spawnPos.y)
RegrowthMarkAreaNotPermanentOVERWRITE(spawnPos,
math.ceil(land_area_tiles / CHUNK_SIZE))
math.ceil(spawn_radius_tiles / CHUNK_SIZE))
end
end
@ -956,14 +955,12 @@ end
function GetNumberOfAvailableSharedSpawns()
local count = 0
local number_of_players_per_shared_spawn = global.ocfg.mod_overlap.number_of_players_per_shared_spawn
local number_of_players_per_shared_spawn = global.ocfg.gameplay.number_of_players_per_shared_spawn
for ownerName, sharedSpawn in pairs(global.ocore.sharedSpawns --[[@as OarcSharedSpawnsTable]]) do
-- Disabled only for testing. TODO: Re-enable this!
-- if (sharedSpawn.openAccess and
-- (game.players[ownerName] ~= nil) and
-- game.players[ownerName].connected) then
if (sharedSpawn.openAccess) then
if (sharedSpawn.openAccess and
(game.players[ownerName] ~= nil) and
game.players[ownerName].connected) then
if ((number_of_players_per_shared_spawn == 0) or
(TableLength(global.ocore.sharedSpawns[ownerName].players) < number_of_players_per_shared_spawn)) then
count = count + 1
@ -1033,7 +1030,7 @@ function QueuePlayerForDelayedSpawn(playerName, surface, spawnPosition, moatEnab
-- newUniqueSpawn.vanilla = vanillaSpawn
global.ocore.uniqueSpawns[playerName] = newUniqueSpawn
local delay_spawn_seconds = 5 * (math.ceil(global.ocfg.spawn_config.general.land_area_tiles / CHUNK_SIZE))
local delay_spawn_seconds = 5 * (math.ceil(global.ocfg.surfaces_config[surface].spawn_config.general.spawn_radius_tiles / CHUNK_SIZE))
---TODO: Move text to locale.
game.players[playerName].print("Generating your spawn now, please wait for at least " ..
@ -1055,7 +1052,7 @@ function QueuePlayerForDelayedSpawn(playerName, surface, spawnPosition, moatEnab
DisplayPleaseWaitForSpawnDialog(game.players[playerName], delay_spawn_seconds)
RegrowthMarkAreaSafeGivenTilePos(spawnPosition,
math.ceil(global.ocfg.spawn_config.general.land_area_tiles / CHUNK_SIZE), true)
math.ceil(global.ocfg.surfaces_config[surface].spawn_config.general.spawn_radius_tiles / CHUNK_SIZE), true)
else
log("THIS SHOULD NOT EVER HAPPEN! Spawn failed!")
SendBroadcastMsg("ERROR!! Failed to create spawn point for: " .. playerName)
@ -1098,8 +1095,8 @@ function SendPlayerToSpawn(player)
else
local gameplayConfig = global.ocfg.gameplay --[[@as OarcConfigGameplaySettings]]
SafeTeleport(player,
game.surfaces[gameplayConfig.main_force_surface],
game.forces[gameplayConfig.main_force_name].get_spawn_position(gameplayConfig.main_force_surface))
game.surfaces[gameplayConfig.default_surface],
game.forces[gameplayConfig.main_force_name].get_spawn_position(gameplayConfig.default_surface))
end
end
@ -1114,8 +1111,8 @@ function SendPlayerToRandomSpawn(player)
if (rndSpawn == 0) then
local gameplayConfig = global.ocfg.gameplay --[[@as OarcConfigGameplaySettings]]
player.teleport(
game.forces[gameplayConfig.main_force_name].get_spawn_position(gameplayConfig.main_force_surface),
gameplayConfig.main_force_surface)
game.forces[gameplayConfig.main_force_name].get_spawn_position(gameplayConfig.default_surface),
gameplayConfig.default_surface)
else
counter = counter + 1
for name, spawn in pairs(global.ocore.uniqueSpawns --[[@as OarcUniqueSpawnsTable]]) do
@ -1151,7 +1148,7 @@ function CreateForce(force_name)
-- Create a new force
elseif (#game.forces < MAX_FORCES) then
newForce = game.create_force(force_name)
if global.ocfg.mod_overlap.enable_shared_team_vision then
if global.ocfg.gameplay.enable_shared_team_vision then
newForce.share_chart = true
end
@ -1164,7 +1161,7 @@ function CreateForce(force_name)
SetCeaseFireBetweenAllForces()
SetFriendlyBetweenAllForces()
newForce.friendly_fire = global.ocfg.mod_overlap.enable_friendly_fire
newForce.friendly_fire = global.ocfg.gameplay.enable_friendly_fire
-- if (global.ocfg.enable_anti_grief) then
-- AntiGriefing(newForce)

View File

@ -3,8 +3,6 @@
-- I made a separate file for all the GUI related functions. Yay me.
require("lib/separate_spawns")
local SPAWN_GUI_MAX_WIDTH = 500
local SPAWN_GUI_MAX_HEIGHT = 1000
@ -34,13 +32,13 @@ function DisplayWelcomeTextGui(player)
wGui.style.maximal_height = SPAWN_GUI_MAX_HEIGHT
-- Start with server message.
-- AddLabel(wGui, "server_msg_lbl1", global.ocfg.server_rules, my_label_style)
AddLabel(wGui, "server_msg_lbl1", global.ocfg.server_info.server_msg, my_label_style)
-- AddLabel(wGui, "contact_info_msg_lbl1", global.ocfg.server_contact, my_label_style)
-- AddSpacer(wGui)
AddSpacer(wGui)
-- Informational message about the scenario
-- AddLabel(wGui, "scenario_info_msg_lbl1", SCENARIO_INFO_MSG, my_label_style)
-- AddSpacer(wGui)
AddLabel(wGui, "scenario_info_msg_lbl1", global.ocfg.server_info.welcome_msg, my_label_style)
AddSpacer(wGui)
-- Warning about spawn creation time
AddLabel(wGui, "spawn_time_msg_lbl1", { "oarc-spawn-time-warning-msg" }, my_warning_style)
@ -93,7 +91,7 @@ function DisplaySpawnOptions(player)
return
end
local mod_overlap = global.ocfg.mod_overlap
local gameplay = global.ocfg.gameplay
player.gui.screen.add { name = "spawn_opts",
type = "frame",
@ -130,8 +128,8 @@ function DisplaySpawnOptions(player)
-- Pick surface
if (mod_overlap.enable_spawning_on_other_surfaces) then
if (gameplay.enable_spawning_on_other_surfaces) then
local surfacesHorizontalFlow = soloSpawnFlow.add { name = "surfaces_horizontal_flow",
type = "flow",
direction = "horizontal" }
@ -152,7 +150,7 @@ function DisplaySpawnOptions(player)
end
-- Radio buttons to pick your team.
if (mod_overlap.enable_separate_teams) then
if (gameplay.enable_separate_teams) then
soloSpawnFlow.add { name = "isolated_spawn_main_team_radio",
type = "radiobutton",
caption = { "oarc-join-main-team-radio" },
@ -170,7 +168,7 @@ function DisplaySpawnOptions(player)
-- Allow players to spawn with a moat around their area.
--TODO: Vanilla spawn points are not implemented yet.
-- and not global.ocfg.enable_vanilla_spawns
if (mod_overlap.allow_moats_around_spawns) then
if (gameplay.allow_moats_around_spawns) then
soloSpawnFlow.add { name = "isolated_spawn_moat_option_checkbox",
type = "checkbox",
caption = { "oarc-moat-option" },
@ -213,7 +211,7 @@ function DisplaySpawnOptions(player)
type = "frame",
direction = "vertical",
style = "bordered_frame" }
if mod_overlap.enable_shared_spawns then
if gameplay.enable_shared_spawns then
local numAvailSpawns = GetNumberOfAvailableSharedSpawns()
if (numAvailSpawns > 0) then
sharedSpawnFrame.add { name = "join_other_spawn",
@ -235,7 +233,7 @@ function DisplaySpawnOptions(player)
-- Awesome buddy spawning system
---TODO: Vanilla spawn points are not implemented yet.
-- if (not global.ocfg.enable_vanilla_spawns) then
if mod_overlap.enable_shared_spawns and mod_overlap.enable_buddy_spawn then
if gameplay.enable_shared_spawns and gameplay.enable_buddy_spawn then
local buddySpawnFrame = sGui.add { name = "spawn_buddy_flow",
type = "frame",
direction = "vertical",
@ -251,17 +249,17 @@ function DisplaySpawnOptions(player)
-- end
-- Some final notes
if (mod_overlap.number_of_players_per_shared_spawn > 0) then
if (gameplay.number_of_players_per_shared_spawn > 0) then
AddLabel(sGui, "max_players_lbl2",
{ "oarc-max-players-shared-spawn", mod_overlap.number_of_players_per_shared_spawn - 1 },
{ "oarc-max-players-shared-spawn", gameplay.number_of_players_per_shared_spawn - 1 },
my_note_style)
end
local spawn_distance_notes = { "oarc-spawn-dist-notes",
mod_overlap.near_spawn_min_distance,
mod_overlap.near_spawn_max_distance,
mod_overlap.far_spawn_min_distance,
mod_overlap.far_spawn_max_distance }
gameplay.near_spawn_min_distance,
gameplay.near_spawn_max_distance,
gameplay.far_spawn_min_distance,
gameplay.far_spawn_max_distance }
AddLabel(sGui, "note_lbl1", spawn_distance_notes, my_note_style)
end
@ -309,8 +307,10 @@ function SpawnOptsGuiClick(event)
local pgcs = player.gui.screen.spawn_opts
local joinMainTeamRadio, joinOwnTeamRadio, moatChoice, vanillaChoice = false, false, false, false
local joinOwnTeamRadio, moatChoice = false, false
local surfaceName = global.ocfg.gameplay.default_surface
local surface = game.surfaces[surfaceName]
-- Check if a valid button on the gui was pressed
-- and delete the GUI
if ((elemName == "default_spawn_btn") or
@ -319,20 +319,23 @@ function SpawnOptsGuiClick(event)
(elemName == "join_other_spawn") or
(elemName == "buddy_spawn") or
(elemName == "join_other_spawn_check")) then
if (global.ocfg.mod_overlap.enable_separate_teams) then
joinMainTeamRadio =
pgcs.spawn_solo_flow.isolated_spawn_main_team_radio.state
joinOwnTeamRadio =
pgcs.spawn_solo_flow.isolated_spawn_new_team_radio.state
if (global.ocfg.gameplay.enable_separate_teams) then
joinMainTeamRadio = pgcs.spawn_solo_flow.isolated_spawn_main_team_radio.state
joinOwnTeamRadio = pgcs.spawn_solo_flow.isolated_spawn_new_team_radio.state
else
joinMainTeamRadio = true
joinOwnTeamRadio = false
end
---TODO: Vanilla spawn points are not implemented yet. and not global.ocfg.enable_vanilla_spawns
if (global.ocfg.mod_overlap.allow_moats_around_spawns and
if (global.ocfg.gameplay.allow_moats_around_spawns and
(pgcs.spawn_solo_flow.isolated_spawn_moat_option_checkbox ~= nil)) then
moatChoice = pgcs.spawn_solo_flow.isolated_spawn_moat_option_checkbox.state
end
surfaceDropdownIndex = pgcs.spawn_solo_flow.surfaces_horizontal_flow.surface_select_dropdown.selected_index
surfaceName = pgcs.spawn_solo_flow.surfaces_horizontal_flow.surface_select_dropdown.get_item(surfaceDropdownIndex) --[[@as string]]
surface = game.surfaces[surfaceName]
-- if (global.ocfg.enable_vanilla_spawns and
-- (pgcs.spawn_solo_flow.isolated_spawn_vanilla_option_checkbox ~= nil)) then
-- vanillaChoice = pgcs.spawn_solo_flow.isolated_spawn_vanilla_option_checkbox.state
@ -346,23 +349,27 @@ function SpawnOptsGuiClick(event)
if (elemName == "default_spawn_btn") then
GivePlayerStarterItems(player)
local surface = game.surfaces[global.ocfg.gameplay.main_force_surface]-- TODO: Add support for multiple surfaces?
local surface = game.surfaces[global.ocfg.gameplay.default_surface]-- TODO: Add support for multiple surfaces?
local spawnPosition = player.force.get_spawn_position(surface)
ChangePlayerSpawn(player, global.ocfg.gameplay.main_force_surface, spawnPosition)-- TODO: Add support for multiple surfaces?
ChangePlayerSpawn(player, global.ocfg.gameplay.default_surface, spawnPosition)-- TODO: Add support for multiple surfaces?
SendBroadcastMsg({ "oarc-player-is-joining-main-force", player.name })
ChartArea(player.force, player.position, math.ceil(global.ocfg.spawn_config.general.land_area_tiles / CHUNK_SIZE),
ChartArea(player.force, player.position, math.ceil(global.ocfg.surfaces_config[surface.name].spawn_config.general.spawn_radius_tiles / CHUNK_SIZE),
player.surface)
-- Unlock spawn control gui tab
SetOarcGuiTabEnabled(player, OARC_SPAWN_CTRL_GUI_NAME, true)
elseif ((elemName == "isolated_spawn_near") or (elemName == "isolated_spawn_far")) then
-- Create a new spawn point
local surface = game.surfaces[surfaceName]
local newSpawn = { x = 0, y = 0 }
local mod_overlap = global.ocfg.mod_overlap
local gameplay = global.ocfg.gameplay
-- Create a new force for player if they choose that radio button
if mod_overlap.enable_separate_teams and joinOwnTeamRadio then
if gameplay.enable_separate_teams and joinOwnTeamRadio then
local newForce = CreatePlayerCustomForce(player)
end
@ -383,29 +390,26 @@ function SpawnOptsGuiClick(event)
-- else
-- Find coordinates of a good place to spawn
if (elemName == "isolated_spawn_far") then
newSpawn = FindUngeneratedCoordinates(mod_overlap.far_spawn_min_distance, mod_overlap.far_spawn_max_distance,
player.surface)
newSpawn = FindUngeneratedCoordinates(gameplay.far_spawn_min_distance, gameplay.far_spawn_max_distance, surface)
elseif (elemName == "isolated_spawn_near") then
newSpawn = FindUngeneratedCoordinates(mod_overlap.near_spawn_min_distance,
mod_overlap.near_spawn_max_distance, player.surface)
newSpawn = FindUngeneratedCoordinates(gameplay.near_spawn_min_distance, gameplay.near_spawn_max_distance, surface)
end
-- end
-- If that fails, find a random map edge in a rand direction.
---TODO: Add support for multiple surfaces.
if ((newSpawn.x == 0) and (newSpawn.y == 0)) then
newSpawn = FindMapEdge(GetRandomVector(), game.surfaces[global.ocfg.gameplay.main_force_surface]) ---TODO: Add support for multiple surfaces.
newSpawn = FindMapEdge(GetRandomVector(), surface) ---TODO: Add support for multiple surfaces.
log("Resorting to find map edge! x=" .. newSpawn.x .. ",y=" .. newSpawn.y)
end
-- Create that player's spawn in the global vars
---TODO: Add support for multiple surfaces.
local temporarySurface = game.surfaces[global.ocfg.gameplay.main_force_surface]
ChangePlayerSpawn(player, global.ocfg.gameplay.main_force_surface, newSpawn)
ChangePlayerSpawn(player, surfaceName, newSpawn)
-- Send the player there
QueuePlayerForDelayedSpawn(player.name,
global.ocfg.gameplay.main_force_surface, ---TODO: Add support for multiple surfaces.
global.ocfg.gameplay.default_surface, ---TODO: Add support for multiple surfaces.
newSpawn,
moatChoice,
false) -- global.ocfg.enable_vanilla_spawns --TODO: Vanilla spawn points are not implemented yet.
@ -457,13 +461,11 @@ function DisplaySharedSpawnOptions(player)
for spawnName, sharedSpawn in pairs(global.ocore.sharedSpawns) do
-- Disabled for testing. TODO: Renable this later!
-- if (sharedSpawn.openAccess and
-- (game.players[spawnName] ~= nil) and
-- game.players[spawnName].connected) then
if sharedSpawn.openAccess then
local spotsRemaining = global.ocfg.mod_overlap.number_of_players_per_shared_spawn - TableLength(global.ocore.sharedSpawns[spawnName].players)
if (global.ocfg.mod_overlap.number_of_players_per_shared_spawn == 0) then
if (sharedSpawn.openAccess and
(game.players[spawnName] ~= nil) and
game.players[spawnName].connected) then
local spotsRemaining = global.ocfg.gameplay.number_of_players_per_shared_spawn - TableLength(global.ocore.sharedSpawns[spawnName].players)
if (global.ocfg.gameplay.number_of_players_per_shared_spawn == 0) then
shGui.add { type = "button", caption = spawnName, name = spawnName }
elseif (spotsRemaining > 0) then
shGui.add { type = "button", caption = { "oarc-spawn-spots-remaining", spawnName, spotsRemaining }, name = spawnName }
@ -604,25 +606,6 @@ local function IsSharedSpawnActive(player)
end
end
-- ---Get a random shared spawn point to go to
-- --- TODO: Add support for multiple surfaces. Useful function for testing.
-- function GetRandomSpawnPoint()
-- local numSpawnPoints = TableLength(global.ocore.sharedSpawns)
-- if (numSpawnPoints > 0) then
-- local randSpawnNum = math.random(1,numSpawnPoints)
-- local counter = 1
-- for _,sharedSpawn in pairs(global.ocore.sharedSpawns) do
-- if (randSpawnNum == counter) then
-- return sharedSpawn.position
-- end
-- counter = counter + 1
-- end
-- end
-- return {x=0,y=0}
-- end
---Provides the content of the spawn control tab in the Oarc GUI.
---@param tab_container LuaGuiElement
---@param player LuaPlayer
@ -636,7 +619,7 @@ function CreateSpawnCtrlGuiTab(tab_container, player)
spwnCtrls.style.maximal_height = SPAWN_GUI_MAX_HEIGHT
spwnCtrls.horizontal_scroll_policy = "never"
if global.ocfg.mod_overlap.enable_shared_spawns then
if global.ocfg.gameplay.enable_shared_spawns then
if (global.ocore.uniqueSpawns[player.name] ~= nil) then
-- This checkbox allows people to join your base when they first
-- start the game.
@ -666,7 +649,7 @@ function CreateSpawnCtrlGuiTab(tab_container, player)
AddLabel(spwnCtrls, "respawn_cooldown_note2", { "oarc-set-respawn-note" }, my_note_style)
-- Display a list of people in the join queue for your base.
if (global.ocfg.mod_overlap.enable_shared_spawns and IsSharedSpawnActive(player)) then
if (global.ocfg.gameplay.enable_shared_spawns and IsSharedSpawnActive(player)) then
if (TableLength(global.ocore.sharedSpawns[player.name].joinQueue) > 0) then
AddLabel(spwnCtrls, "drop_down_msg_lbl1", { "oarc-select-player-join-queue" }, my_label_style)
spwnCtrls.add { name = "join_queue_dropdown",
@ -844,8 +827,8 @@ function DisplayBuddySpawnOptions(player)
buddyGui.style.maximal_width = SPAWN_GUI_MAX_WIDTH
buddyGui.style.maximal_height = SPAWN_GUI_MAX_HEIGHT
---@type OarcConfigModSettings
local mod_overlap = global.ocfg.mod_overlap
---@type OarcConfigGameplaySettings
local gameplay = global.ocfg.gameplay
-- Warnings and explanations...
AddLabel(buddyGui, "buddy_info_msg", { "oarc-buddy-spawn-instructions" }, my_label_style)
@ -875,7 +858,7 @@ function DisplayBuddySpawnOptions(player)
-- AddSpacerLine(buddySpawnFlow)
-- Allow picking of teams
if (mod_overlap.enable_separate_teams) then
if (gameplay.enable_separate_teams) then
buddySpawnFlow.add { name = "buddy_spawn_main_team_radio",
type = "radiobutton",
caption = { "oarc-join-main-team-radio" },
@ -889,7 +872,7 @@ function DisplayBuddySpawnOptions(player)
caption = { "oarc-create-buddy-team" },
state = false }
end
if (mod_overlap.allow_moats_around_spawns) then
if (gameplay.allow_moats_around_spawns) then
buddySpawnFlow.add { name = "buddy_spawn_moat_option_checkbox",
type = "checkbox",
caption = { "oarc-moat-option" },
@ -914,17 +897,17 @@ function DisplayBuddySpawnOptions(player)
-- Some final notes
AddSpacerLine(buddyGui)
if (mod_overlap.number_of_players_per_shared_spawn > 0) then
if (gameplay.number_of_players_per_shared_spawn > 0) then
AddLabel(buddyGui, "buddy_max_players_lbl1",
{ "oarc-max-players-shared-spawn", mod_overlap.number_of_players_per_shared_spawn - 1 },
{ "oarc-max-players-shared-spawn", gameplay.number_of_players_per_shared_spawn - 1 },
my_note_style)
end
local spawn_distance_notes = {
"oarc-spawn-dist-notes",
mod_overlap.near_spawn_min_distance,
mod_overlap.near_spawn_max_distance,
mod_overlap.far_spawn_min_distance,
mod_overlap.far_spawn_max_distance
gameplay.near_spawn_min_distance,
gameplay.near_spawn_max_distance,
gameplay.far_spawn_min_distance,
gameplay.far_spawn_max_distance
}
AddLabel(buddyGui, "note_lbl1", spawn_distance_notes, my_note_style)
end
@ -1007,7 +990,7 @@ function BuddySpawnOptsGuiClick(event)
---@type BuddySpawnChoice
local buddyTeamRadioSelection = nil
if (global.ocfg.mod_overlap.enable_separate_teams) then
if (global.ocfg.gameplay.enable_separate_teams) then
if buddySpawnGui.buddy_spawn_main_team_radio.state then
buddyTeamRadioSelection = BUDDY_SPAWN_CHOICE.join_main_team
elseif buddySpawnGui.buddy_spawn_new_team_radio.state then
@ -1019,7 +1002,7 @@ function BuddySpawnOptsGuiClick(event)
buddyTeamRadioSelection = BUDDY_SPAWN_CHOICE.join_main_team
end
if (global.ocfg.mod_overlap.allow_moats_around_spawns) then
if (global.ocfg.gameplay.allow_moats_around_spawns) then
moatChoice = buddySpawnGui.buddy_spawn_moat_option_checkbox.state
end
@ -1248,21 +1231,21 @@ function BuddySpawnRequestMenuClick(event)
player.force = buddyForce
end
---@type OarcConfigModSettings
local mod_overlap = global.ocfg.mod_overlap
---@type OarcConfigGameplaySettings
local gameplay = global.ocfg.gameplay
local tempSurface = game.surfaces[global.ocfg.gameplay.main_force_surface]
local tempSurface = game.surfaces[global.ocfg.gameplay.default_surface]
-- Find coordinates of a good place to spawn
---TODO: Add support for multiple surfaces.
if (requesterOptions.distChoice == "buddy_spawn_request_far") then
newSpawn = FindUngeneratedCoordinates(mod_overlap.far_spawn_min_distance,
mod_overlap.far_spawn_max_distance,
newSpawn = FindUngeneratedCoordinates(gameplay.far_spawn_min_distance,
gameplay.far_spawn_max_distance,
tempSurface)
elseif (requesterOptions.distChoice == "buddy_spawn_request_near") then
newSpawn = FindUngeneratedCoordinates(
mod_overlap.near_spawn_min_distance,
mod_overlap.near_spawn_max_distance,
gameplay.near_spawn_min_distance,
gameplay.near_spawn_max_distance,
tempSurface)
end
@ -1276,18 +1259,18 @@ function BuddySpawnRequestMenuClick(event)
local buddySpawn = { x = 0, y = 0 }
if (requesterOptions.moatChoice) then
buddySpawn = {
x = newSpawn.x + (global.ocfg.spawn_config.general.land_area_tiles * 2) + 10,
x = newSpawn.x + (global.ocfg.surfaces_config[tempSurface.name].spawn_config.general.spawn_radius_tiles * 2) + 10,
y = newSpawn.y
}
else
buddySpawn = { x = newSpawn.x + (global.ocfg.spawn_config.general.land_area_tiles * 2), y = newSpawn.y }
buddySpawn = { x = newSpawn.x + (global.ocfg.surfaces_config[tempSurface.name].spawn_config.general.spawn_radius_tiles * 2), y = newSpawn.y }
end
ChangePlayerSpawn(player, global.ocfg.gameplay.main_force_surface, newSpawn) --TODO: Add support for multiple surfaces
ChangePlayerSpawn(game.players[requesterName], global.ocfg.gameplay.main_force_surface, buddySpawn)
ChangePlayerSpawn(player, global.ocfg.gameplay.default_surface, newSpawn) --TODO: Add support for multiple surfaces
ChangePlayerSpawn(game.players[requesterName], global.ocfg.gameplay.default_surface, buddySpawn)
-- Send the player there
QueuePlayerForDelayedSpawn(player.name, global.ocfg.gameplay.main_force_surface, newSpawn, requesterOptions.moatChoice, false)
QueuePlayerForDelayedSpawn(requesterName, global.ocfg.gameplay.main_force_surface, buddySpawn, requesterOptions.moatChoice, false)
QueuePlayerForDelayedSpawn(player.name, global.ocfg.gameplay.default_surface, newSpawn, requesterOptions.moatChoice, false)
QueuePlayerForDelayedSpawn(requesterName, global.ocfg.gameplay.default_surface, buddySpawn, requesterOptions.moatChoice, false)
SendBroadcastMsg(requesterName .. " and " .. player.name .. " are joining the game together!")
-- Unlock spawn control gui tab

View File

@ -0,0 +1,68 @@
[mod-description]
oarc-mod=This is a multiplayer mod that allows every player to create their own spawn point when they join the game. There are a lot of helpful features to ensure that new players can join at anytime in the game or even join other player's spawn areas.\n\n[color=red][font=default-bold]Please check out the github page and discord for more information and support.[/font][/color]\n\n[font=italic]This USED to be available as a scenario, but now is only provided as a mod. The scenario included in this mod only provides a way to overwrite the default freeplay scenario. It also provides a way for experienced server hosts to configure settings from a file instead of through the usual mod settings. Please read the control.lua file inside the scenario for notes.[/font]
[mod-setting-name]
oarc-mod-welcome-msg-title=Welcome Message Title
oarc-mod-welcome-msg=Game Welcome Message
oarc-mod-server-msg=Server Welcome Message
oarc-mod-enable-main-team=Enable main team
oarc-mod-enable-separate-teams=Enable separate teams
oarc-mod-enable-spawning-on-other-surfaces=Allow starting on other surfaces
oarc-mod-allow-moats-around-spawns=Allow moats around spawns
oarc-mod-enable-moat-bridging=Moat bridges
oarc-mod-minimum-distance-to-existing-chunks=Minimum distance to existing chunks
oarc-mod-near-spawn-min-distance=Near spawn minimum distance
oarc-mod-near-spawn-max-distance=Near spawn maximum distance
oarc-mod-far-spawn-min-distance=Far spawn minimum distance
oarc-mod-far-spawn-max-distance=Far spawn maximum distance
oarc-mod-enable-buddy-spawn=Enable buddy spawn
oarc-mod-enable-offline-protection=Offline protection
oarc-mod-enable-shared-team-vision=Shared team vision
oarc-mod-enable-shared-team-chat=Shared team chat
oarc-mod-enable-shared-spawns=Shared spawns
oarc-mod-number-of-players-per-shared-spawn=Number of players per shared spawn
oarc-mod-enable-friendly-fire=Enable friendly fire
oarc-mod-main-force-name=Main force name
oarc-mod-default-surface=Default starting surface
oarc-mod-scale-resources-around-spawns=Scale resources around spawns
oarc-mod-modified-enemy-spawning=Scale enemies around spawns
oarc-mod-minimum-online-time=Minimum online time
oarc-mod-respawn-cooldown-min=Reset respawn point cooldown
oarc-mod-enable-regrowth=Regrowth (map cleanup)
oarc-mod-enable-world-eater=World eater (map cleanup - additional)
oarc-mod-enable-abandoned-base-cleanup=Cleanup abandoned bases
[mod-setting-description]
oarc-mod-welcome-msg-title=This is the title of the welcome message that will be displayed to players when they join the game.
oarc-mod-welcome-msg=This is the welcome message that will be displayed to players when they join the game.
oarc-mod-server-msg=This is an additional message that will be displayed to players when they join the game.
oarc-mod-enable-main-team=Allow players to join the main team. This is the default team that is created when the game starts.
oarc-mod-enable-separate-teams=Allow players to start their own teams (CO-OP only, No PVP).\n[color=red][font=default-bold]You must enable one or both of the main team and separate team options. Otherwise it will default to main team allowed only.[/font][/color]
oarc-mod-enable-spawning-on-other-surfaces=Allow spawning on other surfaces.
oarc-mod-allow-moats-around-spawns=Allow players to choose spawns with a moat around them.
oarc-mod-enable-moat-bridging=If the spawn area is surrounded by land, the moat will have a small land bridge connecting it.
oarc-mod-minimum-distance-to-existing-chunks=This is the minimum distance a new spawn will be created from existing chunks (even if not visible).
oarc-mod-near-spawn-min-distance=The minimum distance to start looking for a new "near" spawn location. Near and far are relative to the center of the map.
oarc-mod-near-spawn-max-distance=The maximum distance to start looking for a new "near" spawn location. Near and far are relative to the center of the map.
oarc-mod-far-spawn-min-distance=The minimum distance to start looking for a new "far" spawn location. Near and far are relative to the center of the map.
oarc-mod-far-spawn-max-distance=The maximum distance to start looking for a new "far" spawn location. Near and far are relative to the center of the map.
oarc-mod-enable-buddy-spawn=Allow spawning with a buddy. 2 players can spawn next to each other with their own starting areas.
oarc-mod-enable-offline-protection=This inhibits enemy attacks on bases where all players are offline. Not 100% guaranteed!
oarc-mod-enable-shared-team-vision=Makes sure all teams can see each other's map and radar coverage.
oarc-mod-enable-shared-team-chat=All teams can see each other's chat messages.
oarc-mod-enable-shared-spawns=Allow players to share their spawn areas for other players to join.
oarc-mod-number-of-players-per-shared-spawn=Number of players that can join a shared spawn, including the original player.
oarc-mod-enable-friendly-fire=Enables friendly fire. So you can shoot your chests (or run over your friends with a train).
oarc-mod-enable-regrowth=Enables regrowth. This slowly removes inactive chunks over time. Any chunk with player structures will not be removed. This helps to keep the map (and file size) smaller over time.
oarc-mod-enable-world-eater=Enables world eater. This is requires and is part of regrowth. This slowly checks all chunks for a lack of player structures and entities and marks them for removal. This helps to keep the map (and file size) smaller over time. This is more of an experimental feature, use at your own risk.
oarc-mod-enable-abandoned-base-cleanup=Abandoned bases will be cleaned up if players leave within a short time of joining.

View File

@ -1,52 +1,117 @@
[mod-description]
oarc-mod=TEST TEST This mod provides a scenario that overhauls multiplayer spawning.\n[color=red][font=default-bold]Please check out the github page and discord for more information and support.[/font][/color]
scenario-name=OARC
[mod-setting-name]
oarc-mod-scenario-config-note=Scenario note (lease read!)
oarc-mod-enable-main-team=Enable main team
oarc-mod-enable-separate-teams=Enable separate teams
oarc-mod-enable-buddy-spawn=Enable buddy spawn
oarc-mod-enable-spawning-on-other-surfaces=Allow starting on other surfaces
oarc-mod-enable-regrowth=Regrowth (map cleanup)
oarc-mod-enable-offline-protection=Offline protection
oarc-mod-enable-shared-team-vision=Shared team vision
oarc-mod-enable-shared-team-chat=Shared team chat
oarc-mod-enable-shared-spawns=Shared spawns
oarc-mod-number-of-players-per-shared-spawn=Number of players per shared spawn
oarc-mod-enable-abandoned-base-cleanup=Cleanup abandoned bases
oarc-mod-enable-friendly-fire=Enable friendly fire
oarc-mod-enable-allow-moats-around-spawns=Allow moats around spawns
oarc-mod-enable-force-bridges-next-to-moats=Moat bridges
oarc-mod-minimum-distance-to-existing-chunks=Minimum distance to existing chunks
oarc-mod-near-spawn-min-distance=Near spawn minimum distance
oarc-mod-near-spawn-max-distance=Near spawn maximum distance
oarc-mod-far-spawn-min-distance=Far spawn minimum distance
oarc-mod-far-spawn-max-distance=Far spawn maximum distance
description=This mod provides a scenario that overhauls multiplayer spawning.\n[color=red][font=default-bold]Please check out the github page and discord for more information and support.[/font][/color]
[mod-setting-description]
oarc-mod-scenario-config-note=[color=red]This is not an actual mod setting![/color]\n It is just a note regarding further customization available:\n Additional settings can be found in the scenario config file. See config.lua for more info. The scenario can be directly run without the mod to allow for further customization. Please see the mod portal or github page for more information and contact info.
oarc-mod-enable-main-team=Allow players to join a "main team" with all other players.\n[font=default-bold]You must enable one or both of the main team and separate team options. Otherwise it will default to main team allowed only.[/font][/color]
oarc-mod-enable-separate-teams=Allow players to start their own teams (CO-OP only, No PVP).\n[color=red][font=default-bold]You must enable one or both of the main team and separate team options. Otherwise it will default to main team allowed only.[/font][/color]
oarc-mod-enable-buddy-spawn=Allow spawning with a buddy. 2 players can spawn next to each other with their own starting areas.
oarc-mod-enable-spawning-on-other-surfaces=Allow spawning on other surfaces.
oarc-mod-enable-regrowth=Enables regrowth. This slowly removes inactive chunks over time. Any chunk with player structures will not be removed. This helps to keep the map (and file size) smaller over time.
oarc-mod-enable-offline-protection=This inhibits enemy attacks on bases where all players are offline. Not 100% guaranteed!
oarc-mod-enable-shared-team-vision=Makes sure all teams can see each other's map and radar coverage.
oarc-mod-enable-shared-team-chat=All teams can see each other's chat messages.
oarc-mod-enable-shared-spawns=Allow players to share their spawn areas for other players to join.
oarc-mod-number-of-players-per-shared-spawn=Number of players that can join a shared spawn, including the original player.
oarc-mod-enable-abandoned-base-cleanup=Abandoned bases will be cleaned up if players leave within a short time of joining.
oarc-mod-enable-friendly-fire=Enables friendly fire. So you can shoot your chests (or run over your friends with a train).
oarc-mod-enable-allow-moats-around-spawns=Allow players to choose spawns with a moat around them.
oarc-mod-enable-force-bridges-next-to-moats=If spawn is surrounded by land, the moat will have a small land bridge connecting it.
oarc-mod-minimum-distance-to-existing-chunks=This is the minimum distance a new spawn will be created from existing chunks (even if not visible).
oarc-mod-near-spawn-min-distance=The minimum distance to start looking for a new "near" spawn location. Near and far are relative to the center of the map.
oarc-mod-near-spawn-max-distance=The maximum distance to start looking for a new "near" spawn location. Near and far are relative to the center of the map.
oarc-mod-far-spawn-min-distance=The minimum distance to start looking for a new "far" spawn location. Near and far are relative to the center of the map.
oarc-mod-far-spawn-max-distance=The maximum distance to start looking for a new "far" spawn location. Near and far are relative to the center of the map.
oarc-spawn-time-warning-msg=Due to the way this scenario works, it may take some time for the land around your new spawn area to generate... Please wait for 10-20 seconds when you select your first spawn.
[string-mod-setting]
oarc-mod-scenario-config-note-message-info=<-- Hover for tooltip message!
oarc-i-understand=I Understand
oarc-spawn-options=Spawn Options
[string-mod-setting-description]
oarc-mod-scenario-config-note-message-info=Additional settings can be found in the scenario config file. See config.lua for more info. The scenario can be directly run without the mod to allow for further customization. Please see the mod portal or github page for more information and contact info.
oarc-click-info-btn-help=Click the INFO button in the top left to learn more about this scenario! This is your ONLY chance to choose a spawn option. Choose carefully...
oarc-vanilla-spawn=Vanilla Spawn
oarc-default-spawn-behavior=This is the default spawn behavior of a vanilla game. You join the default team in the center of the map.
oarc-join-main-team-radio=Join Main Team (shared research)
oarc-create-own-team-radio=Create Your Own Team (own research tree)
oarc-moat-option=Surround your spawn with a moat
oarc-solo-spawn-near=Solo Spawn (Near)
oarc-solo-spawn-far=Solo Spawn (Far)
oarc-starting-area-vanilla=You are spawned in your own starting area (vanilla style).
oarc-vanilla-spawns-available=There are __1__ vanilla spawns available.
oarc-starting-area-normal=You are spawned in a new area, with pre-set starting resources.
oarc-join-someone-avail=Join Someone (__1__ available)
oarc-join-someone-info=You are spawned in someone else's base. This requires at least 1 person to have allowed access to their base. This choice is final and you will not be able to create your own spawn later.
oarc-no-shared-avail=There are currently no shared bases availble to spawn at.
oarc-join-check-again=Check Again
oarc-shared-spawn-disabled=Shared spawns are disabled in this mode.
oarc-buddy-spawn=Buddy Spawn
oarc-buddy-spawn-info=The buddy system requires 2 players in this menu at the same time, you spawn beside each other, each with your own resources.
oarc-max-players-shared-spawn=If you create your own spawn point you can allow up to __1__ other online players to join.
oarc-spawn-dist-notes=Near spawn is between __1__-__2__ chunks away from the center of the map.\nFar spawn is between __3__-__4__ chunks away from the center of the map.\nSolo spawns are dangerous! Expect a fight to reach other players.
oarc-player-is-joining-main-force=__1__ is joining the main force!
oarc-player-is-joining-near=__1__ is joining the game from a distance!
oarc-player-is-joining-far=__1__ is joining the game from a great distance!
oarc-please-wait=PLEASE WAIT WHILE YOUR SPAWN POINT IS GENERATED!
oarc-looking-for-buddy=__1__ is looking for a buddy.
oarc-avail-bases-join=Available Bases to Join:
oarc-spawn-spots-remaining=__1__ (__2__ spots remaining)
oarc-cancel-return-to-previous=Cancel (Return to Previous Options)
oarc-player-requesting-join-you=__1__ is requesting to join your base!
oarc-waiting-for-spawn-owner=Waiting for spawn owner to respond...
oarc-you-will-spawn-once-host=You will spawn once the host selects yes...
oarc-player-cancel-join-request=__1__ cancelled their request to join your spawn.
oarc-spawn-ctrl=Spawn Ctrl
oarc-spawn-controls=Spawn Controls:
oarc-spawn-allow-joiners=Allow others to join your base.
oarc-set-respawn-loc=Set New Respawn Location (has a cooldown)
oarc-set-respawn-loc-cooldown=Set Respawn Cooldown Remaining: __1__
oarc-set-respawn-note=This will set your respawn point to your current location.
oarc-select-player-join-queue=Select a player from the join queue:
oarc-accept=Accept
oarc-reject=Reject
oarc-no-player-join-reqs=You have no players requesting to join you at this time.
oarc-start-shared-base=New players can now join __1__'s base!
oarc-stop-shared-base=New players can no longer join __1__'s base!
oarc-spawn-point-updated=Re-spawn point updated!
oarc-selected-player-not-wait=Selected player is no longer waiting to join!
oarc-reject-joiner=You rejected __1__'s request to join your base.
oarc-your-request-rejected=Your request to join was rejected.
oarc-player-joining-base=__1__ is joining __2__'s base!
oarc-player-left-while-joining=__1__ left the game. What an ass.
oarc-buddy-spawn-options=Buddy Spawn Options
oarc-buddy-spawn-instructions=To use this, make sure you and your buddy are in this menu at the same time. Only one of you must send the request. Select your buddy from the list (refresh if your buddy's name is not visible) and select your spawn options. Click one of the request buttons to send the request. The other buddy can then accept (or deny) the request. This will allow you both to spawn next to each other, each with your own spawn area. Once a buddy accepts a spawn request, it is final!
oarc-buddy-select-info=First, select a buddy from the waiting list. Then choose the spawn options and send your request:
oarc-buddy-refresh=Refresh Buddy List
oarc-create-buddy-team=Create Your Own Buddy Team (buddy and you share research)
oarc-buddy-spawn-near=Request Buddy Spawn (Near)
oarc-buddy-spawn-far=Request Buddy Spawn (Far)
oarc-invalid-buddy=You have not selected a valid buddy! Please try again.
oarc-buddy-not-avail=Selected buddy is no longer available! Please try again.
oarc-waiting-for-buddy=Waiting for buddy to respond...
oarc-wait-buddy-select-yes=You will spawn once your buddy selects yes...
oarc-buddy-cancel-request=__1__ cancelled their buddy request!
oarc-buddy-requesting-from-you=__1__ is requesting a buddy spawn from you!
oarc-buddy-txt-main-team=the main team
oarc-buddy-txt-new-teams=on separate teams
oarc-buddy-txt-buddy-team=a buddy team
oarc-buddy-txt-moat= surrounded by a moat
oarc-buddy-txt-near=near to the center of the map!
oarc-buddy-txt-far=far from the center of the map!
oarc-buddy-txt-would-like= would like to join
oarc-buddy-txt-next-to-you= next to you
oarc-buddy-declined=__1__ declined your buddy request!
oarc-spawn-wait=Please wait!
oarc-wait-text=Your spawn is being created now.\nYou will be teleported there in __1__ seconds!\nPlease standby...

View File

@ -1,7 +1,3 @@
scenario-name=OARC
description=This mod provides a scenario that overhauls multiplayer spawning.\n[color=red][font=default-bold]Please check out the github page and discord for more information and support.[/font][/color]
oarc-spawn-time-warning-msg=Due to the way this scenario works, it may take some time for the land around your new spawn area to generate... Please wait for 10-20 seconds when you select your first spawn.
oarc-i-understand=I Understand

View File

@ -1,8 +1,4 @@
scenario-name=Oarc多人游戏场景。
description=该场景允许每个玩家在加入游戏时创建自己的生成点。这里有许多便利功能,确保新玩家可以随时加入游戏或加入其他玩家的队伍。这是一个仅限多人游戏的场景。\n[color=red][font=default-bold]首先您必须创建一个config.lua文件,如果还没有的话![/font][/color]\n在场景文件夹内,复制"example-config.lua"并将其命名为"config.lua"。用任何文本编辑器编辑该文件。这是唯一配置场景选项的方法,必须在开始新游戏之前完成。\n[color=yellow][font=default-bold]更改配置或更新场景时,请始终开始新游戏![/font][/color]\n请访问https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn获取场景源代码、Wiki以及提交任何错误报告。Wiki上有关于如何在专用/无头服务器上最佳开始游戏的说明。\n[color=yellow][font=default-bold]如果你是从模组门户或通过加入服务器得到这个场景的,确保在场景文件夹中删除任何blueprint.zip文件![/font][/color]
oarc-spawn-time-warning-msg=由于这个场景的运作方式,你新出生点周围的土地可能需要一些时间来生成...当你选择你的第一个生成点时,请等待10-20秒。
oarc-spawn-time-warning-msg=由于这个场景的运作方式,你新出生点周围的土地可能需要一些时间来生成...当你选择你的第一个生成点时,请等待10-20秒。
oarc-i-understand=我明白了
oarc-spawn-options=生成选项

Binary file not shown.

View File

@ -1,227 +1,37 @@
-- control.lua
-- Aug 2024
-- ____ _____ _____
-- / __ \ /\ | __ \ / ____|
-- | | | | / \ | |__) | |
-- | | | |/ /\ \ | _ /| |
-- | |__| / ____ \| | \ \| |____
-- \____/_/ \_\_| \_\\_____|
-- I provide this empty scenario to avoid the freeplay scenario extra baggage.
-- You can use the freeplay scenario too just fine if you want.
-- The main benefit of the scenario is that it lets you modify the any of the config during on_init of the mod.
-- Oarc's Separated Spawn Scenario V2
-- I decided to rewrite my old scenario due to the coming changes in Factorio V2.0 and its new Space Age Expansion.
-- This is where you can modify what resources spawn, how much, where, etc.
-- Once you have a config you like, it's a good idea to save it for later use so you don't lose it if you update the
-- scenario. I will try to avoid making breaking changes to this, but no guarantees.
-- Change Overview:
-- Removed a lot of unnecessary feature bloat.
-- Support the scenario "as a mod" properly from the start. (Keep support for scenario as well.)
-- Move text to locale files where possible.
-- To see what settings are available, look at the config_mod.lua file in the mod folder.
-- Feature List:
-- Core feature allows for a safe, separate spawn area for each player.
-- Players can choose to spawn with friends (buddy spawn) or join other bases.
-- Offline protection from enemy attacks.
-- Chunk cleanup to keep save file size down.
-- (TENTATIVE) Support for multiple vanilla-style spawn points.
-- TODO NOTES:
-- Add more tooltips?!
-- on_runtime_mod_setting_changed
-- Start Flow:
-- Display scenario welcome info.
-- Display main spawn options.
-- Display buddy spawn options. (OPTIONAL)
-- Create spawn area.
-- Send player to spawn area.
-- Options Menu:
-- Display scenario info. (Dupe of welcome info?)
-- Admin tools to restart or ban players.
-- Personal settings for player (Allow shared base)
require("lib/oarc_utils")
require("config")
require("lib/config_parser")
require("lib/game_opts")
require("lib/regrowth_map")
require("lib/holding_pen")
require("lib/separate_spawns")
require("lib/separate_spawns_guis")
require("lib/oarc_gui_tabs")
--------------------------------------------------------------------------------
-- On Init - Only runs once the first time the game starts
--------------------------------------------------------------------------------
-- Check if the OARC mod is loaded. Other than that, it's an empty scenario!
script.on_init(function(event)
ValidateAndLoadConfig()
RegrowthInit()
-- Test create some other surfaces
-- TODO: Remove this later.
game.create_surface("vulcanus")
game.create_surface("fulgora")
game.create_surface("gleba")
game.create_surface("aquilo")
InitSpawnGlobalsAndForces()
CreateHoldingPenSurface() -- Must be after init spawn globals?
end)
----------------------------------------
-- Player Events
----------------------------------------
script.on_event(defines.events.on_player_created, function(event)
local player = game.players[event.player_index]
player.teleport({x=0,y=0}, HOLDING_PEN_SURFACE_NAME)
SeparateSpawnsInitPlayer(event.player_index, true)
end)
script.on_event(defines.events.on_player_respawned, function(event)
SeparateSpawnsPlayerRespawned(event)
end)
script.on_event(defines.events.on_player_left_game, function(event)
SeparateSpawnsPlayerLeft(event)
end)
----------------------------------------
-- On tick events. Stuff that needs to happen at regular intervals.
-- Delayed events, delayed spawns, ...
----------------------------------------
script.on_event(defines.events.on_tick, function(event)
DelayedSpawnOnTick()
FadeoutRenderOnTick()
if global.ocfg.mod_overlap.enable_regrowth then
RegrowthOnTick()
RegrowthForceRemovalOnTick()
if not game.active_mods["oarc-mod"] then
error("OARC mod not found! This scenario is intended to be run with the OARC mod!")
end
end)
----------------------------------------
-- Chunk Generation
----------------------------------------
script.on_event(defines.events.on_chunk_generated, function(event)
CreateHoldingPenChunks(event.surface, event.area)
SeparateSpawnsGenerateChunk(event)
-- TODO: Decide if this should always be enabled (to track chunks).
if global.ocfg.mod_overlap.enable_regrowth then
RegrowthChunkGenerate(event)
end
end)
local oarc_scenario_interface =
{
get_scenario_settings = function()
script.on_event(defines.events.on_sector_scanned, function (event)
if global.ocfg.mod_overlap.enable_regrowth then
RegrowthSectorScan(event)
end
end)
---@type OarcConfig
local modified_settings = remote.call("oarc_mod", "get_mod_settings")
----------------------------------------
-- Surface Generation
----------------------------------------
-- This is not called when the default surface "nauvis" is created as it will always exist!
script.on_event(defines.events.on_surface_created, function(event)
log("Surface created: " .. game.surfaces[event.surface_index].name)
SeparateSpawnsSurfaceCreated(event)
-- RegrowthSurfaceCreated(event)
end)
-- Overwrite whatever settings you want here:
modified_settings.gameplay.main_force_name = "test"
script.on_event(defines.events.on_surface_deleted, function(event)
log("Surface deleted: " .. game.surfaces[event.surface_index].name)
SeparateSpawnsSurfaceDeleted(event)
-- RegrowthSurfaceDeleted(event)
end)
modified_settings.surfaces_config["nauvis"].starting_items.player_start_items = {
["coal"] = 1,
}
----------------------------------------
-- Various on "built" events
----------------------------------------
script.on_event(defines.events.on_built_entity, function(event)
if global.ocfg.mod_overlap.enable_regrowth then
-- if (event.created_entity.surface.name ~= GAME_SURFACE_NAME) then return end
RegrowthMarkAreaSafeGivenTilePos(event.created_entity.position, 2, false)
end
return modified_settings
end
}
-- if global.ocfg.enable_anti_grief then
-- SetItemBlueprintTimeToLive(event)
-- end
end)
script.on_event(defines.events.on_robot_built_entity, function (event)
if global.ocfg.mod_overlap.enable_regrowth then
-- if (event.created_entity.surface.name ~= GAME_SURFACE_NAME) then return end
RegrowthMarkAreaSafeGivenTilePos(event.created_entity.position, 2, false)
end
end)
script.on_event(defines.events.on_player_built_tile, function (event)
if global.ocfg.mod_overlap.enable_regrowth then
-- if (game.surfaces[event.surface_index].name ~= GAME_SURFACE_NAME) then return end
for k,v in pairs(event.tiles) do
RegrowthMarkAreaSafeGivenTilePos(v.position, 2, false)
end
end
end)
----------------------------------------
-- On script_raised_built. This should help catch mods that
-- place items that don't count as player_built and robot_built.
-- Specifically FARL.
----------------------------------------
script.on_event(defines.events.script_raised_built, function(event)
if global.ocfg.mod_overlap.enable_regrowth then
-- if (event.entity.surface.name ~= GAME_SURFACE_NAME) then return end
RegrowthMarkAreaSafeGivenTilePos(event.entity.position, 2, false)
end
end)
----------------------------------------
-- On Entity Spawned and On Biter Base Built
-- This is where I modify biter spawning based on location and other factors.
----------------------------------------
script.on_event(defines.events.on_entity_spawned, function(event)
if (global.ocfg.gameplay.oarc_modified_enemy_spawning) then
ModifyEnemySpawnsNearPlayerStartingAreas(event)
end
end)
script.on_event(defines.events.on_biter_base_built, function(event)
if (global.ocfg.gameplay.oarc_modified_enemy_spawning) then
ModifyEnemySpawnsNearPlayerStartingAreas(event)
end
end)
----------------------------------------
-- Gui Events
----------------------------------------
script.on_event(defines.events.on_gui_click, function(event)
WelcomeTextGuiClick(event)
SpawnOptsGuiClick(event)
SpawnCtrlGuiClick(event)
SharedSpwnOptsGuiClick(event)
BuddySpawnOptsGuiClick(event)
BuddySpawnWaitMenuClick(event)
BuddySpawnRequestMenuClick(event)
SharedSpawnJoinWaitMenuClick(event)
ClickOarcGuiButton(event)
GameOptionsGuiClick(event)
end)
--- Called when LuaGuiElement checked state is changed (related to checkboxes and radio buttons).
script.on_event(defines.events.on_gui_checked_state_changed, function (event)
SpawnOptsRadioSelect(event)
SpawnCtrlGuiOptionsSelect(event)
end)
script.on_event(defines.events.on_gui_selected_tab_changed, function (event)
TabChangeOarcGui(event)
end)
-- For capturing player escaping custom GUI so we can close it using ESC key.
script.on_event(defines.events.on_gui_closed, function(event)
OarcGuiOnGuiClosedEvent(event)
end)
remote.add_interface("oarc_scenario", oarc_scenario_interface)

View File

@ -1,62 +0,0 @@
-- config_parser.lua
-- Aug 2024
-- This file is used to validate the config.lua file and handle any mod conflicts.
function ValidateAndLoadConfig()
-- Save the config into the global table.
---@class OarcConfig
global.ocfg = OCFG
ReadModSettings()
-- Validate enable_main_team and enable_separate_teams.
-- Force enable_main_team if both are disabled.
if (not global.ocfg.mod_overlap.enable_main_team and not global.ocfg.mod_overlap.enable_separate_teams) then
log("Both main force and separate teams are disabled! Enabling main force. Please check your mod settings or config!")
global.ocfg.mod_overlap.enable_main_team = true
end
-- TODO: Vanilla spawn point are not implemented yet.
-- Validate enable_shared_spawns and enable_buddy_spawn.
-- if (global.ocfg.enable_vanilla_spawns) then
-- global.ocfg.enable_buddy_spawn = false
-- end
end
-- Read in the mod settings and copy them to the OARC_CFG table, overwriting the defaults in config.lua.
function ReadModSettings()
if not game.active_mods["oarc-mod"] then
return
end
log("Copying mod settings to OCFG table...")
-- Copy in the global settings from the mod settings.
global.ocfg.mod_overlap.enable_main_team = settings.global["oarc-mod-enable-main-team"].value --[[@as boolean]]
global.ocfg.mod_overlap.enable_separate_teams = settings.global["oarc-mod-enable-separate-teams"].value --[[@as boolean]]
global.ocfg.mod_overlap.enable_spawning_on_other_surfaces = settings.global["oarc-mod-enable-spawning-on-other-surfaces"].value --[[@as boolean]]
global.ocfg.mod_overlap.enable_buddy_spawn = settings.global["oarc-mod-enable-buddy-spawn"].value --[[@as boolean]]
-- TODO: Vanilla spawn point are not implemented yet.
-- settings.global["oarc-mod-enable-vanilla-spawn-points"].value
-- settings.global["oarc-mod-number-of-vanilla-spawn-points"].value
-- settings.global["oarc-mod-vanilla-spawn-point-spacing"].value
global.ocfg.mod_overlap.enable_regrowth = settings.global["oarc-mod-enable-regrowth"].value --[[@as boolean]]
global.ocfg.mod_overlap.enable_offline_protection = settings.global["oarc-mod-enable-offline-protection"].value --[[@as boolean]]
global.ocfg.mod_overlap.enable_shared_team_vision = settings.global["oarc-mod-enable-shared-team-vision"].value --[[@as boolean]]
global.ocfg.mod_overlap.enable_shared_team_chat = settings.global["oarc-mod-enable-shared-team-chat"].value --[[@as boolean]]
global.ocfg.mod_overlap.enable_shared_spawns = settings.global["oarc-mod-enable-shared-spawns"].value --[[@as boolean]]
global.ocfg.mod_overlap.number_of_players_per_shared_spawn = settings.global["oarc-mod-number-of-players-per-shared-spawn"].value --[[@as integer]]
global.ocfg.mod_overlap.enable_abandoned_base_cleanup = settings.global["oarc-mod-enable-abandoned-base-cleanup"].value --[[@as boolean]]
global.ocfg.mod_overlap.enable_friendly_fire = settings.global["oarc-mod-enable-friendly-fire"].value --[[@as boolean]]
global.ocfg.mod_overlap.allow_moats_around_spawns = settings.global["oarc-mod-enable-allow-moats-around-spawns"].value --[[@as boolean]]
global.ocfg.mod_overlap.enable_moat_bridging = settings.global["oarc-mod-enable-force-bridges-next-to-moats"].value --[[@as boolean]]
global.ocfg.mod_overlap.minimum_distance_to_existing_chunks = settings.global["oarc-mod-minimum-distance-to-existing-chunks"].value --[[@as integer]]
global.ocfg.mod_overlap.near_spawn_min_distance = settings.global["oarc-mod-near-spawn-min-distance"].value --[[@as integer]]
global.ocfg.mod_overlap.near_spawn_max_distance = settings.global["oarc-mod-near-spawn-max-distance"].value --[[@as integer]]
global.ocfg.mod_overlap.far_spawn_min_distance = settings.global["oarc-mod-far-spawn-min-distance"].value --[[@as integer]]
global.ocfg.mod_overlap.far_spawn_max_distance = settings.global["oarc-mod-far-spawn-max-distance"].value --[[@as integer]]
end

View File

@ -0,0 +1,3 @@
scenario-name=OARC Scenario
description=This is an EMPTY scenario! It is provided as a way to override the default freeplay scenario if you want to. Additionally, experienced server hosts can configure all settings from a file instead of through the mod settings. Please read the control.lua file inside the scenario for notes.

View File

@ -1,117 +0,0 @@
scenario-name=Oarc's Multiplayer Spawning Scenario
description=This scenario allows every player to create their own spawn point when they join the game. There are a lot of helpful features to ensure that new players can join at anytime in the game or even join other players. This is a multiplayer only scenario.\n[color=red][font=default-bold]You must first create a config.lua file if one does not yet exist![/font][/color]\nIn the scenario folder, copy "example-config.lua" and name it "config.lua". Edit the file with any text editor. This is the only way to configure your scenario options and it MUST be done before starting a new game.\n[color=yellow][font=default-bold]Always start a new game when changing the config or updating the scenario![/font][/color]\nPlease visit https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn for the scenario source code, Wiki, and if you want to file any bugs. The wiki has instructions on how to best start games on dedicated/headless servers!\n[color=yellow][font=default-bold]If you got this scenario from the mod portal or by joining a server, make sure you remove any blueprint.zip files in the scenario folder![/font][/color]
oarc-spawn-time-warning-msg=Due to the way this scenario works, it may take some time for the land around your new spawn area to generate... Please wait for 10-20 seconds when you select your first spawn.
oarc-i-understand=I Understand
oarc-spawn-options=Spawn Options
oarc-click-info-btn-help=Click the INFO button in the top left to learn more about this scenario! This is your ONLY chance to choose a spawn option. Choose carefully...
oarc-vanilla-spawn=Vanilla Spawn
oarc-default-spawn-behavior=This is the default spawn behavior of a vanilla game. You join the default team in the center of the map.
oarc-join-main-team-radio=Join Main Team (shared research)
oarc-create-own-team-radio=Create Your Own Team (own research tree)
oarc-moat-option=Surround your spawn with a moat
oarc-solo-spawn-near=Solo Spawn (Near)
oarc-solo-spawn-far=Solo Spawn (Far)
oarc-starting-area-vanilla=You are spawned in your own starting area (vanilla style).
oarc-vanilla-spawns-available=There are __1__ vanilla spawns available.
oarc-starting-area-normal=You are spawned in a new area, with pre-set starting resources.
oarc-join-someone-avail=Join Someone (__1__ available)
oarc-join-someone-info=You are spawned in someone else's base. This requires at least 1 person to have allowed access to their base. This choice is final and you will not be able to create your own spawn later.
oarc-no-shared-avail=There are currently no shared bases availble to spawn at.
oarc-join-check-again=Check Again
oarc-shared-spawn-disabled=Shared spawns are disabled in this mode.
oarc-buddy-spawn=Buddy Spawn
oarc-buddy-spawn-info=The buddy system requires 2 players in this menu at the same time, you spawn beside each other, each with your own resources.
oarc-max-players-shared-spawn=If you create your own spawn point you can allow up to __1__ other online players to join.
oarc-spawn-dist-notes=Near spawn is between __1__-__2__ chunks away from the center of the map.\nFar spawn is between __3__-__4__ chunks away from the center of the map.\nSolo spawns are dangerous! Expect a fight to reach other players.
oarc-player-is-joining-main-force=__1__ is joining the main force!
oarc-player-is-joining-near=__1__ is joining the game from a distance!
oarc-player-is-joining-far=__1__ is joining the game from a great distance!
oarc-please-wait=PLEASE WAIT WHILE YOUR SPAWN POINT IS GENERATED!
oarc-looking-for-buddy=__1__ is looking for a buddy.
oarc-avail-bases-join=Available Bases to Join:
oarc-spawn-spots-remaining=__1__ (__2__ spots remaining)
oarc-cancel-return-to-previous=Cancel (Return to Previous Options)
oarc-player-requesting-join-you=__1__ is requesting to join your base!
oarc-waiting-for-spawn-owner=Waiting for spawn owner to respond...
oarc-you-will-spawn-once-host=You will spawn once the host selects yes...
oarc-player-cancel-join-request=__1__ cancelled their request to join your spawn.
oarc-spawn-ctrl=Spawn Ctrl
oarc-spawn-controls=Spawn Controls:
oarc-spawn-allow-joiners=Allow others to join your base.
oarc-set-respawn-loc=Set New Respawn Location (has a cooldown)
oarc-set-respawn-loc-cooldown=Set Respawn Cooldown Remaining: __1__
oarc-set-respawn-note=This will set your respawn point to your current location.
oarc-select-player-join-queue=Select a player from the join queue:
oarc-accept=Accept
oarc-reject=Reject
oarc-no-player-join-reqs=You have no players requesting to join you at this time.
oarc-start-shared-base=New players can now join __1__'s base!
oarc-stop-shared-base=New players can no longer join __1__'s base!
oarc-spawn-point-updated=Re-spawn point updated!
oarc-selected-player-not-wait=Selected player is no longer waiting to join!
oarc-reject-joiner=You rejected __1__'s request to join your base.
oarc-your-request-rejected=Your request to join was rejected.
oarc-player-joining-base=__1__ is joining __2__'s base!
oarc-player-left-while-joining=__1__ left the game. What an ass.
oarc-buddy-spawn-options=Buddy Spawn Options
oarc-buddy-spawn-instructions=To use this, make sure you and your buddy are in this menu at the same time. Only one of you must send the request. Select your buddy from the list (refresh if your buddy's name is not visible) and select your spawn options. Click one of the request buttons to send the request. The other buddy can then accept (or deny) the request. This will allow you both to spawn next to each other, each with your own spawn area. Once a buddy accepts a spawn request, it is final!
oarc-buddy-select-info=First, select a buddy from the waiting list. Then choose the spawn options and send your request:
oarc-buddy-refresh=Refresh Buddy List
oarc-create-buddy-team=Create Your Own Buddy Team (buddy and you share research)
oarc-buddy-spawn-near=Request Buddy Spawn (Near)
oarc-buddy-spawn-far=Request Buddy Spawn (Far)
oarc-invalid-buddy=You have not selected a valid buddy! Please try again.
oarc-buddy-not-avail=Selected buddy is no longer available! Please try again.
oarc-waiting-for-buddy=Waiting for buddy to respond...
oarc-wait-buddy-select-yes=You will spawn once your buddy selects yes...
oarc-buddy-cancel-request=__1__ cancelled their buddy request!
oarc-buddy-requesting-from-you=__1__ is requesting a buddy spawn from you!
oarc-buddy-txt-main-team=the main team
oarc-buddy-txt-new-teams=on separate teams
oarc-buddy-txt-buddy-team=a buddy team
oarc-buddy-txt-moat= surrounded by a moat
oarc-buddy-txt-near=near to the center of the map!
oarc-buddy-txt-far=far from the center of the map!
oarc-buddy-txt-would-like= would like to join
oarc-buddy-txt-next-to-you= next to you
oarc-buddy-declined=__1__ declined your buddy request!
oarc-spawn-wait=Please wait!
oarc-wait-text=Your spawn is being created now.\nYou will be teleported there in __1__ seconds!\nPlease standby...

View File

@ -1,40 +1,232 @@
data:extend({
{
type = "string-setting",
name = "oarc-mod-scenario-config-note",
name = "oarc-mod-welcome-msg-title",
setting_type = "runtime-global",
default_value = "message-info",
allowed_values = {"message-info"},
order = "-"
default_value = "Insert Server Title Here!",
order = "a1"
},
{
type = "string-setting",
name = "oarc-mod-welcome-msg",
setting_type = "runtime-global",
default_value = "Insert Server Welcome Message Here!",
order = "a2"
},
{
type = "string-setting",
name = "oarc-mod-server-msg",
setting_type = "runtime-global",
default_value = "Insert Server Info Message Here!",
order = "a3"
},
{
type = "bool-setting",
name = "oarc-mod-enable-main-team",
setting_type = "runtime-global",
default_value = true,
order = "a"
order = "b1"
},
{
type = "bool-setting",
name = "oarc-mod-enable-separate-teams",
setting_type = "runtime-global",
default_value = true,
order = "aa"
},
{
type = "bool-setting",
name = "oarc-mod-enable-buddy-spawn",
setting_type = "runtime-global",
default_value = true,
order = "aaa"
order = "b2"
},
{
type = "bool-setting",
name = "oarc-mod-enable-spawning-on-other-surfaces",
setting_type = "runtime-global",
default_value = true,
order = "b"
order = "b3"
},
{
type = "bool-setting",
name = "oarc-mod-allow-moats-around-spawns",
setting_type = "runtime-global",
default_value = true,
order = "b4"
},
{
type = "bool-setting",
name = "oarc-mod-enable-moat-bridging",
setting_type = "runtime-global",
default_value = true,
order = "b5"
},
{
type = "int-setting",
name = "oarc-mod-minimum-distance-to-existing-chunks",
setting_type = "runtime-global",
default_value = 10,
minimum_value = 5,
maximum_value = 25,
order = "c1"
},
{
type = "int-setting",
name = "oarc-mod-near-spawn-min-distance",
setting_type = "runtime-global",
default_value = 100,
minimum_value = 50,
maximum_value = 200,
order = "c2"
},
{
type = "int-setting",
name = "oarc-mod-near-spawn-max-distance",
setting_type = "runtime-global",
default_value = 200,
minimum_value = 100,
maximum_value = 300,
order = "c3"
},
{
type = "int-setting",
name = "oarc-mod-far-spawn-min-distance",
setting_type = "runtime-global",
default_value = 500,
minimum_value = 300,
maximum_value = 700,
order = "c4"
},
{
type = "int-setting",
name = "oarc-mod-far-spawn-max-distance",
setting_type = "runtime-global",
default_value = 700,
minimum_value = 500,
maximum_value = 900,
order = "c5"
},
{
type = "bool-setting",
name = "oarc-mod-enable-buddy-spawn",
setting_type = "runtime-global",
default_value = true,
order = "d1"
},
{
type = "bool-setting",
name = "oarc-mod-enable-offline-protection",
setting_type = "runtime-global",
default_value = true,
order = "d2"
},
{
type = "bool-setting",
name = "oarc-mod-enable-shared-team-vision",
setting_type = "runtime-global",
default_value = true,
order = "d3"
},
{
type = "bool-setting",
name = "oarc-mod-enable-shared-team-chat",
setting_type = "runtime-global",
default_value = true,
order = "d4"
},
{
type = "bool-setting",
name = "oarc-mod-enable-shared-spawns",
setting_type = "runtime-global",
default_value = true,
order = "d5"
},
{
type = "int-setting",
name = "oarc-mod-number-of-players-per-shared-spawn",
setting_type = "runtime-global",
default_value = 4,
minimum_value = 2,
maximum_value = 10,
order = "d6"
},
{
type = "bool-setting",
name = "oarc-mod-enable-friendly-fire",
setting_type = "runtime-global",
default_value = false,
order = "d7"
},
{
type = "string-setting",
name = "oarc-mod-main-force-name",
setting_type = "runtime-global",
default_value = "Main Force",
order = "e1"
},
{
type = "string-setting",
name = "oarc-mod-default-surface",
setting_type = "runtime-global",
default_value = "nauvis",
order = "e2"
},
{
type = "bool-setting",
name = "oarc-mod-scale-resources-around-spawns",
setting_type = "runtime-global",
default_value = true,
order = "f1"
},
{
type = "bool-setting",
name = "oarc-mod-modified-enemy-spawning",
setting_type = "runtime-global",
default_value = true,
order = "f2"
},
{
type = "int-setting",
name = "oarc-mod-minimum-online-time",
setting_type = "runtime-global",
default_value = 15,
minimum_value = 0,
maximum_value = 60,
order = "f3"
},
{
type = "int-setting",
name = "oarc-mod-respawn-cooldown-min",
setting_type = "runtime-global",
default_value = 15,
minimum_value = 0,
maximum_value = 60,
order = "f4"
},
{
type = "bool-setting",
name = "oarc-mod-enable-regrowth",
setting_type = "runtime-global",
default_value = true,
order = "g1"
},
{
type = "bool-setting",
name = "oarc-mod-enable-world-eater",
setting_type = "runtime-global",
default_value = false,
order = "g2"
},
{
type = "bool-setting",
name = "oarc-mod-enable-abandoned-base-cleanup",
setting_type = "runtime-global",
default_value = true,
order = "g3"
},
-- Vanilla spawn point are not implemented yet.
-- {
@ -59,121 +251,4 @@ data:extend({
-- minimum_value = 5,
-- maximum_value = 20
-- },
{
type = "bool-setting",
name = "oarc-mod-enable-regrowth",
setting_type = "runtime-global",
default_value = true,
order = "e1"
},
{
type = "bool-setting",
name = "oarc-mod-enable-abandoned-base-cleanup",
setting_type = "runtime-global",
default_value = true,
order = "e2"
},
{
type = "bool-setting",
name = "oarc-mod-enable-offline-protection",
setting_type = "runtime-global",
default_value = true,
order = "f"
},
{
type = "bool-setting",
name = "oarc-mod-enable-shared-team-vision",
setting_type = "runtime-global",
default_value = true,
order = "g1"
},
{
type = "bool-setting",
name = "oarc-mod-enable-shared-team-chat",
setting_type = "runtime-global",
default_value = true,
order = "g2"
},
{
type = "bool-setting",
name = "oarc-mod-enable-shared-spawns",
setting_type = "runtime-global",
default_value = true,
order = "g3"
},
{
type = "int-setting",
name = "oarc-mod-number-of-players-per-shared-spawn",
setting_type = "runtime-global",
default_value = 4,
minimum_value = 2,
maximum_value = 10,
order = "g4"
},
{
type = "bool-setting",
name = "oarc-mod-enable-friendly-fire",
setting_type = "runtime-global",
default_value = false,
order = "g5"
},
{
type = "bool-setting",
name = "oarc-mod-enable-allow-moats-around-spawns",
setting_type = "runtime-global",
default_value = true,
order = "h1"
},
{
type = "bool-setting",
name = "oarc-mod-enable-force-bridges-next-to-moats",
setting_type = "runtime-global",
default_value = true,
order = "h2"
},
{
type = "int-setting",
name = "oarc-mod-minimum-distance-to-existing-chunks",
setting_type = "runtime-global",
default_value = 10,
minimum_value = 5,
maximum_value = 25,
order = "h3"
},
{
type = "int-setting",
name = "oarc-mod-near-spawn-min-distance",
setting_type = "runtime-global",
default_value = 100,
minimum_value = 50,
maximum_value = 200,
order = "h4"
},
{
type = "int-setting",
name = "oarc-mod-near-spawn-max-distance",
setting_type = "runtime-global",
default_value = 200,
minimum_value = 100,
maximum_value = 300,
order = "h4"
},
{
type = "int-setting",
name = "oarc-mod-far-spawn-min-distance",
setting_type = "runtime-global",
default_value = 500,
minimum_value = 300,
maximum_value = 700,
order = "h5"
},
{
type = "int-setting",
name = "oarc-mod-far-spawn-max-distance",
setting_type = "runtime-global",
default_value = 700,
minimum_value = 500,
maximum_value = 900,
order = "h6"
}
})

View File

@ -39,7 +39,7 @@
-- tree_circle_enabled (bool)
-- tree_octagon_enabled (bool)
-- crashed_ship_enabled (bool)
-- PLAYER_SPAWN_START_ITEMS = {
-- player_start_items = {
-- ["pistol"]=1,
-- ["firearm-magazine"]=200,
-- ["iron-plate"]=100,
@ -48,7 +48,7 @@
-- ["coal"] = 50,
-- ["stone"] = 50,
-- }
-- PLAYER_RESPAWN_START_ITEMS = {
-- player_respawn_items = {
-- ["pistol"]=1,
-- ["firearm-magazine"]=100,
-- }
@ -79,7 +79,7 @@
-- angle_offset = 2.32
-- angle_final = 4.46
-- }
-- resource_tiles = {
-- solid_resources = {
-- ["iron-ore"] = {
-- amount = 1500
-- size = 18
@ -105,7 +105,7 @@
-- y_offset = -20
-- }
-- }
-- resource_patches =
-- fluid_resources =
-- {
-- ["crude-oil"] =
-- {