diff --git a/config.lua b/config.lua index 819746a..97cb146 100644 --- a/config.lua +++ b/config.lua @@ -82,6 +82,9 @@ ENABLE_REGROWTH = false -- This can also be used without enabling regrowth. ENABLE_ABANDONED_BASE_REMOVAL = true +-- Enable the new 0.17 research queue by default. +ENABLE_RESEARCH_QUEUE = true + -------------------------------------------------------------------------------- -- Spawn Options -------------------------------------------------------------------------------- @@ -342,12 +345,12 @@ CMD_LINE_GEN = true ENEMY_EXPANSION = true -- Divide the alien evolution factors by this number to reduce it (or multiply if < 1) -ENEMY_TIME_FACTOR_DISABLE = false -- Set this to true to disable time based evolution completely. +ENEMY_TIME_FACTOR_DISABLE = true -- Set this to true to disable time based evolution completely. ENEMY_TIME_FACTOR_DIVISOR = 10 ENEMY_POLLUTION_FACTOR_DISABLE = false -- Set this to true to disable pollution based evolution completely. ENEMY_POLLUTION_FACTOR_DIVISOR = 10 ENEMY_DESTROY_FACTOR_DISABLE = false -- Set this to true to disable spawner destruction based evolution completely. -ENEMY_DESTROY_FACTOR_DIVISOR = 1 +ENEMY_DESTROY_FACTOR_DIVISOR = 2 -- Adjust biter type spawning based on distance to spawns. OARC_MODIFIED_ENEMY_SPAWNING = true diff --git a/lib/separate_spawns.lua b/lib/separate_spawns.lua index 41aabaf..9db7864 100644 --- a/lib/separate_spawns.lua +++ b/lib/separate_spawns.lua @@ -60,7 +60,7 @@ function FindUnusedSpawns(event) global.playerSpawns[player.name] = nil end - -- Remove them from the delayer spawn queue if they are in it + -- Remove them from the delayed spawn queue if they are in it for i=#global.delayedSpawns,1,-1 do delayedSpawn = global.delayedSpawns[i] @@ -104,7 +104,7 @@ function FindUnusedSpawns(event) OarcRegrowthMarkForRemoval(spawnPos, 10) global.chunk_regrow.force_removal_flag = game.tick else - table.insert(global.unusedSpawns, global.uniqueSpawns[player.name]) + -- 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 "..MIN_ONLINE_TIME_IN_MINUTES.." minutes of joining.") end @@ -351,40 +351,70 @@ end -- Initializes the globals used to track the special spawn and player -- status information function InitSpawnGlobalsAndForces() - -- Containes an array of all player spawns - -- A secondary array tracks whether the character will respawn there. + + -- This contains each player's spawn point. Literally where they will respawn. + -- There is a way in game to change this under one of the little menu features I added. if (global.playerSpawns == nil) then global.playerSpawns = {} end + + -- This is the most important table. It is a list of all the unique spawn points. + -- This is what chunk generation checks against. if (global.uniqueSpawns == nil) then global.uniqueSpawns = {} end + + -- This keeps a list of any player that has shared their base. + -- Each entry contains information about if it's open, spawn pos, and players in the group. if (global.sharedSpawns == nil) then global.sharedSpawns = {} end - if (global.unusedSpawns == nil) then - global.unusedSpawns = {} - end + + -- This seems to be unused right now, but I had plans to re-use spawn points in the past. + -- if (global.unusedSpawns == nil) then + -- global.unusedSpawns = {} + -- end + + -- Each player has an option to change their respawn which has a cooldown when used. + -- Other similar abilities/functions that require cooldowns could be added here. if (global.playerCooldowns == nil) then global.playerCooldowns = {} end + + -- List of players in the "waiting room" for a buddy spawn. + -- They show up in the list to select when doing a buddy spawn. if (global.waitingBuddies == nil) then global.waitingBuddies = {} end + + -- Players who have made a spawn choice get put into this list while waiting. + -- An on_tick event checks when it expires and then places down the base resources, and teleports the player. + -- Go look at DelayedSpawnOnTick() for more info. if (global.delayedSpawns == nil) then global.delayedSpawns = {} end + + -- This is what I use to communicate a buddy spawn request between the buddies. + -- This contains information of who is asking, and what options were selected. if (global.buddySpawnOptions == nil) then global.buddySpawnOptions = {} end - game.create_force(MAIN_FORCE) - game.forces[MAIN_FORCE].set_spawn_position(game.forces["player"].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME) + -- 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(MAIN_FORCE) + main_force.set_spawn_position(game.forces["player"].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME) + -- Share vision with other forces. if ENABLE_SHARED_TEAM_VISION then game.forces[MAIN_FORCE].share_chart = true end + if ENABLE_RESEARCH_QUEUE then + game.forces[MAIN_FORCE].research_queue_enabled = true + end + + -- No PVP. This is where you would change things if you want PVP I guess. SetCeaseFireBetweenAllForces() SetFriendlyBetweenAllForces() if (ENABLE_ANTI_GRIEFING) then @@ -518,6 +548,9 @@ function CreatePlayerCustomForce(player) if ENABLE_SHARED_TEAM_VISION then newForce.share_chart = true end + if ENABLE_RESEARCH_QUEUE then + newForce.research_queue_enabled = true + end -- Chart silo areas if necessary if FRONTIER_ROCKET_SILO_MODE and ENABLE_SILO_VISION then ChartRocketSiloAreas(game.surfaces[GAME_SURFACE_NAME], newForce) diff --git a/lib/separate_spawns_guis.lua b/lib/separate_spawns_guis.lua index 6d130f2..eb2c6f3 100644 --- a/lib/separate_spawns_guis.lua +++ b/lib/separate_spawns_guis.lua @@ -196,7 +196,7 @@ function DisplaySpawnOptions(player) "If you create your own spawn point you can allow up to " .. MAX_ONLINE_PLAYERS_AT_SHARED_SPAWN-1 .. " other online players to join.", my_note_style) end - spawn_distance_notes="Near spawn is between " .. NEAR_MIN_DIST .. "-" .. NEAR_MAX_DIST .. " chunks away from the center of the map.\n".. + local spawn_distance_notes="Near spawn is between " .. NEAR_MIN_DIST .. "-" .. NEAR_MAX_DIST .. " chunks away from the center of the map.\n".. "Far spawn is between " .. FAR_MIN_DIST .. "-" .. FAR_MAX_DIST .. " chunks away from the center of the map.\n".. "Solo spawns are dangerous! Expect a fight to reach other players." AddLabel(sGui, "note_lbl1", spawn_distance_notes, my_note_style) @@ -660,8 +660,8 @@ function SpawnCtrlGuiClick(event) return end - joinQueueIndex = event.element.parent.join_queue_dropdown.selected_index - joinQueuePlayerChoice = event.element.parent.join_queue_dropdown.get_item(joinQueueIndex) + local joinQueueIndex = event.element.parent.join_queue_dropdown.selected_index + local joinQueuePlayerChoice = event.element.parent.join_queue_dropdown.get_item(joinQueueIndex) if ((game.players[joinQueuePlayerChoice] == nil) or (not game.players[joinQueuePlayerChoice].connected)) then @@ -709,7 +709,7 @@ function SpawnCtrlGuiClick(event) end -- Spawn the player - joiningPlayer = game.players[joinQueuePlayerChoice] + local joiningPlayer = game.players[joinQueuePlayerChoice] ChangePlayerSpawn(joiningPlayer, global.sharedSpawns[player.name].position) SendPlayerToSpawn(joiningPlayer) GivePlayerStarterItems(joiningPlayer) @@ -810,7 +810,7 @@ function DisplayBuddySpawnOptions(player) "You can allow up to " .. MAX_ONLINE_PLAYERS_AT_SHARED_SPAWN-1 .. " other online players to join.", my_note_style) end - spawn_distance_notes="Near spawn is between " .. NEAR_MIN_DIST .. "-" .. NEAR_MAX_DIST .. " chunks away from the center of the map.\n".. + local spawn_distance_notes="Near spawn is between " .. NEAR_MIN_DIST .. "-" .. NEAR_MAX_DIST .. " chunks away from the center of the map.\n".. "Far spawn is between " .. FAR_MIN_DIST .. "-" .. FAR_MAX_DIST .. " chunks away from the center of the map.\n".. "Solo spawns are dangerous! Expect a fight to reach other players." AddLabel(buddyGui, "note_lbl1", spawn_distance_notes, my_note_style) @@ -852,7 +852,7 @@ function BuddySpawnOptsGuiClick(event) -- Remove them from the buddy list when they cancel for i=#global.waitingBuddies,1,-1 do - name = global.waitingBuddies[i] + local name = global.waitingBuddies[i] if (name == player.name) then table.remove(global.waitingBuddies, i) end @@ -866,9 +866,9 @@ function BuddySpawnOptsGuiClick(event) if ((elemName == "buddy_spawn_request_near") or (elemName == "buddy_spawn_request_far")) then - buddySpawnGui = player.gui.center.buddy_spawn_opts + local buddySpawnGui = player.gui.center.buddy_spawn_opts - dropDownIndex = buddySpawnGui.waiting_buddies_dropdown.selected_index + local dropDownIndex = buddySpawnGui.waiting_buddies_dropdown.selected_index if (dropDownIndex > 0) then buddyChoice = buddySpawnGui.waiting_buddies_dropdown.get_item(dropDownIndex) else @@ -876,7 +876,7 @@ function BuddySpawnOptsGuiClick(event) return end - buddyIsStillWaiting = false + local buddyIsStillWaiting = false for _,buddyName in pairs(global.waitingBuddies) do if (buddyChoice == buddyName) then if (game.players[buddyChoice]) then @@ -975,7 +975,7 @@ function BuddySpawnWaitMenuClick(event) player.gui.center.buddy_wait_menu.destroy() DisplaySpawnOptions(player) - buddy = game.players[global.buddySpawnOptions[player.name].buddyChoice] + local buddy = game.players[global.buddySpawnOptions[player.name].buddyChoice] if (buddy.gui.center.buddy_request_menu ~= nil) then buddy.gui.center.buddy_request_menu.destroy() @@ -1008,7 +1008,7 @@ function DisplayBuddySpawnRequestMenu(player, requestingBuddyName) -- Warnings and explanations... AddLabel(sGui, "warning_lbl1", requestingBuddyName .. " is requesting a buddy spawn from you!", my_warning_style) - teamText = "error!" + local teamText = "error!" if (global.buddySpawnOptions[requestingBuddyName].joinMainTeamRadio) then teamText = "the main team" elseif (global.buddySpawnOptions[requestingBuddyName].joinOwnTeamRadio) then @@ -1017,12 +1017,12 @@ function DisplayBuddySpawnRequestMenu(player, requestingBuddyName) teamText = "a buddy team" end - moatText = " " + local moatText = " " if (global.buddySpawnOptions[requestingBuddyName].moatChoice) then moatText = " surrounded by a moat " end - distText = "error!" + local distText = "error!" if (global.buddySpawnOptions[requestingBuddyName].distChoice == "buddy_spawn_request_near") then distText = "near to the center of the map!" elseif (global.buddySpawnOptions[requestingBuddyName].distChoice == "buddy_spawn_request_far") then @@ -1030,7 +1030,7 @@ function DisplayBuddySpawnRequestMenu(player, requestingBuddyName) end - requestText = requestingBuddyName .. " would like to join " .. teamText .. " next to you" .. moatText .. distText + local requestText = requestingBuddyName .. " would like to join " .. teamText .. " next to you" .. moatText .. distText AddLabel(sGui, "note_lbl1", requestText, my_warning_style) AddSpacer(sGui, "note_spacer1") @@ -1061,8 +1061,8 @@ function BuddySpawnRequestMenuClick(event) -- Check if it's a button press and lookup the matching buddy info if ((elemName == "accept_buddy_request") or (elemName == "decline_buddy_request")) then - requesterName = nil - requesterOptions = {} + local requesterName = nil + local requesterOptions = {} for name,opts in pairs(global.buddySpawnOptions) do if (opts.buddyChoice == player.name) then requesterName = name @@ -1120,6 +1120,7 @@ function BuddySpawnRequestMenuClick(event) end -- Create that spawn in the global vars + local buddySpawn = {x=0,y=0} if (requesterOptions.moatChoice) then buddySpawn = {x=newSpawn.x+(ENFORCE_LAND_AREA_TILE_DIST*2)+10, y=newSpawn.y} else @@ -1152,7 +1153,7 @@ function BuddySpawnRequestMenuClick(event) player.gui.center.buddy_request_menu.destroy() DisplaySpawnOptions(player) - requesterBuddy = game.players[requesterName] + local requesterBuddy = game.players[requesterName] if (requesterBuddy.gui.center.buddy_wait_menu ~= nil) then requesterBuddy.gui.center.buddy_wait_menu.destroy()