mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2025-01-20 02:59:53 +02:00
Converting my table references to something less insane.
This commit is contained in:
parent
9fa17f53b7
commit
badd4ab018
44
control.lua
44
control.lua
@ -92,7 +92,7 @@ end)
|
||||
-- Slightly modified for my purposes
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_rocket_launched, function(event)
|
||||
if global.ocfg["frontier-rocket-silo"] then
|
||||
if global.ocfg.frontier_rocket_silo then
|
||||
RocketLaunchEvent(event)
|
||||
end
|
||||
end)
|
||||
@ -104,15 +104,15 @@ local first_chunk_generated_flag = false
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_chunk_generated, function(event)
|
||||
|
||||
if global.ocfg["enable-regrowth"] then
|
||||
if global.ocfg.enable_regrowth then
|
||||
OarcRegrowthChunkGenerate(event.area.left_top)
|
||||
end
|
||||
|
||||
if global.ocfg["enable-undecorator"] then
|
||||
if global.ocfg.enable_undecorator then
|
||||
UndecorateOnChunkGenerate(event)
|
||||
end
|
||||
|
||||
if global.ocfg["frontier-rocket-silo"] then
|
||||
if global.ocfg.frontier_rocket_silo then
|
||||
GenerateRocketSiloChunk(event)
|
||||
end
|
||||
|
||||
@ -128,11 +128,11 @@ end)
|
||||
-- Gui Click
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_gui_click, function(event)
|
||||
if global.ocfg["enable-tags"] then
|
||||
if global.ocfg.enable_tags then
|
||||
TagGuiClick(event)
|
||||
end
|
||||
|
||||
if global.ocfg["enable-player-list"] then
|
||||
if global.ocfg.enable_player_list then
|
||||
PlayerListGuiClick(event)
|
||||
end
|
||||
|
||||
@ -168,11 +168,11 @@ script.on_event(defines.events.on_player_joined_game, function(event)
|
||||
|
||||
PlayerJoinedMessages(event)
|
||||
|
||||
if global.ocfg["enable-player-list"] then
|
||||
if global.ocfg.enable_player_list then
|
||||
CreatePlayerListGui(event)
|
||||
end
|
||||
|
||||
if global.ocfg["enable-tags"] then
|
||||
if global.ocfg.enable_tags then
|
||||
CreateTagGui(event)
|
||||
end
|
||||
|
||||
@ -184,7 +184,7 @@ script.on_event(defines.events.on_player_created, function(event)
|
||||
-- May change this to Lobby in the future.
|
||||
game.players[event.player_index].teleport({x=0,y=0}, GAME_SURFACE_NAME)
|
||||
|
||||
if global.ocfg["enable-long-reach"] then
|
||||
if global.ocfg.enable_long_reach then
|
||||
GivePlayerLongReach(game.players[event.player_index])
|
||||
end
|
||||
|
||||
@ -202,7 +202,7 @@ script.on_event(defines.events.on_player_respawned, function(event)
|
||||
|
||||
PlayerRespawnItems(event)
|
||||
|
||||
if global.ocfg["enable-long-reach"] then
|
||||
if global.ocfg.enable_long_reach then
|
||||
GivePlayerLongReach(game.players[event.player_index])
|
||||
end
|
||||
end)
|
||||
@ -214,11 +214,11 @@ script.on_event(defines.events.on_player_left_game, function(event)
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_built_entity, function(event)
|
||||
if global.ocfg["enable-autofill"] then
|
||||
if global.ocfg.enable_autofill then
|
||||
Autofill(event)
|
||||
end
|
||||
|
||||
if global.ocfg["enable-regrowth"] then
|
||||
if global.ocfg.enable_regrowth then
|
||||
OarcRegrowthOffLimitsChunk(event.created_entity.position)
|
||||
end
|
||||
|
||||
@ -232,11 +232,11 @@ end)
|
||||
-- Shared vision, charts a small area around other players
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_tick, function(event)
|
||||
if global.ocfg["enable-regrowth"] then
|
||||
if global.ocfg.enable_regrowth then
|
||||
OarcRegrowthOnTick()
|
||||
end
|
||||
|
||||
if global.ocfg["enable-abandoned-base-removal"] then
|
||||
if global.ocfg.enable_abandoned_base_removal then
|
||||
OarcRegrowthForceRemovalOnTick()
|
||||
end
|
||||
|
||||
@ -244,7 +244,7 @@ script.on_event(defines.events.on_tick, function(event)
|
||||
DelayedSpawnOnTick()
|
||||
end
|
||||
|
||||
if global.ocfg["frontier-rocket-silo"] then
|
||||
if global.ocfg.frontier_rocket_silo then
|
||||
DelayedSiloCreationOnTick(game.surfaces[GAME_SURFACE_NAME])
|
||||
end
|
||||
|
||||
@ -252,7 +252,7 @@ end)
|
||||
|
||||
|
||||
script.on_event(defines.events.on_sector_scanned, function (event)
|
||||
if global.ocfg["enable-regrowth"] then
|
||||
if global.ocfg.enable_regrowth then
|
||||
OarcRegrowthSectorScan(event)
|
||||
end
|
||||
end)
|
||||
@ -263,17 +263,17 @@ end)
|
||||
-- built stuff as permanent.
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_robot_built_entity, function (event)
|
||||
if global.ocfg["enable-regrowth"] then
|
||||
if global.ocfg.enable_regrowth then
|
||||
OarcRegrowthOffLimitsChunk(event.created_entity.position)
|
||||
end
|
||||
end)
|
||||
script.on_event(defines.events.on_player_mined_entity, function(event)
|
||||
if global.ocfg["enable-regrowth"] then
|
||||
if global.ocfg.enable_regrowth then
|
||||
OarcRegrowthCheckChunkEmpty(event)
|
||||
end
|
||||
end)
|
||||
script.on_event(defines.events.on_robot_mined_entity, function(event)
|
||||
if global.ocfg["enable-regrowth"] then
|
||||
if global.ocfg.enable_regrowth then
|
||||
OarcRegrowthCheckChunkEmpty(event)
|
||||
end
|
||||
end)
|
||||
@ -286,7 +286,7 @@ end)
|
||||
-- Shared chat, so you don't have to type /s
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_console_chat, function(event)
|
||||
if (global.ocfg["enable-shared-chat"]) then
|
||||
if (global.ocfg.enable_shared_chat) then
|
||||
if (event.player_index ~= nil) then
|
||||
ShareChatBetweenForces(game.players[event.player_index], event.message)
|
||||
end
|
||||
@ -298,7 +298,7 @@ end)
|
||||
-- This is where you can permanently remove researched techs
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_research_finished, function(event)
|
||||
if global.ocfg["frontier-rocket-silo"] then
|
||||
if global.ocfg.frontier_rocket_silo then
|
||||
RemoveRecipe(event.research.force, "rocket-silo")
|
||||
end
|
||||
end)
|
||||
@ -308,7 +308,7 @@ end)
|
||||
-- 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["modified-enemy-spawning"]) then
|
||||
if (global.ocfg.modified_enemy_spawning) then
|
||||
ModifyEnemySpawnsNearPlayerStartingAreas(event)
|
||||
end
|
||||
end)
|
||||
|
@ -10,7 +10,7 @@ require("lib/oarc_utils")
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- This creates a random silo position, stored to global.siloPosition
|
||||
-- It uses the config setting global.ocfg["frontier-silo-distance"] and spawns the
|
||||
-- It uses the config setting global.ocfg.frontier_silo_distance and spawns the
|
||||
-- silo somewhere on a circle edge with radius using that distance.
|
||||
function SetRandomSiloPosition(num_silos)
|
||||
if (global.siloPosition == nil) then
|
||||
@ -23,8 +23,8 @@ function SetRandomSiloPosition(num_silos)
|
||||
theta = ((math.pi * 2) / num_silos);
|
||||
angle = (theta * i) + random_angle_offset;
|
||||
|
||||
tx = (global.ocfg["frontier-silo-distance"]*CHUNK_SIZE * math.cos(angle))
|
||||
ty = (global.ocfg["frontier-silo-distance"]*CHUNK_SIZE * math.sin(angle))
|
||||
tx = (global.ocfg.frontier_silo_distance*CHUNK_SIZE * math.cos(angle))
|
||||
ty = (global.ocfg.frontier_silo_distance*CHUNK_SIZE * math.sin(angle))
|
||||
|
||||
table.insert(global.siloPosition, {x=math.floor(tx), y=math.floor(ty)})
|
||||
|
||||
@ -75,21 +75,21 @@ local function CreateRocketSilo(surface, siloPosition, force)
|
||||
silo.minable = false
|
||||
|
||||
-- TAG it on the main force at least.
|
||||
game.forces[global.ocfg["main-force"]].add_chart_tag(game.surfaces[GAME_SURFACE_NAME],
|
||||
game.forces[global.ocfg.main_force].add_chart_tag(game.surfaces[GAME_SURFACE_NAME],
|
||||
{position=siloPosition, text="Rocket Silo",
|
||||
icon={type="item",name="rocket-silo"}})
|
||||
|
||||
-- Make silo safe from being removed by regrowth
|
||||
-- if global.ocfg["enable-regrowth"] then
|
||||
-- if global.ocfg.enable_regrowth then
|
||||
OarcRegrowthOffLimits(siloPosition, 5)
|
||||
-- end
|
||||
|
||||
|
||||
if ENABLE_SILO_BEACONS then
|
||||
PhilipsBeacons(surface, siloPosition, game.forces[global.ocfg["main-force"]])
|
||||
PhilipsBeacons(surface, siloPosition, game.forces[global.ocfg.main_force])
|
||||
end
|
||||
if ENABLE_SILO_RADAR then
|
||||
PhilipsRadar(surface, siloPosition, game.forces[global.ocfg["main-force"]])
|
||||
PhilipsRadar(surface, siloPosition, game.forces[global.ocfg.main_force])
|
||||
end
|
||||
|
||||
end
|
||||
@ -100,7 +100,7 @@ function GenerateAllSilos(surface)
|
||||
|
||||
-- Create each silo in the list
|
||||
for idx,siloPos in pairs(global.siloPosition) do
|
||||
CreateRocketSilo(surface, siloPos, global.ocfg["main-force"])
|
||||
CreateRocketSilo(surface, siloPos, global.ocfg.main_force)
|
||||
end
|
||||
end
|
||||
|
||||
@ -108,7 +108,7 @@ end
|
||||
function GenerateRocketSiloChunk(event)
|
||||
|
||||
-- Silo generation can take awhile depending on the number of silos.
|
||||
if (game.tick < global.ocfg["frontier-silo-count"]*10*TICKS_PER_SECOND) then
|
||||
if (game.tick < global.ocfg.frontier_silo_count*10*TICKS_PER_SECOND) then
|
||||
local surface = event.surface
|
||||
local chunkArea = event.area
|
||||
|
||||
@ -131,9 +131,9 @@ function GenerateRocketSiloChunk(event)
|
||||
end
|
||||
|
||||
-- Remove trees/resources inside the spawn area
|
||||
RemoveInCircle(surface, chunkArea, "tree", siloPos, global.ocfg["spawn_config"].gen_settings.land_area_tiles+5)
|
||||
RemoveInCircle(surface, chunkArea, "resource", siloPos, global.ocfg["spawn_config"].gen_settings.land_area_tiles+5)
|
||||
RemoveInCircle(surface, chunkArea, "cliff", siloPos, global.ocfg["spawn_config"].gen_settings.land_area_tiles+5)
|
||||
RemoveInCircle(surface, chunkArea, "tree", siloPos, global.ocfg.spawn_config.gen_settings.land_area_tiles+5)
|
||||
RemoveInCircle(surface, chunkArea, "resource", siloPos, global.ocfg.spawn_config.gen_settings.land_area_tiles+5)
|
||||
RemoveInCircle(surface, chunkArea, "cliff", siloPos, global.ocfg.spawn_config.gen_settings.land_area_tiles+5)
|
||||
RemoveDecorationsArea(surface, chunkArea)
|
||||
|
||||
-- Create rocket silo
|
||||
@ -146,8 +146,8 @@ end
|
||||
-- Generate chunks where we plan to place the rocket silos.
|
||||
function GenerateRocketSiloAreas(surface)
|
||||
for idx,siloPos in pairs(global.siloPosition) do
|
||||
if (global.ocfg["frontier-silo-vision"]) then
|
||||
ChartRocketSiloAreas(surface, game.forces[global.ocfg["main-force"]])
|
||||
if (global.ocfg.frontier_silo_vision) then
|
||||
ChartRocketSiloAreas(surface, game.forces[global.ocfg.main_force])
|
||||
end
|
||||
surface.request_to_generate_chunks({siloPos.x, siloPos.y}, 3)
|
||||
end
|
||||
@ -167,7 +167,7 @@ global.oarc_silos_generated = false
|
||||
function DelayedSiloCreationOnTick(surface)
|
||||
|
||||
-- Delay the creation of the silos so we place them on already generated lands.
|
||||
if (not global.oarc_silos_generated and (game.tick >= global.ocfg["frontier-silo-count"]*10*TICKS_PER_SECOND)) then
|
||||
if (not global.oarc_silos_generated and (game.tick >= global.ocfg.frontier_silo_count*10*TICKS_PER_SECOND)) then
|
||||
log("Frontier silos generated!")
|
||||
global.oarc_silos_generated = true
|
||||
GenerateAllSilos(surface)
|
||||
|
@ -25,8 +25,8 @@ local function ExpandGameOptionsGui(player)
|
||||
direction="vertical"}
|
||||
|
||||
-- General Server Info:
|
||||
AddLabel(frame, "info_1", global.ocfg["welcome-msg"], my_longer_label_style)
|
||||
AddLabel(frame, "info_2", global.ocfg["server-rules"], my_longer_label_style)
|
||||
AddLabel(frame, "info_1", global.ocfg.welcome_msg, my_longer_label_style)
|
||||
AddLabel(frame, "info_2", global.ocfg.server_rules, my_longer_label_style)
|
||||
AddSpacer(frame, "info_spacer1")
|
||||
|
||||
-- Enemy Settings:
|
||||
@ -55,41 +55,41 @@ local function ExpandGameOptionsGui(player)
|
||||
if (not ENABLE_SEPARATE_SPAWNS) then
|
||||
soft_mods_string = "Oarc Core [DISABLED!]"
|
||||
end
|
||||
if (global.ocfg["enable-undecorator"]) then
|
||||
if (global.ocfg.enable_undecorator) then
|
||||
soft_mods_string = soft_mods_string .. ", Undecorator"
|
||||
end
|
||||
if (global.ocfg["enable-tags"]) then
|
||||
if (global.ocfg.enable_tags) then
|
||||
soft_mods_string = soft_mods_string .. ", Tags"
|
||||
end
|
||||
if (global.ocfg["enable-long-reach"]) then
|
||||
if (global.ocfg.enable_long_reach) then
|
||||
soft_mods_string = soft_mods_string .. ", Long Reach"
|
||||
end
|
||||
if (global.ocfg["enable-autofill"]) then
|
||||
if (global.ocfg.enable_autofill) then
|
||||
soft_mods_string = soft_mods_string .. ", Auto Fill"
|
||||
end
|
||||
if (global.ocfg["enable-player-list"]) then
|
||||
if (global.ocfg.enable_player_list) then
|
||||
soft_mods_string = soft_mods_string .. ", Player List"
|
||||
end
|
||||
|
||||
local game_info_str = "Soft Mods Enabled: " .. soft_mods_string
|
||||
|
||||
-- Spawn options:
|
||||
if (global.ocfg["enable-separate-teams"]) then
|
||||
if (global.ocfg.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-buddy-spawn"]) then
|
||||
if (global.ocfg.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
|
||||
if (global.ocfg["enable-shared-spawns"]) then
|
||||
if (global.ocfg.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["enable-separate-teams"] and global.ocfg["enable-shared-team-vision"]) then
|
||||
if (global.ocfg.enable_separate_teams and global.ocfg.enable_shared_team_vision) then
|
||||
game_info_str = game_info_str.."\n".."Everyone (all teams) have shared vision."
|
||||
end
|
||||
if (global.ocfg["frontier-rocket-silo"]) then
|
||||
if (global.ocfg.frontier_rocket_silo) then
|
||||
game_info_str = game_info_str.."\n".."Silos are NOT craftable. There is at least one already located on the map."
|
||||
end
|
||||
if (global.ocfg["enable-regrowth"]) then
|
||||
if (global.ocfg.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 (ENABLE_POWER_ARMOR_QUICK_START) then
|
||||
@ -98,8 +98,8 @@ local function ExpandGameOptionsGui(player)
|
||||
|
||||
AddLabel(frame, "game_info_label", game_info_str, my_longer_label_style)
|
||||
|
||||
if (global.ocfg["enable-abandoned-base-removal"]) then
|
||||
AddLabel(frame, "leave_warning_msg", "If you leave within " .. global.ocfg["minimum-online-time"] .. " minutes of joining, your base and character will be deleted.", my_longer_label_style)
|
||||
if (global.ocfg.enable_abandoned_base_removal) then
|
||||
AddLabel(frame, "leave_warning_msg", "If you leave within " .. global.ocfg.minimum_online_time .. " minutes of joining, your base and character will be deleted.", my_longer_label_style)
|
||||
frame.leave_warning_msg.style.font_color=my_color_red
|
||||
end
|
||||
|
||||
|
@ -5,7 +5,10 @@
|
||||
-- Allows runtime modification of game settings if we want it.
|
||||
-- Also allows supporting both MOD and SCENARIO versions.
|
||||
|
||||
-- DON'T JUDGE ME
|
||||
|
||||
|
||||
-- That's a LOT of settings.
|
||||
function InitOarcConfig()
|
||||
|
||||
-- Short and sweet.
|
||||
@ -20,75 +23,75 @@ function InitOarcConfig()
|
||||
end
|
||||
end
|
||||
|
||||
-- That's a LOT of settings. -- SCENARIO VERSION
|
||||
-- SCENARIO VERSION
|
||||
if (not is_mod) then
|
||||
global.ocfg["welcome-title"] = WELCOME_MSG_TITLE
|
||||
global.ocfg["welcome-msg"] = WELCOME_MSG
|
||||
global.ocfg["server-rules"] = SERVER_MSG
|
||||
global.ocfg["minimum-online-time"] = MIN_ONLINE_TIME_IN_MINUTES
|
||||
global.ocfg["server-contact"] = CONTACT_MSG
|
||||
global.ocfg["enable-vanilla-spawns"] = ENABLE_VANILLA_SPAWNS
|
||||
global.ocfg["enable-buddy-spawn"] = ENABLE_BUDDY_SPAWN
|
||||
global.ocfg["frontier-rocket-silo"] = FRONTIER_ROCKET_SILO_MODE
|
||||
global.ocfg["enable-undecorator"] = ENABLE_UNDECORATOR
|
||||
global.ocfg["enable-tags"] = ENABLE_TAGS
|
||||
global.ocfg["enable-long-reach"] = ENABLE_LONGREACH
|
||||
global.ocfg["enable-autofill"] = ENABLE_AUTOFILL
|
||||
global.ocfg["enable-player-list"] = ENABLE_PLAYER_LIST
|
||||
global.ocfg["list-offline-players"] = PLAYER_LIST_OFFLINE_PLAYERS
|
||||
global.ocfg["enable-shared-team-vision"] = ENABLE_SHARED_TEAM_VISION
|
||||
global.ocfg["enable-regrowth"] = ENABLE_REGROWTH
|
||||
global.ocfg["enable-abandoned-base-removal"] = ENABLE_ABANDONED_BASE_REMOVAL
|
||||
global.ocfg["enable-research-queue"] = ENABLE_RESEARCH_QUEUE
|
||||
global.ocfg["modified-enemy-spawning"] = OARC_MODIFIED_ENEMY_SPAWNING
|
||||
global.ocfg["near-dist-start"] = NEAR_MIN_DIST
|
||||
global.ocfg["near-dist-end"] = NEAR_MAX_DIST
|
||||
global.ocfg["far-dist-start"] = FAR_MIN_DIST
|
||||
global.ocfg["far-dist-end"] = FAR_MAX_DIST
|
||||
global.ocfg["vanilla-spawn-count"] = VANILLA_SPAWN_COUNT
|
||||
global.ocfg["vanilla-spawn-spacing"] = VANILLA_SPAWN_SPACING
|
||||
global.ocfg.welcome_title = WELCOME_MSG_TITLE
|
||||
global.ocfg.welcome_msg = WELCOME_MSG
|
||||
global.ocfg.server_rules = SERVER_MSG
|
||||
global.ocfg.minimum_online_time = MIN_ONLINE_TIME_IN_MINUTES
|
||||
global.ocfg.server_contact = CONTACT_MSG
|
||||
global.ocfg.enable_vanilla_spawns = ENABLE_VANILLA_SPAWNS
|
||||
global.ocfg.enable_buddy_spawn = ENABLE_BUDDY_SPAWN
|
||||
global.ocfg.frontier_rocket_silo = FRONTIER_ROCKET_SILO_MODE
|
||||
global.ocfg.enable_undecorator = ENABLE_UNDECORATOR
|
||||
global.ocfg.enable_tags = ENABLE_TAGS
|
||||
global.ocfg.enable_long_reach = ENABLE_LONGREACH
|
||||
global.ocfg.enable_autofill = ENABLE_AUTOFILL
|
||||
global.ocfg.enable_player_list = ENABLE_PLAYER_LIST
|
||||
global.ocfg.list_offline_players = PLAYER_LIST_OFFLINE_PLAYERS
|
||||
global.ocfg.enable_shared_team_vision = ENABLE_SHARED_TEAM_VISION
|
||||
global.ocfg.enable_regrowth = ENABLE_REGROWTH
|
||||
global.ocfg.enable_abandoned_base_removal = ENABLE_ABANDONED_BASE_REMOVAL
|
||||
global.ocfg.enable_research_queue = ENABLE_RESEARCH_QUEUE
|
||||
global.ocfg.modified_enemy_spawning = OARC_MODIFIED_ENEMY_SPAWNING
|
||||
global.ocfg.near_dist_start = NEAR_MIN_DIST
|
||||
global.ocfg.near_dist_end = NEAR_MAX_DIST
|
||||
global.ocfg.far_dist_start = FAR_MIN_DIST
|
||||
global.ocfg.far_dist_end = FAR_MAX_DIST
|
||||
global.ocfg.vanilla_spawn_count = VANILLA_SPAWN_COUNT
|
||||
global.ocfg.vanilla_spawn_spacing = VANILLA_SPAWN_SPACING
|
||||
|
||||
global.ocfg["spawn_config"] = OARC_CFG
|
||||
global.ocfg.spawn_config = OARC_CFG
|
||||
|
||||
global.ocfg["enable-separate-teams"] = ENABLE_SEPARATE_TEAMS
|
||||
global.ocfg["main-force"] = MAIN_FORCE
|
||||
global.ocfg["enable-shared-spawns"] = ENABLE_SHARED_SPAWNS
|
||||
global.ocfg["max-players-shared-spawn"] = MAX_ONLINE_PLAYERS_AT_SHARED_SPAWN
|
||||
global.ocfg["enable-shared-chat"] = ENABLE_SHARED_TEAM_CHAT
|
||||
global.ocfg["respawn-cooldown-min"] = RESPAWN_COOLDOWN_IN_MINUTES
|
||||
global.ocfg["frontier-silo-count"] = SILO_NUM_SPAWNS
|
||||
global.ocfg["frontier-silo-distance"] = SILO_CHUNK_DISTANCE
|
||||
global.ocfg["frontier-silo-vision"] = ENABLE_SILO_VISION
|
||||
global.ocfg.enable_separate_teams = ENABLE_SEPARATE_TEAMS
|
||||
global.ocfg.main_force = MAIN_FORCE
|
||||
global.ocfg.enable_shared_spawns = ENABLE_SHARED_SPAWNS
|
||||
global.ocfg.max_players_shared_spawn = MAX_ONLINE_PLAYERS_AT_SHARED_SPAWN
|
||||
global.ocfg.enable_shared_chat = ENABLE_SHARED_TEAM_CHAT
|
||||
global.ocfg.respawn_cooldown_min = RESPAWN_COOLDOWN_IN_MINUTES
|
||||
global.ocfg.frontier_silo_count = SILO_NUM_SPAWNS
|
||||
global.ocfg.frontier_silo_distance = SILO_CHUNK_DISTANCE
|
||||
global.ocfg.frontier_silo_vision = ENABLE_SILO_VISION
|
||||
|
||||
-- That's a LOT of settings. -- MOD VERSION
|
||||
-- MOD VERSION
|
||||
else
|
||||
global.ocfg["welcome-title"] = settings.global["oarc-welcome-title"].value
|
||||
global.ocfg["welcome-msg"] = settings.global["oarc-welcome-msg"].value
|
||||
global.ocfg["server-rules"] = settings.global["oarc-server-rules"].value
|
||||
global.ocfg["minimum-online-time"] = settings.global["oarc-minimum-online-time"].value
|
||||
global.ocfg["server-contact"] = settings.global["oarc-server-contact"].value
|
||||
global.ocfg["enable-vanilla-spawns"] = settings.global["oarc-enable-vanilla-spawns"].value
|
||||
global.ocfg["enable-buddy-spawn"] = settings.global["oarc-enable-buddy-spawn"].value
|
||||
global.ocfg["frontier-rocket-silo"] = settings.global["oarc-frontier-rocket-silo"].value
|
||||
global.ocfg["enable-undecorator"] = settings.global["oarc-enable-undecorator"].value
|
||||
global.ocfg["enable-tags"] = settings.global["oarc-enable-tags"].value
|
||||
global.ocfg["enable-long-reach"] = settings.global["oarc-enable-long-reach"].value
|
||||
global.ocfg["enable-autofill"] = settings.global["oarc-enable-autofill"].value
|
||||
global.ocfg["enable-player-list"] = settings.global["oarc-enable-player-list"].value
|
||||
global.ocfg["list-offline-players"] = settings.global["oarc-list-offline-players"].value
|
||||
global.ocfg["enable-shared-team-vision"] = settings.global["oarc-enable-shared-team-vision"].value
|
||||
global.ocfg["enable-regrowth"] = settings.global["oarc-enable-regrowth"].value
|
||||
global.ocfg["enable-abandoned-base-removal"] = settings.global["oarc-enable-abandoned-base-removal"].value
|
||||
global.ocfg["enable-research-queue"] = settings.global["oarc-enable-research-queue"].value
|
||||
global.ocfg["modified-enemy-spawning"] = settings.global["oarc-modified-enemy-spawning"].value
|
||||
global.ocfg["near-dist-start"] = settings.global["oarc-near-dist-start"].value
|
||||
global.ocfg["near-dist-end"] = settings.global["oarc-near-dist-end"].value
|
||||
global.ocfg["far-dist-start"] = settings.global["oarc-far-dist-start"].value
|
||||
global.ocfg["far-dist-end"] = settings.global["oarc-far-dist-end"].value
|
||||
global.ocfg["vanilla-spawn-count"] = settings.global["oarc-vanilla-spawn-count"].value
|
||||
global.ocfg["vanilla-spawn-spacing"] = settings.global["oarc-vanilla-spawn-spacing"].value
|
||||
global.ocfg.welcome_title = settings.global["oarc-welcome-title"].value
|
||||
global.ocfg.welcome_msg = settings.global["oarc-welcome-msg"].value
|
||||
global.ocfg.server_rules = settings.global["oarc-server-rules"].value
|
||||
global.ocfg.minimum_online_time = settings.global["oarc-minimum-online-time"].value
|
||||
global.ocfg.server_contact = settings.global["oarc-server-contact"].value
|
||||
global.ocfg.enable_vanilla_spawns = settings.global["oarc-enable-vanilla-spawns"].value
|
||||
global.ocfg.enable_buddy_spawn = settings.global["oarc-enable-buddy-spawn"].value
|
||||
global.ocfg.frontier_rocket_silo = settings.global["oarc-frontier-rocket-silo"].value
|
||||
global.ocfg.enable_undecorator = settings.global["oarc-enable-undecorator"].value
|
||||
global.ocfg.enable_tags = settings.global["oarc-enable-tags"].value
|
||||
global.ocfg.enable_long_reach = settings.global["oarc-enable-long-reach"].value
|
||||
global.ocfg.enable_autofill = settings.global["oarc-enable-autofill"].value
|
||||
global.ocfg.enable_player_list = settings.global["oarc-enable-player-list"].value
|
||||
global.ocfg.list_offline_players = settings.global["oarc-list-offline-players"].value
|
||||
global.ocfg.enable_shared_team_vision = settings.global["oarc-enable-shared-team-vision"].value
|
||||
global.ocfg.enable_regrowth = settings.global["oarc-enable-regrowth"].value
|
||||
global.ocfg.enable_abandoned_base_removal = settings.global["oarc-enable-abandoned-base-removal"].value
|
||||
global.ocfg.enable_research_queue = settings.global["oarc-enable-research-queue"].value
|
||||
global.ocfg.modified_enemy_spawning = settings.global["oarc-modified-enemy-spawning"].value
|
||||
global.ocfg.near_dist_start = settings.global["oarc-near-dist-start"].value
|
||||
global.ocfg.near_dist_end = settings.global["oarc-near-dist-end"].value
|
||||
global.ocfg.far_dist_start = settings.global["oarc-far-dist-start"].value
|
||||
global.ocfg.far_dist_end = settings.global["oarc-far-dist-end"].value
|
||||
global.ocfg.vanilla_spawn_count = settings.global["oarc-vanilla-spawn-count"].value
|
||||
global.ocfg.vanilla_spawn_spacing = settings.global["oarc-vanilla-spawn-spacing"].value
|
||||
|
||||
global.ocfg["spawn_config"] = {
|
||||
global.ocfg.spawn_config = {
|
||||
gen_settings = {
|
||||
land_area_tiles = settings.global["oarc-enforce-land-area-tile-dist"].value,
|
||||
moat_choice_enabled = settings.global["oarc-allow-moat-choice"].value,
|
||||
@ -170,14 +173,14 @@ function InitOarcConfig()
|
||||
},
|
||||
}
|
||||
|
||||
global.ocfg["enable-separate-teams"] = settings.global["oarc-enable-separate-teams"].value
|
||||
global.ocfg["main-force"] = settings.global["oarc-main-force"].value
|
||||
global.ocfg["enable-shared-spawns"] = settings.global["oarc-enable-shared-spawns"].value
|
||||
global.ocfg["max-players-shared-spawn"] = settings.global["oarc-max-players-shared-spawn"].value
|
||||
global.ocfg["enable-shared-chat"] = settings.global["oarc-enable-shared-chat"].value
|
||||
global.ocfg["respawn-cooldown-min"] = settings.global["oarc-respawn-cooldown-min"].value
|
||||
global.ocfg["frontier-silo-count"] = settings.global["oarc-frontier-silo-count"].value
|
||||
global.ocfg["frontier-silo-distance"] = settings.global["oarc-frontier-silo-distance"].value
|
||||
global.ocfg["frontier-silo-vision"] = settings.global["oarc-frontier-silo-vision"].value
|
||||
global.ocfg.enable_separate_teams = settings.global["oarc-enable-separate-teams"].value
|
||||
global.ocfg.main_force = settings.global["oarc-main-force"].value
|
||||
global.ocfg.enable_shared_spawns = settings.global["oarc-enable-shared-spawns"].value
|
||||
global.ocfg.max_players_shared_spawn = settings.global["oarc-max-players-shared-spawn"].value
|
||||
global.ocfg.enable_shared_chat = settings.global["oarc-enable-shared-chat"].value
|
||||
global.ocfg.respawn_cooldown_min = settings.global["oarc-respawn-cooldown-min"].value
|
||||
global.ocfg.frontier_silo_count = settings.global["oarc-frontier-silo-count"].value
|
||||
global.ocfg.frontier_silo_distance = settings.global["oarc-frontier-silo-distance"].value
|
||||
global.ocfg.frontier_silo_vision = settings.global["oarc-frontier-silo-vision"].value
|
||||
end
|
||||
end
|
@ -414,8 +414,8 @@ function CreateGameSurface()
|
||||
-- Get starting surface settings.
|
||||
local nauvis_settings = game.surfaces["nauvis"].map_gen_settings
|
||||
|
||||
if global.ocfg["enable-vanilla-spawns"] then
|
||||
nauvis_settings.starting_points = CreateVanillaSpawns(global.ocfg["vanilla-spawn-count"], global.ocfg["vanilla-spawn-spacing"])
|
||||
if global.ocfg.enable_vanilla_spawns then
|
||||
nauvis_settings.starting_points = CreateVanillaSpawns(global.ocfg.vanilla_spawn_count, global.ocfg.vanilla_spawn_spacing)
|
||||
-- DeleteAllChunksExceptCenter(game.surfaces[GAME_SURFACE_NAME])
|
||||
|
||||
-- ISLAND MAP GEN -- WARNING
|
||||
@ -489,11 +489,11 @@ function DowngradeWormsInArea(surface, area, small_percent, medium_percent, big_
|
||||
end
|
||||
|
||||
function DowngradeWormsDistanceBasedOnChunkGenerate(event)
|
||||
if (getDistance({x=0,y=0}, event.area.left_top) < (global.ocfg["near-dist-end"]*CHUNK_SIZE)) then
|
||||
if (getDistance({x=0,y=0}, event.area.left_top) < (global.ocfg.near_dist_end*CHUNK_SIZE)) then
|
||||
DowngradeWormsInArea(event.surface, event.area, 100, 100, 100)
|
||||
elseif (getDistance({x=0,y=0}, event.area.left_top) < (global.ocfg["far-dist-start"]*CHUNK_SIZE)) then
|
||||
elseif (getDistance({x=0,y=0}, event.area.left_top) < (global.ocfg.far_dist_start*CHUNK_SIZE)) then
|
||||
DowngradeWormsInArea(event.surface, event.area, 50, 90, 100)
|
||||
elseif (getDistance({x=0,y=0}, event.area.left_top) < (global.ocfg["far-dist-end"]*CHUNK_SIZE)) then
|
||||
elseif (getDistance({x=0,y=0}, event.area.left_top) < (global.ocfg.far_dist_end*CHUNK_SIZE)) then
|
||||
DowngradeWormsInArea(event.surface, event.area, 20, 80, 97)
|
||||
else
|
||||
DowngradeWormsInArea(event.surface, event.area, 0, 20, 85)
|
||||
@ -730,7 +730,7 @@ function CreateCropCircle(surface, centerPos, chunkArea, tileRadius)
|
||||
|
||||
-- Fill in all unexpected water in a circle
|
||||
if (distVar < tileRadSqr) then
|
||||
if (surface.get_tile(i,j).collides_with("water-tile") or global.ocfg["spawn_config"].gen_settings.force_grass) then
|
||||
if (surface.get_tile(i,j).collides_with("water-tile") or global.ocfg.spawn_config.gen_settings.force_grass) then
|
||||
table.insert(dirtTiles, {name = "grass-1", position ={i,j}})
|
||||
end
|
||||
end
|
||||
@ -761,7 +761,7 @@ function CreateCropOctagon(surface, centerPos, chunkArea, tileRadius)
|
||||
|
||||
-- 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"].gen_settings.force_grass) then
|
||||
if (surface.get_tile(i,j).collides_with("water-tile") or global.ocfg.spawn_config.gen_settings.force_grass) then
|
||||
table.insert(dirtTiles, {name = "grass-1", position ={i,j}})
|
||||
end
|
||||
end
|
||||
@ -824,7 +824,7 @@ function GenerateResourcePatch(surface, resourceName, diameter, pos, amount)
|
||||
end
|
||||
for y=-midPoint, midPoint do
|
||||
for x=-midPoint, midPoint do
|
||||
if (not global.ocfg["spawn_config"].gen_settings.resources_circle_shape or ((x)^2 + (y)^2 < midPoint^2)) then
|
||||
if (not global.ocfg.spawn_config.gen_settings.resources_circle_shape or ((x)^2 + (y)^2 < midPoint^2)) then
|
||||
surface.create_entity({name=resourceName, amount=amount,
|
||||
position={pos.x+x, pos.y+y}})
|
||||
end
|
||||
@ -904,7 +904,7 @@ end
|
||||
-- Display messages to a user everytime they join
|
||||
function PlayerJoinedMessages(event)
|
||||
local player = game.players[event.player_index]
|
||||
player.print(global.ocfg["welcome-msg"])
|
||||
player.print(global.ocfg.welcome_msg)
|
||||
end
|
||||
|
||||
-- Remove decor to save on file size
|
||||
|
@ -34,7 +34,7 @@ local function ExpandPlayerListGui(player)
|
||||
end
|
||||
|
||||
-- List offline players
|
||||
if (global.ocfg["list-offline-players"]) then
|
||||
if (global.ocfg.list_offline_players) then
|
||||
AddLabel(scrollFrame, "offline_title_msg", "Offline Players:", my_label_style)
|
||||
for _,player in pairs(game.players) do
|
||||
if (not player.connected) then
|
||||
|
@ -328,7 +328,7 @@ function OarcRegrowthOnTick()
|
||||
-- Send a broadcast warning before it happens.
|
||||
if ((game.tick % REGROWTH_CLEANING_INTERVAL_TICKS) == REGROWTH_CLEANING_INTERVAL_TICKS-601) then
|
||||
if (#global.chunk_regrow.removal_list > 100) then
|
||||
if (global.ocfg["enable-regrowth"]) then
|
||||
if (global.ocfg.enable_regrowth) then
|
||||
SendBroadcastMsg("Map cleanup in 10 seconds... Unused and old map chunks will be deleted!")
|
||||
else
|
||||
SendBroadcastMsg("Map cleanup in 10 seconds. Cleaning up an abadoned base!")
|
||||
@ -351,7 +351,7 @@ end
|
||||
function OarcRegrowthForceRemovalOnTick()
|
||||
-- Catch force remove flag
|
||||
if (game.tick == global.chunk_regrow.force_removal_flag+60) then
|
||||
if (global.ocfg["enable-regrowth"]) then
|
||||
if (global.ocfg.enable_regrowth) then
|
||||
SendBroadcastMsg("Map cleanup in 10 seconds... Unused and old map chunks will be deleted!")
|
||||
else
|
||||
SendBroadcastMsg("Map cleanup in 10 seconds. Cleaning up an abadoned base!")
|
||||
@ -360,7 +360,7 @@ function OarcRegrowthForceRemovalOnTick()
|
||||
if (game.tick == global.chunk_regrow.force_removal_flag+660) then
|
||||
OarcRegrowthRemoveAllChunks()
|
||||
|
||||
if (global.ocfg["enable-regrowth"]) then
|
||||
if (global.ocfg.enable_regrowth) then
|
||||
SendBroadcastMsg("Map cleanup done, sorry for your loss.")
|
||||
else
|
||||
SendBroadcastMsg("Abandoned base cleanup complete.")
|
||||
|
@ -16,7 +16,7 @@ require("config")
|
||||
-- without shouting.
|
||||
function SeparateSpawnsPlayerCreated(player_index)
|
||||
local player = game.players[player_index]
|
||||
player.force = global.ocfg["main-force"]
|
||||
player.force = global.ocfg.main_force
|
||||
DisplayWelcomeTextGui(player)
|
||||
end
|
||||
|
||||
@ -36,7 +36,7 @@ function SeparateSpawnsGenerateChunk(event)
|
||||
local chunkArea = event.area
|
||||
|
||||
-- Modify enemies first.
|
||||
if global.ocfg["modified-enemy-spawning"] then
|
||||
if global.ocfg.modified_enemy_spawning then
|
||||
DowngradeWormsDistanceBasedOnChunkGenerate(event)
|
||||
end
|
||||
|
||||
@ -50,7 +50,7 @@ end
|
||||
-- Call this if a player leaves the game
|
||||
function FindUnusedSpawns(event)
|
||||
local player = game.players[event.player_index]
|
||||
if (player.online_time < (global.ocfg["minimum-online-time"] * TICKS_PER_MINUTE)) then
|
||||
if (player.online_time < (global.ocfg.minimum_online_time * TICKS_PER_MINUTE)) then
|
||||
|
||||
-- Clear out global variables for that player
|
||||
if (global.playerSpawns[player.name] ~= nil) then
|
||||
@ -99,7 +99,7 @@ function FindUnusedSpawns(event)
|
||||
end
|
||||
end
|
||||
|
||||
if (global.ocfg["enable-abandoned-base-removal"] and not nearOtherSpawn) then
|
||||
if (global.ocfg.enable_abandoned_base_removal and not nearOtherSpawn) then
|
||||
if (global.uniqueSpawns[player.name].vanilla) then
|
||||
log("Returning a vanilla spawn back to available.")
|
||||
table.insert(global.vanillaSpawns, {x=spawnPos.x,y=spawnPos.y})
|
||||
@ -109,13 +109,13 @@ function FindUnusedSpawns(event)
|
||||
|
||||
log("Removing base: " .. spawnPos.x .. "," .. spawnPos.y)
|
||||
OarcRegrowthMarkForRemoval(spawnPos, 10)
|
||||
SendBroadcastMsg(player.name .. "'s base was marked for immediate clean up because they left within "..global.ocfg["minimum-online-time"].." minutes of joining.")
|
||||
SendBroadcastMsg(player.name .. "'s base was marked for immediate clean up because they left within "..global.ocfg.minimum_online_time.." minutes of joining.")
|
||||
global.chunk_regrow.force_removal_flag = game.tick
|
||||
|
||||
else
|
||||
-- table.insert(global.unusedSpawns, global.uniqueSpawns[player.name]) -- Not used/implemented right now.
|
||||
global.uniqueSpawns[player.name] = nil
|
||||
SendBroadcastMsg(player.name .. " base was freed up because they left within "..global.ocfg["minimum-online-time"].." minutes of joining.")
|
||||
SendBroadcastMsg(player.name .. " base was freed up because they left within "..global.ocfg.minimum_online_time.." minutes of joining.")
|
||||
end
|
||||
end
|
||||
|
||||
@ -134,8 +134,8 @@ function FindUnusedSpawns(event)
|
||||
end
|
||||
|
||||
-- Remove a force if this player created it and they are the only one on it
|
||||
if ((#player.force.players <= 1) and (player.force.name ~= global.ocfg["main-force"])) then
|
||||
game.merge_forces(player.force, global.ocfg["main-force"])
|
||||
if ((#player.force.players <= 1) and (player.force.name ~= global.ocfg.main_force)) then
|
||||
game.merge_forces(player.force, global.ocfg.main_force)
|
||||
end
|
||||
|
||||
-- Remove the character completely
|
||||
@ -361,8 +361,8 @@ function GetNumberOfAvailableSharedSpawns()
|
||||
if (sharedSpawn.openAccess and
|
||||
(game.players[ownerName] ~= nil) and
|
||||
game.players[ownerName].connected) then
|
||||
if ((global.ocfg["max-players-shared-spawn"] == 0) or
|
||||
(GetOnlinePlayersAtSharedSpawn(ownerName) < global.ocfg["max-players-shared-spawn"])) then
|
||||
if ((global.ocfg.max_players_shared_spawn == 0) or
|
||||
(GetOnlinePlayersAtSharedSpawn(ownerName) < global.ocfg.max_players_shared_spawn)) then
|
||||
count = count+1
|
||||
end
|
||||
end
|
||||
@ -431,16 +431,16 @@ 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 = game.create_force(global.ocfg["main-force"])
|
||||
local main_force = game.create_force(global.ocfg.main_force)
|
||||
main_force.set_spawn_position({x=0,y=0}, GAME_SURFACE_NAME)
|
||||
|
||||
-- Share vision with other forces.
|
||||
if global.ocfg["enable-shared-team-vision"] then
|
||||
game.forces[global.ocfg["main-force"]].share_chart = true
|
||||
if global.ocfg.enable_shared_team_vision then
|
||||
game.forces[global.ocfg.main_force].share_chart = true
|
||||
end
|
||||
|
||||
if global.ocfg["enable-research-queue"] then
|
||||
game.forces[global.ocfg["main-force"]].research_queue_enabled = true
|
||||
if global.ocfg.enable_research_queue then
|
||||
game.forces[global.ocfg.main_force].research_queue_enabled = true
|
||||
end
|
||||
|
||||
-- Silo info
|
||||
@ -452,7 +452,7 @@ function InitSpawnGlobalsAndForces()
|
||||
SetCeaseFireBetweenAllForces()
|
||||
SetFriendlyBetweenAllForces()
|
||||
if (ENABLE_ANTI_GRIEFING) then
|
||||
AntiGriefing(game.forces[global.ocfg["main-force"]])
|
||||
AntiGriefing(game.forces[global.ocfg.main_force])
|
||||
end
|
||||
end
|
||||
|
||||
@ -550,7 +550,7 @@ function SendPlayerToSpawn(player)
|
||||
if (DoesPlayerHaveCustomSpawn(player)) then
|
||||
player.teleport(global.playerSpawns[player.name], GAME_SURFACE_NAME)
|
||||
else
|
||||
player.teleport(game.forces[global.ocfg["main-force"]].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME)
|
||||
player.teleport(game.forces[global.ocfg.main_force].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME)
|
||||
end
|
||||
end
|
||||
|
||||
@ -560,7 +560,7 @@ function SendPlayerToRandomSpawn(player)
|
||||
local counter = 0
|
||||
|
||||
if (rndSpawn == 0) then
|
||||
player.teleport(game.forces[global.ocfg["main-force"]].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME)
|
||||
player.teleport(game.forces[global.ocfg.main_force].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME)
|
||||
else
|
||||
counter = counter + 1
|
||||
for name,spawn in pairs(global.uniqueSpawns) do
|
||||
@ -585,14 +585,14 @@ function CreatePlayerCustomForce(player)
|
||||
-- Create a new force using the player's name
|
||||
elseif (TableLength(game.forces) < MAX_FORCES) then
|
||||
newForce = game.create_force(player.name)
|
||||
if global.ocfg["enable-shared-team-vision"] then
|
||||
if global.ocfg.enable_shared_team_vision then
|
||||
newForce.share_chart = true
|
||||
end
|
||||
if global.ocfg["enable-research-queue"] then
|
||||
if global.ocfg.enable_research_queue then
|
||||
newForce.research_queue_enabled = true
|
||||
end
|
||||
-- Chart silo areas if necessary
|
||||
if global.ocfg["frontier-rocket-silo"] and global.ocfg["frontier-silo-vision"] then
|
||||
if global.ocfg.frontier_rocket_silo and global.ocfg.frontier_silo_vision then
|
||||
ChartRocketSiloAreas(game.surfaces[GAME_SURFACE_NAME], newForce)
|
||||
end
|
||||
player.force = newForce
|
||||
@ -603,7 +603,7 @@ function CreatePlayerCustomForce(player)
|
||||
end
|
||||
SendBroadcastMsg(player.name.." has started their own team!")
|
||||
else
|
||||
player.force = global.ocfg["main-force"]
|
||||
player.force = global.ocfg.main_force
|
||||
player.print("Sorry, no new teams can be created. You were assigned to the default team instead.")
|
||||
end
|
||||
|
||||
|
@ -33,15 +33,15 @@ function DisplayWelcomeTextGui(player)
|
||||
player.gui.center.add{name = "welcome_msg",
|
||||
type = "frame",
|
||||
direction = "vertical",
|
||||
caption=global.ocfg["welcome-title"]}
|
||||
caption=global.ocfg.welcome_title}
|
||||
local wGui = player.gui.center.welcome_msg
|
||||
|
||||
wGui.style.maximal_width = SPAWN_GUI_MAX_WIDTH
|
||||
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, "contact_info_msg_lbl1", global.ocfg["server-contact"], my_label_style)
|
||||
AddLabel(wGui, "server_msg_lbl1", global.ocfg.server_rules, my_label_style)
|
||||
AddLabel(wGui, "contact_info_msg_lbl1", global.ocfg.server_contact, my_label_style)
|
||||
AddSpacer(wGui, "server_msg_spacer1")
|
||||
|
||||
-- Informational message about the scenario
|
||||
@ -124,7 +124,7 @@ function DisplaySpawnOptions(player)
|
||||
style = "bordered_frame"}
|
||||
|
||||
-- Radio buttons to pick your team.
|
||||
if (global.ocfg["enable-separate-teams"]) then
|
||||
if (global.ocfg.enable_separate_teams) then
|
||||
soloSpawnFlow.add{name = "isolated_spawn_main_team_radio",
|
||||
type = "radiobutton",
|
||||
caption={"oarc-join-main-team-radio"},
|
||||
@ -140,13 +140,13 @@ function DisplaySpawnOptions(player)
|
||||
-- "Additional spawn options can be selected here. Not all are compatible with each other.", my_label_style)
|
||||
|
||||
-- Allow players to spawn with a moat around their area.
|
||||
if (global.ocfg.spawn_config.gen_settings.moat_choice_enabled and not global.ocfg["enable-vanilla-spawns"]) then
|
||||
if (global.ocfg.spawn_config.gen_settings.moat_choice_enabled and not global.ocfg.enable_vanilla_spawns) then
|
||||
soloSpawnFlow.add{name = "isolated_spawn_moat_option_checkbox",
|
||||
type = "checkbox",
|
||||
caption={"oarc-moat-option"},
|
||||
state=false}
|
||||
end
|
||||
-- if (global.ocfg["enable-vanilla-spawns"] and (#global.vanillaSpawns > 0)) then
|
||||
-- if (global.ocfg.enable_vanilla_spawns and (#global.vanillaSpawns > 0)) then
|
||||
-- soloSpawnFlow.add{name = "isolated_spawn_vanilla_option_checkbox",
|
||||
-- type = "checkbox",
|
||||
-- caption="Use a pre-set vanilla spawn point. " .. #global.vanillaSpawns .. " available.",
|
||||
@ -168,7 +168,7 @@ function DisplaySpawnOptions(player)
|
||||
caption={"oarc-solo-spawn-far"},
|
||||
style = "confirm_button"}
|
||||
|
||||
if (global.ocfg["enable-vanilla-spawns"]) then
|
||||
if (global.ocfg.enable_vanilla_spawns) then
|
||||
AddLabel(soloSpawnFlow, "isolated_spawn_lbl1",
|
||||
{"oarc-starting-area-vanilla"}, my_label_style)
|
||||
AddLabel(soloSpawnFlow, "vanilla_spawn_lbl2",
|
||||
@ -183,7 +183,7 @@ function DisplaySpawnOptions(player)
|
||||
type = "frame",
|
||||
direction="vertical",
|
||||
style = "bordered_frame"}
|
||||
if global.ocfg["enable-shared-spawns"] then
|
||||
if global.ocfg.enable_shared_spawns then
|
||||
local numAvailSpawns = GetNumberOfAvailableSharedSpawns()
|
||||
if (numAvailSpawns > 0) then
|
||||
sharedSpawnFrame.add{name = "join_other_spawn",
|
||||
@ -203,8 +203,8 @@ function DisplaySpawnOptions(player)
|
||||
end
|
||||
|
||||
-- Awesome buddy spawning system
|
||||
if (not global.ocfg["enable-vanilla-spawns"]) then
|
||||
if global.ocfg["enable-shared-spawns"] and global.ocfg["enable-buddy-spawn"] then
|
||||
if (not global.ocfg.enable_vanilla_spawns) then
|
||||
if global.ocfg.enable_shared_spawns and global.ocfg.enable_buddy_spawn then
|
||||
local buddySpawnFrame = sGui.add{name = "spawn_buddy_flow",
|
||||
type = "frame",
|
||||
direction="vertical",
|
||||
@ -220,12 +220,12 @@ function DisplaySpawnOptions(player)
|
||||
end
|
||||
|
||||
-- Some final notes
|
||||
if (global.ocfg["max-players-shared-spawn"] > 0) then
|
||||
if (global.ocfg.max_players_shared_spawn > 0) then
|
||||
AddLabel(sGui, "max_players_lbl2",
|
||||
{"oarc-max-players-shared-spawn", global.ocfg["max-players-shared-spawn"]-1},
|
||||
{"oarc-max-players-shared-spawn", global.ocfg.max_players_shared_spawn-1},
|
||||
my_note_style)
|
||||
end
|
||||
local spawn_distance_notes={"oarc-spawn-dist-notes", global.ocfg["near-dist-start"], global.ocfg["near-dist-end"], global.ocfg["far-dist-start"], global.ocfg["far-dist-end"]}
|
||||
local spawn_distance_notes={"oarc-spawn-dist-notes", global.ocfg.near_dist_start, global.ocfg.near_dist_end, global.ocfg.far_dist_start, global.ocfg.far_dist_end}
|
||||
AddLabel(sGui, "note_lbl1", spawn_distance_notes, my_note_style)
|
||||
end
|
||||
|
||||
@ -282,7 +282,7 @@ function SpawnOptsGuiClick(event)
|
||||
(elemName == "buddy_spawn") or
|
||||
(elemName == "join_other_spawn_check")) then
|
||||
|
||||
if (global.ocfg["enable-separate-teams"]) then
|
||||
if (global.ocfg.enable_separate_teams) then
|
||||
joinMainTeamRadio =
|
||||
pgcs.spawn_solo_flow.isolated_spawn_main_team_radio.state
|
||||
joinOwnTeamRadio =
|
||||
@ -291,11 +291,11 @@ function SpawnOptsGuiClick(event)
|
||||
joinMainTeamRadio = true
|
||||
joinOwnTeamRadio = false
|
||||
end
|
||||
if (global.ocfg.spawn_config.gen_settings.moat_choice_enabled and not global.ocfg["enable-vanilla-spawns"] and
|
||||
if (global.ocfg.spawn_config.gen_settings.moat_choice_enabled and not global.ocfg.enable_vanilla_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
|
||||
-- if (global.ocfg["enable-vanilla-spawns"] and
|
||||
-- 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
|
||||
-- end
|
||||
@ -308,7 +308,7 @@ function SpawnOptsGuiClick(event)
|
||||
GivePlayerStarterItems(player)
|
||||
ChangePlayerSpawn(player, player.force.get_spawn_position(GAME_SURFACE_NAME))
|
||||
SendBroadcastMsg({"oarc-player-is-joining-main-force", player.name})
|
||||
ChartArea(player.force, player.position, math.ceil(global.ocfg["spawn_config"].gen_settings.land_area_tiles/CHUNK_SIZE), player.surface)
|
||||
ChartArea(player.force, player.position, math.ceil(global.ocfg.spawn_config.gen_settings.land_area_tiles/CHUNK_SIZE), player.surface)
|
||||
-- Create the button at the top left for setting respawn point and sharing base.
|
||||
CreateSpawnCtrlGui(player)
|
||||
|
||||
@ -318,28 +318,28 @@ function SpawnOptsGuiClick(event)
|
||||
local newSpawn = {x=0,y=0}
|
||||
|
||||
-- Create a new force for player if they choose that radio button
|
||||
if global.ocfg["enable-separate-teams"] and joinOwnTeamRadio then
|
||||
if global.ocfg.enable_separate_teams and joinOwnTeamRadio then
|
||||
local newForce = CreatePlayerCustomForce(player)
|
||||
end
|
||||
|
||||
-- Find an unused vanilla spawn
|
||||
-- if (vanillaChoice) then
|
||||
if (global.ocfg["enable-vanilla-spawns"]) then
|
||||
if (global.ocfg.enable_vanilla_spawns) then
|
||||
if (elemName == "isolated_spawn_far") then
|
||||
newSpawn = FindUnusedVanillaSpawn(game.surfaces[GAME_SURFACE_NAME],
|
||||
global.ocfg["far-dist-end"]*CHUNK_SIZE)
|
||||
global.ocfg.far_dist_end*CHUNK_SIZE)
|
||||
elseif (elemName == "isolated_spawn_near") then
|
||||
newSpawn = FindUnusedVanillaSpawn(game.surfaces[GAME_SURFACE_NAME],
|
||||
global.ocfg["near-dist-start"]*CHUNK_SIZE)
|
||||
global.ocfg.near_dist_start*CHUNK_SIZE)
|
||||
end
|
||||
|
||||
-- Default OARC-type pre-set layout spawn.
|
||||
else
|
||||
-- Find coordinates of a good place to spawn
|
||||
if (elemName == "isolated_spawn_far") then
|
||||
newSpawn = FindUngeneratedCoordinates(global.ocfg["far-dist-start"],global.ocfg["far-dist-end"], player.surface)
|
||||
newSpawn = FindUngeneratedCoordinates(global.ocfg.far_dist_start,global.ocfg.far_dist_end, player.surface)
|
||||
elseif (elemName == "isolated_spawn_near") then
|
||||
newSpawn = FindUngeneratedCoordinates(global.ocfg["near-dist-start"],global.ocfg["near-dist-end"], player.surface)
|
||||
newSpawn = FindUngeneratedCoordinates(global.ocfg.near_dist_start,global.ocfg.near_dist_end, player.surface)
|
||||
end
|
||||
end
|
||||
|
||||
@ -354,7 +354,7 @@ function SpawnOptsGuiClick(event)
|
||||
|
||||
-- Send the player there
|
||||
-- QueuePlayerForDelayedSpawn(player.name, newSpawn, moatChoice, vanillaChoice)
|
||||
QueuePlayerForDelayedSpawn(player.name, newSpawn, moatChoice, global.ocfg["enable-vanilla-spawns"])
|
||||
QueuePlayerForDelayedSpawn(player.name, newSpawn, moatChoice, global.ocfg.enable_vanilla_spawns)
|
||||
if (elemName == "isolated_spawn_near") then
|
||||
SendBroadcastMsg({"oarc-player-is-joining-near", player.name})
|
||||
elseif (elemName == "isolated_spawn_far") then
|
||||
@ -405,8 +405,8 @@ function DisplaySharedSpawnOptions(player)
|
||||
if (sharedSpawn.openAccess and
|
||||
(game.players[spawnName] ~= nil) and
|
||||
game.players[spawnName].connected) then
|
||||
local spotsRemaining = global.ocfg["max-players-shared-spawn"] - GetOnlinePlayersAtSharedSpawn(spawnName)
|
||||
if (global.ocfg["max-players-shared-spawn"] == 0) then
|
||||
local spotsRemaining = global.ocfg.max_players_shared_spawn - GetOnlinePlayersAtSharedSpawn(spawnName)
|
||||
if (global.ocfg.max_players_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}
|
||||
@ -585,7 +585,7 @@ function ExpandSpawnCtrlGui(player, tick)
|
||||
spwnCtrls.style.maximal_height = SPAWN_GUI_MAX_HEIGHT
|
||||
spwnCtrls.horizontal_scroll_policy = "never"
|
||||
|
||||
if global.ocfg["enable-shared-spawns"] then
|
||||
if global.ocfg.enable_shared_spawns then
|
||||
if (global.uniqueSpawns[player.name] ~= nil) then
|
||||
-- This checkbox allows people to join your base when they first
|
||||
-- start the game.
|
||||
@ -608,7 +608,7 @@ function ExpandSpawnCtrlGui(player, tick)
|
||||
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["enable-shared-spawns"] and IsSharedSpawnActive(player)) then
|
||||
if (global.ocfg.enable_shared_spawns and IsSharedSpawnActive(player)) then
|
||||
if ((global.sharedSpawns[player.name].joinQueue ~= nil) and
|
||||
(#global.sharedSpawns[player.name].joinQueue > 0)) then
|
||||
|
||||
@ -809,7 +809,7 @@ function DisplayBuddySpawnOptions(player)
|
||||
|
||||
|
||||
-- Allow picking of teams
|
||||
if (global.ocfg["enable-separate-teams"]) then
|
||||
if (global.ocfg.enable_separate_teams) then
|
||||
buddySpawnFlow.add{name = "buddy_spawn_main_team_radio",
|
||||
type = "radiobutton",
|
||||
caption={"oarc-join-main-team-radio"},
|
||||
@ -851,12 +851,12 @@ function DisplayBuddySpawnOptions(player)
|
||||
-- Some final notes
|
||||
AddSpacerLine(buddyGui, "note_spacer1")
|
||||
|
||||
if (global.ocfg["max-players-shared-spawn"] > 0) then
|
||||
if (global.ocfg.max_players_shared_spawn > 0) then
|
||||
AddLabel(buddyGui, "buddy_max_players_lbl1",
|
||||
{"oarc-max-players-shared-spawn", global.ocfg["max-players-shared-spawn"]-1},
|
||||
{"oarc-max-players-shared-spawn", global.ocfg.max_players_shared_spawn-1},
|
||||
my_note_style)
|
||||
end
|
||||
local spawn_distance_notes={"oarc-spawn-dist-notes", global.ocfg["near-dist-start"], global.ocfg["near-dist-end"], global.ocfg["far-dist-start"], global.ocfg["far-dist-end"]}
|
||||
local spawn_distance_notes={"oarc-spawn-dist-notes", global.ocfg.near_dist_start, global.ocfg.near_dist_end, global.ocfg.far_dist_start, global.ocfg.far_dist_end}
|
||||
AddLabel(buddyGui, "note_lbl1", spawn_distance_notes, my_note_style)
|
||||
end
|
||||
|
||||
@ -936,7 +936,7 @@ function BuddySpawnOptsGuiClick(event)
|
||||
return
|
||||
end
|
||||
|
||||
if (global.ocfg["enable-separate-teams"]) then
|
||||
if (global.ocfg.enable_separate_teams) then
|
||||
joinMainTeamRadio = buddySpawnGui.spawn_buddy_flow.buddy_spawn_main_team_radio.state
|
||||
joinOwnTeamRadio = buddySpawnGui.spawn_buddy_flow.buddy_spawn_new_team_radio.state
|
||||
joinBuddyTeamRadio = buddySpawnGui.spawn_buddy_flow.buddy_spawn_buddy_team_radio.state
|
||||
@ -1152,9 +1152,9 @@ function BuddySpawnRequestMenuClick(event)
|
||||
|
||||
-- Find coordinates of a good place to spawn
|
||||
if (requesterOptions.distChoice == "buddy_spawn_request_far") then
|
||||
newSpawn = FindUngeneratedCoordinates(global.ocfg["far-dist-start"],global.ocfg["far-dist-end"], player.surface)
|
||||
newSpawn = FindUngeneratedCoordinates(global.ocfg.far_dist_start,global.ocfg.far_dist_end, player.surface)
|
||||
elseif (requesterOptions.distChoice == "buddy_spawn_request_near") then
|
||||
newSpawn = FindUngeneratedCoordinates(global.ocfg["near-dist-start"],global.ocfg["near-dist-end"], player.surface)
|
||||
newSpawn = FindUngeneratedCoordinates(global.ocfg.near_dist_start,global.ocfg.near_dist_end, player.surface)
|
||||
end
|
||||
|
||||
-- If that fails, find a random map edge in a rand direction.
|
||||
@ -1166,9 +1166,9 @@ function BuddySpawnRequestMenuClick(event)
|
||||
-- Create that spawn in the global vars
|
||||
local buddySpawn = {x=0,y=0}
|
||||
if (requesterOptions.moatChoice) then
|
||||
buddySpawn = {x=newSpawn.x+(global.ocfg["spawn_config"].gen_settings.land_area_tiles*2)+10, y=newSpawn.y}
|
||||
buddySpawn = {x=newSpawn.x+(global.ocfg.spawn_config.gen_settings.land_area_tiles*2)+10, y=newSpawn.y}
|
||||
else
|
||||
buddySpawn = {x=newSpawn.x+(global.ocfg["spawn_config"].gen_settings.land_area_tiles*2), y=newSpawn.y}
|
||||
buddySpawn = {x=newSpawn.x+(global.ocfg.spawn_config.gen_settings.land_area_tiles*2), y=newSpawn.y}
|
||||
end
|
||||
ChangePlayerSpawn(player, newSpawn)
|
||||
ChangePlayerSpawn(game.players[requesterName], buddySpawn)
|
||||
|
Loading…
x
Reference in New Issue
Block a user