diff --git a/README.md b/README.md index d6f62cf..38d574b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A custom scenario for allowing separate spawn locations in multiplayer. Designed ## WARNING! IN DEVELOPMENT! NOT STABLE! I just started 0.17 compatibility work... this is buggy as HELL. Don't expect any smooth experience. And with scenarios, you lose ALL progress when it crashes. This is NOT like a mod where you can remove it and sometimes recover your map. -## Instructions +## Instructions for starting a server ### STEP 1 @@ -30,9 +30,11 @@ Rename the "FactorioScenarioMultiplayerSpawn" folder to something shorter and mo Start a multiplayer game on your client like normal. #### OPTION 2 (Headless) -Generate a new map, use that save file to host if you want to. +Generate a new map like normal, save the game and use that save file to host. +This uses the "--start-server save_file.zip" cmd line option. +Example: ./factorio --start-server save_file.zip --server-settings your-server-settings.json -#### OPTION 3 (Headless) +#### OPTION 3 (Headless - No zip save BS) Place the scenario code in the game's scenario folder, typically something like "..\Factorio\scenarios\FactorioScenarioMultiplayerSpawn\\.." Start a new game (generates a random map based on the config in config.lua) from the command line: @@ -41,14 +43,24 @@ Start a new game (generates a random map based on the config in config.lua) from If you want to RESUME from this method, use something like this: ./factorio --start-server-load-latest --server-settings my-server-settings.json +##### This is an example of my bash script that I use to start my game: + #!/bin/bash + +settings_files="--server-settings oarc-server-settings.json --server-banlist banlist.json" +admin_list="--server-adminlist server-adminlist.json" +map_gen_settings="--map-gen-settings map-gen-oarc.json" +log_file="--console-log oarc-server.log" +start_scenario_cmd="--start-server-load-scenario FactorioScenarioMultiplayerSpawn" + +/factorio/bin/x64/factorio $start_scenario_cmd $settings_files $log_file $admin_list $map_gen_settings + ## Configuration Look in config.lua for some controls over the different modules. - Not all configurations have been fully tested so modify at your own risk. -If you want to change the RSO config, look for the rso_config and rso_resource_config files. +Resource & terrain map configuration should be done at launch or using --map-gen-settings. ## TODO @@ -60,10 +72,6 @@ For now, just take a look at the source and it should be easy to understand I ho ## Credit -RSO is not my own creation. It was done by Orzelek. I requested permission to include it in my scenario. - -https://mods.factorio.com/mods/orzelek/rso-mod - Several other portions of the code (tags, frontier style rocket silo) have also been adapted from other scenario code. Credit to 3Ra for help as well: https://github.com/3RaGaming @@ -73,8 +81,6 @@ Praise be to Mylon ## Random Notes -While it is an option to disable RSO, I would not recommend doing that. I can't guarantee any bugs or issues as I focus mostly on testing with RSO enabled. - Feel free to submit bugs/fixes/requests/pulls/forks whatever you want. I do not plan on supporting PvP, but I will help anyone who wants to make it a configurable option. diff --git a/config.lua b/config.lua index 0acca62..9352c8b 100644 --- a/config.lua +++ b/config.lua @@ -52,26 +52,26 @@ ENABLE_SEPARATE_SPAWNS = true ENABLE_BUDDY_SPAWN = true -- There's a good chance I will no longer be including RSO as a soft mod. -ENABLE_RSO = false +-- ENABLE_RSO = false -- Frontier style rocket silo mode -FRONTIER_ROCKET_SILO_MODE = false +FRONTIER_ROCKET_SILO_MODE = true -- Enable Undecorator -- Removes decorative items to reduce save file size. ENABLE_UNDECORATOR = false -- Enable Tags -ENABLE_TAGS = false +ENABLE_TAGS = true -- Enable Long Reach -ENABLE_LONGREACH = false +ENABLE_LONGREACH = true -- Enable Autofill -ENABLE_AUTOFILL = false +ENABLE_AUTOFILL = true -- Enable Playerlist -ENABLE_PLAYER_LIST = false +ENABLE_PLAYER_LIST = true PLAYER_LIST_OFFLINE_PLAYERS = true -- List offline players as well. -- Enable Gravestone Chests @@ -95,7 +95,7 @@ ENABLE_REGROWTH = false -- If you have regrowth enabled, this should also be enabled. -- It removes bases for players that join and leave the game quickly. -- This can also be used without enabling regrowth. -ENABLE_ABANDONED_BASE_REMOVAL = true +ENABLE_ABANDONED_BASE_REMOVAL = false -------------------------------------------------------------------------------- -- Spawn Options @@ -223,7 +223,7 @@ START_RESOURCE_OIL_Y_OFFSET = -4 ENABLE_SPAWN_FORCE_GRASS = true -- Set this to true for the spawn area to be surrounded by a circle of trees -SPAWN_TREE_CIRCLE_ENABLED = true +SPAWN_TREE_CIRCLE_ENABLED = false -- Set this to true for the spawn area to be surrounded by an octagon of trees -- I don't recommend using this with moatsm @@ -276,7 +276,7 @@ ENABLE_SHARED_TEAM_CHAT = true RESPAWN_COOLDOWN_IN_MINUTES = 15 RESPAWN_COOLDOWN_TICKS = TICKS_PER_MINUTE * RESPAWN_COOLDOWN_IN_MINUTES --- Require playes to be online for at least 5 minutes +-- Require playes to be online for at least X minutes -- Else their character is removed and their spawn point is freed up for use MIN_ONLINE_TIME_IN_MINUTES = 15 MIN_ONLINE_TIME = TICKS_PER_MINUTE * MIN_ONLINE_TIME_IN_MINUTES @@ -325,7 +325,6 @@ ENABLE_SILO_RADAR = false -------------------------------------------------------------------------------- -- Long Reach Options -------------------------------------------------------------------------------- - BUILD_DIST_BONUS = 64 REACH_DIST_BONUS = BUILD_DIST_BONUS RESOURCE_DIST_BONUS = 2 @@ -333,78 +332,17 @@ RESOURCE_DIST_BONUS = 2 -------------------------------------------------------------------------------- -- Autofill Options -------------------------------------------------------------------------------- - AUTOFILL_TURRET_AMMO_QUANTITY = 10 --------------------------------------------------------------------------------- --- RSO Soft-Mod Configurations --- Configure these to tweak the RSO values. --------------------------------------------------------------------------------- --- CONFIGURE STUFF INSIDE rso_config.lua --- RSO resources can be very lucky/unlucky... --- don't complain if you can't find a resource. - -------------------------------------------------------------------------------- -- MAP CONFIGURATION OPTIONS --- Configure these if you are running headless since there is no way to set --- resources otherwise. +-- In past versions I had a way to config map settings here to be used for cmd +-- line launching, but now you should just be using --map-get-settings option +-- since it works with --start-server-load-scenario +-- Read the README.md file for instructions. -------------------------------------------------------------------------------- --- Set this to true if you are creating the scenario at the cmd line. --- Set this to false if you want to configure the world settings using the in-game --- scenario settings. -CMD_LINE_MAP_GEN = false - --- Adjust settings here to set your map stuff. --- "Sizes can be specified as none, very-low, low, normal, high, very-high" -global.clMapGen = {} -global.clMapGen.terrain_segmentation=1 -global.clMapGen.water = 1 -global.clMapGen.starting_area=1 -global.clMapGen.peaceful_mode=false -global.clMapGen.seed=nil -global.clMapGen.height = 2000000 -global.clMapGen.width = 2000000 - --- These are my go to default vanilla settings, it's not RSO, but it's okay. -global.clMapGen.autoplace_controls = { - ["coal"] = {frequency = 0.20, richness = 0.50, size = 1.50}, - ["copper-ore"] = {frequency = 0.20, richness = 0.50, size = 1.50}, - ["crude-oil"] = {frequency = 0.20, richness = 0.50, size = 1.50}, - ["enemy-base"] = {frequency = 0.20, richness = 0.50, size = 0.50}, - ["iron-ore"] = {frequency = 0.20, richness = 0.50, size = 1.50}, - ["stone"] = {frequency = 0.20, richness = 0.50, size = 1.50}, - ["trees"] = {frequency = 0.50, richness = 1.00, size = 1.50}, - ["uranium-ore"] = {frequency = 0.20, richness = 0.50, size = 1.50} -} - --- Cliff defaults are 10 and 10, set both to 0 to turn cliffs off I think? -global.clMapGen.cliff_settings = { - cliff_elevation_0 = 10, - cliff_elevation_interval = 10, - name = "cliff", - richness = 1 -} - -global.clMapGen.property_expression_names = { - ["control-setting:aux:bias"] = "0.00", - ["control-setting:aux:frequency:multiplier"] = "1.00", - ["control-setting:moisture:bias"] = "0.00", - ["control-setting:moisture:frequency:multiplier"] = "1.00", - -- elevation = "0_17-islands+continents" -} - - - -- starting_points = { - -- { - -- x = 0, - -- y = 0 - -- } - -- } - - - -------------------------------------------------------------------------------- -- ANTI-Griefing stuff ( I don't personally maintain this as I don't care for it.) diff --git a/control.lua b/control.lua index 3c00d2a..71580ac 100644 --- a/control.lua +++ b/control.lua @@ -24,9 +24,8 @@ -- Generic Utility Includes require("lib/oarc_utils") --- require("lib/rso/rso_control") --- require("lib/frontier_silo") --- require("lib/tag") +require("lib/frontier_silo") +require("lib/tag") require("lib/game_opts") -- For Philip. I currently do not use this and need to add proper support for @@ -40,7 +39,7 @@ require("config") -- Scenario Specific Includes require("lib/separate_spawns") require("lib/separate_spawns_guis") --- require("regrowth_map") +require("lib/regrowth_map") -------------------------------------------------------------------------------- -- Rocket Launch Event Code @@ -89,9 +88,7 @@ end -- time the game starts ---------------------------------------- script.on_init(function(event) - - -- CreateLobbySurface() -- Currently unused, but have plans for future. - + -- Configures the map settings for enemies -- This controls evolution growth factors and enemy expansion settings. ConfigureAlienStartingParams() @@ -105,15 +102,15 @@ script.on_init(function(event) InitSpawnGlobalsAndForces() end - -- if SILO_FIXED_POSITION then - -- SetFixedSiloPosition(SILO_POSITION) - -- else - -- SetRandomSiloPosition(SILO_NUM_SPAWNS) - -- end + if SILO_FIXED_POSITION then + SetFixedSiloPosition(SILO_POSITION) + else + SetRandomSiloPosition(SILO_NUM_SPAWNS) + end - -- if FRONTIER_ROCKET_SILO_MODE then - -- GenerateRocketSiloAreas(game.surfaces[GAME_SURFACE_NAME]) - -- end + if FRONTIER_ROCKET_SILO_MODE then + GenerateRocketSiloAreas(game.surfaces[GAME_SURFACE_NAME]) + end SetServerWelcomeMessages() @@ -128,11 +125,11 @@ end) -- Freeplay rocket launch info -- Slightly modified for my purposes ---------------------------------------- --- script.on_event(defines.events.on_rocket_launched, function(event) --- if FRONTIER_ROCKET_SILO_MODE then --- RocketLaunchEvent(event) --- end --- end) +script.on_event(defines.events.on_rocket_launched, function(event) + if FRONTIER_ROCKET_SILO_MODE then + RocketLaunchEvent(event) + end +end) ---------------------------------------- @@ -143,17 +140,13 @@ script.on_event(defines.events.on_chunk_generated, function(event) -- OarcRegrowthChunkGenerate(event.area.left_top) -- end - -- if ENABLE_UNDECORATOR then - -- UndecorateOnChunkGenerate(event) - -- end + if ENABLE_UNDECORATOR then + UndecorateOnChunkGenerate(event) + end - -- if ENABLE_RSO then - -- RSO_ChunkGenerated(event) - -- end - - -- if FRONTIER_ROCKET_SILO_MODE then - -- GenerateRocketSiloChunk(event) - -- end + if FRONTIER_ROCKET_SILO_MODE then + GenerateRocketSiloChunk(event) + end if ENABLE_SEPARATE_SPAWNS and not USE_VANILLA_STARTING_SPAWN then SeparateSpawnsGenerateChunk(event) @@ -169,13 +162,13 @@ end) -- Gui Click ---------------------------------------- script.on_event(defines.events.on_gui_click, function(event) - -- if ENABLE_TAGS then - -- TagGuiClick(event) - -- end + if ENABLE_TAGS then + TagGuiClick(event) + end - -- if ENABLE_PLAYER_LIST then - -- PlayerListGuiClick(event) - -- end + if ENABLE_PLAYER_LIST then + PlayerListGuiClick(event) + end if ENABLE_SEPARATE_SPAWNS then WelcomeTextGuiClick(event) @@ -225,9 +218,9 @@ script.on_event(defines.events.on_player_created, function(event) -- May change this to Lobby in the future. game.players[event.player_index].teleport(game.forces[MAIN_FORCE].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME) - -- if ENABLE_LONGREACH then - -- GivePlayerLongReach(game.players[event.player_index]) - -- end + if ENABLE_LONGREACH then + GivePlayerLongReach(game.players[event.player_index]) + end if not ENABLE_SEPARATE_SPAWNS then PlayerSpawnItems(event) @@ -243,9 +236,9 @@ script.on_event(defines.events.on_player_respawned, function(event) PlayerRespawnItems(event) - -- if ENABLE_LONGREACH then - -- GivePlayerLongReach(game.players[event.player_index]) - -- end + if ENABLE_LONGREACH then + GivePlayerLongReach(game.players[event.player_index]) + end end) -- script.on_event(defines.events.on_pre_player_died, function(event) @@ -262,15 +255,15 @@ script.on_event(defines.events.on_player_left_game, function(event) -- end -- end - -- if ENABLE_SEPARATE_SPAWNS then - -- FindUnusedSpawns(event) - -- end + if ENABLE_SEPARATE_SPAWNS then + FindUnusedSpawns(event) + end end) --- script.on_event(defines.events.on_built_entity, function(event) - -- if ENABLE_AUTOFILL then - -- Autofill(event) - -- end +script.on_event(defines.events.on_built_entity, function(event) + if ENABLE_AUTOFILL then + Autofill(event) + end -- if ENABLE_REGROWTH then -- OarcRegrowthOffLimitsChunk(event.created_entity.position) @@ -279,7 +272,7 @@ end) -- if ENABLE_ANTI_GRIEFING then -- SetItemBlueprintTimeToLive(event) -- end --- end) +end) ---------------------------------------- @@ -290,17 +283,17 @@ script.on_event(defines.events.on_tick, function(event) -- OarcRegrowthOnTick() -- end - -- if ENABLE_ABANDONED_BASE_REMOVAL then - -- OarcRegrowthForceRemovalOnTick() - -- end + if ENABLE_ABANDONED_BASE_REMOVAL then + OarcRegrowthForceRemovalOnTick() + end if ENABLE_SEPARATE_SPAWNS then DelayedSpawnOnTick() end - -- if FRONTIER_ROCKET_SILO_MODE then - -- DelayedSiloCreationOnTick() - -- end + if FRONTIER_ROCKET_SILO_MODE then + DelayedSiloCreationOnTick() + end end) @@ -349,9 +342,9 @@ end) -- On Research Finished -- This is where you can permanently remove researched techs ---------------------------------------- --- script.on_event(defines.events.on_research_finished, function(event) --- if FRONTIER_ROCKET_SILO_MODE then --- RemoveRecipe(event.research.force, "rocket-silo") --- end --- end) +script.on_event(defines.events.on_research_finished, function(event) + if FRONTIER_ROCKET_SILO_MODE then + RemoveRecipe(event.research.force, "rocket-silo") + end +end) diff --git a/lib/frontier_silo.lua b/lib/frontier_silo.lua index a7a73d5..f3401be 100644 --- a/lib/frontier_silo.lua +++ b/lib/frontier_silo.lua @@ -3,7 +3,7 @@ -- My take on frontier silos for my Oarc scenario require("config") -require("locale/oarc_utils") +require("lib/oarc_utils") -------------------------------------------------------------------------------- -- Frontier style rocket silo stuff @@ -65,7 +65,7 @@ local function CreateRocketSilo(surface, siloPosition, force) tiles = {} i = 1 for dx = -5,5 do - for dy = -6,5 do + for dy = -5,5 do tiles[i] = {name = "concrete", position = {siloPosition.x+dx, siloPosition.y+dy}} i=i+1 end diff --git a/lib/game_opts.lua b/lib/game_opts.lua index 2f54910..9b50221 100644 --- a/lib/game_opts.lua +++ b/lib/game_opts.lua @@ -54,9 +54,9 @@ local function ExpandGameOptionsGui(player) if (not ENABLE_SEPARATE_SPAWNS) then soft_mods_string = "Oarc Core [DISABLED!]" end - if (ENABLE_RSO) then - soft_mods_string = soft_mods_string .. ", RSO" - end + -- if (ENABLE_RSO) then + -- soft_mods_string = soft_mods_string .. ", RSO" + -- end if (ENABLE_UNDECORATOR) then soft_mods_string = soft_mods_string .. ", Undecorator" end diff --git a/lib/tag.lua b/lib/tag.lua index b47c53a..7d9264a 100644 --- a/lib/tag.lua +++ b/lib/tag.lua @@ -32,7 +32,7 @@ local function ExpandTagGui(player) if (frame) then frame.destroy() else - local frame = player.gui.left.add{type="frame", name="tag-panel", caption="What are you doing:"} + local frame = player.gui.left.add{type="frame", name="tag-panel", caption="What are you doing:", direction = "vertical"} for _, role in pairs(roles) do frame.add{type="button", caption=role.display_name, name=role.display_name} end