mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2025-01-26 03:20:21 +02:00
Merging dev to main. Should be mostly stable for 0.15
This commit is contained in:
commit
f6fe07c4e5
@ -53,4 +53,4 @@ https://mods.factorio.com/mods/orzelek/rso-mod
|
||||
|
||||
Several other portions of the code (tags, frontier style rocket silo) have also been adapted from other scenario code.
|
||||
|
||||
Credit to 3Ra as well: https://github.com/3RaGaming/3Ra-Enhanced-Vanilla
|
||||
Credit to 3Ra for help as well: https://github.com/3RaGaming
|
103
config.lua
103
config.lua
@ -1,5 +1,5 @@
|
||||
-- config.lua
|
||||
-- Dec 2016
|
||||
-- Apr 2017
|
||||
-- Configuration Options
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@ -8,14 +8,14 @@
|
||||
|
||||
WELCOME_MSG = "[INSERT SERVER OWNER MSG HERE!]"
|
||||
GAME_MODE_MSG = "In the current game mode, a satellite must be launched from an existing far away rocket silo to win!"
|
||||
MODULES_ENABLED = "Mods Enabled: Separate Spawns, RSO, Gravestone Chests, Long-Reach, Autofill, Blueprint Strings"
|
||||
MODULES_ENABLED = "Mods Enabled: Separate Spawns, RSO, Long-Reach, Autofill, Undecorator"
|
||||
|
||||
WELCOME_MSG_TITLE = "[INSERT SERVER OWNER MSG HERE!]"
|
||||
WELCOME_MSG1 = "Rules: Be polite. Ask before changing other players's stuff. Have fun!"
|
||||
WELCOME_MSG2 = "This server is running a custom scenario that changes spawn locations."
|
||||
|
||||
OTHER_MSG1 = "Latest updates in this scenario version (0.2.8):"
|
||||
OTHER_MSG2 = "New spawn layout. RSO resource richness reduced"
|
||||
OTHER_MSG1 = "Latest updates in this scenario version (0.3.0):"
|
||||
OTHER_MSG2 = "0.15.X Compatibility Update - Still in Beta!?!"
|
||||
|
||||
|
||||
WELCOME_MSG3 = "Due to the way this scenario works, it may take some time for the land"
|
||||
@ -24,14 +24,14 @@ WELCOME_MSG5 = "Please wait for 10-20 seconds when you select your first spawn."
|
||||
WELCOME_MSG6 = "Contact: SteamID:Oarc | Twitter:@_Oarc_ | oarcinae@gmail.com"
|
||||
|
||||
|
||||
SPAWN_MSG1 = "Current Spawn Mode: HARDCORE WILDERNESS (Always in BETA)"
|
||||
SPAWN_MSG1 = "Current Spawn Mode: HARDCORE WILDERNESS (BETA)"
|
||||
SPAWN_MSG2 = "In this mode, there is no default spawn. Everyone starts in the wild!"
|
||||
SPAWN_MSG3 = "Resources are spread out far apart but are quite rich."
|
||||
|
||||
-- These are my specific welcome messages that get used only if I am the user
|
||||
-- that creates the game.
|
||||
WELCOME_MSG_OARC = "Welcome to Oarc's official server! Join the discord here: discord.gg/Wj56gkU"
|
||||
WELCOME_MSG_TITLE_OARC = "Welcome to Oarc's Server"
|
||||
WELCOME_MSG_TITLE_OARC = "Welcome to Oarc's Server - Happy 0.15.X Bug Fest!"
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@ -49,9 +49,6 @@ ENABLE_SEPARATE_SPAWNS = true
|
||||
-- Enable Scenario version of RSO
|
||||
ENABLE_RSO = true
|
||||
|
||||
-- Enable Gravestone Chests
|
||||
ENABLE_GRAVESTONE_CHESTS = true
|
||||
|
||||
-- Enable Undecorator
|
||||
ENABLE_UNDECORATOR = true
|
||||
|
||||
@ -64,9 +61,6 @@ ENABLE_LONGREACH = true
|
||||
-- Enable Autofill
|
||||
ENABLE_AUTOFILL = true
|
||||
|
||||
-- Enable BPS
|
||||
ENABLE_BLUEPRINT_STRING = true
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Spawn Options
|
||||
--------------------------------------------------------------------------------
|
||||
@ -74,6 +68,13 @@ ENABLE_BLUEPRINT_STRING = true
|
||||
---------------------------------------
|
||||
-- Distance Options
|
||||
---------------------------------------
|
||||
|
||||
-- This is 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. The larger you make this, the further away players will spawn from
|
||||
-- generated map area (even if it is not visible on the map!).
|
||||
CHECK_SPAWN_UNGENERATED_CHUNKS_RADIUS = 5
|
||||
|
||||
-- Near Distance in chunks
|
||||
NEAR_MIN_DIST = 25 --50
|
||||
NEAR_MAX_DIST = 100 --125
|
||||
@ -92,8 +93,9 @@ WATER_SPAWN_LENGTH = 8
|
||||
-- Start resource amounts
|
||||
START_IRON_AMOUNT = 1500
|
||||
START_COPPER_AMOUNT = 1500
|
||||
START_STONE_AMOUNT = 1500
|
||||
START_STONE_AMOUNT = 1000
|
||||
START_COAL_AMOUNT = 1500
|
||||
START_URANIUM_AMOUNT = 1000
|
||||
START_OIL_AMOUNT = 300000
|
||||
|
||||
-- Start resource shape
|
||||
@ -119,9 +121,22 @@ START_RESOURCE_IRON_POS_X = -29
|
||||
START_RESOURCE_IRON_POS_Y = 16
|
||||
START_RESOURCE_IRON_SIZE = 16
|
||||
|
||||
START_RESOURCE_URANIUM_POS_X = 17
|
||||
START_RESOURCE_URANIUM_POS_Y = -34
|
||||
START_RESOURCE_URANIUM_SIZE = 10
|
||||
|
||||
-- There are 2 oil spots generated.
|
||||
START_RESOURCE_OIL_POS_X = -39
|
||||
START_RESOURCE_OIL_POS_Y = 0
|
||||
|
||||
-- Specify 2 oil spot locations
|
||||
START_RESOURCE_OIL_A_POS_X = -39
|
||||
START_RESOURCE_OIL_A_POS_Y = -2
|
||||
START_RESOURCE_OIL_B_POS_X = -39
|
||||
START_RESOURCE_OIL_B_POS_Y = 2
|
||||
|
||||
|
||||
|
||||
-- Force the land area circle at the spawn to be fully grass
|
||||
ENABLE_SPAWN_FORCE_GRASS = true
|
||||
|
||||
@ -184,13 +199,7 @@ MIN_ONLINE_TIME = TICKS_PER_MINUTE * MIN_ONLIME_TIME_IN_MINUTES
|
||||
--------------------------------------------------------------------------------
|
||||
-- Alien Options
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- Enable/Disable enemy expansion (Applies to RSO as well!)
|
||||
ENEMY_EXPANSION = false
|
||||
|
||||
-- Divide the alien factors by this number to reduce it (or multiply if < 1)
|
||||
ENEMY_POLLUTION_FACTOR_DIVISOR = 10
|
||||
ENEMY_DESTROY_FACTOR_DIVISOR = 5
|
||||
-- This should now be configured in the starting map generation as of 0.15
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Frontier Rocket Silo Options
|
||||
@ -210,7 +219,7 @@ ENABLE_RANDOM_SILO_POSITION = true
|
||||
-- Long Reach Options
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
BUILD_DIST_BONUS = 15
|
||||
BUILD_DIST_BONUS = 20
|
||||
REACH_DIST_BONUS = BUILD_DIST_BONUS
|
||||
RESOURCE_DIST_BONUS = 2
|
||||
|
||||
@ -223,10 +232,60 @@ AUTOFILL_TURRET_AMMO_QUANTITY = 10
|
||||
--------------------------------------------------------------------------------
|
||||
-- Use rso_config and rso_resourece_config for RSO config settings
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
-- Surface generation stuff, don't touch unless you know what you're doing...
|
||||
--------------------------------------------------------------------------------
|
||||
--
|
||||
-- Default map settings for disabling all vanilla resources!
|
||||
MAP_SETTINGS_NO_RESOURCES={
|
||||
terrain_segmentation="very-low",
|
||||
water="high",
|
||||
starting_area="very-low",
|
||||
peaceful_mode=false,
|
||||
seed=math.random(999999999),
|
||||
autoplace_controls = {
|
||||
["coal"]={
|
||||
frequency="normal",
|
||||
richness="normal",
|
||||
size="none"
|
||||
},
|
||||
["copper-ore"]={
|
||||
frequency="normal",
|
||||
richness="normal",
|
||||
size="none"
|
||||
},
|
||||
["iron-ore"]={
|
||||
frequency="normal",
|
||||
richness="normal",
|
||||
size="none"
|
||||
},
|
||||
["stone"]={
|
||||
frequency="normal",
|
||||
richness="normal",
|
||||
size="none"
|
||||
},
|
||||
["uranium-ore"]={
|
||||
frequency="normal",
|
||||
richness="normal",
|
||||
size="none"
|
||||
},
|
||||
["crude-oil"]={
|
||||
frequency="normal",
|
||||
richness="normal",
|
||||
size="none"
|
||||
},
|
||||
["enemy-base"]={
|
||||
frequency="normal",
|
||||
richness="normal",
|
||||
size="none"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- DEBUG
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- DEBUG prints for me
|
||||
global.oarcDebugEnabled = false
|
||||
global.oarcDebugEnabled = true
|
55
control.lua
55
control.lua
@ -1,5 +1,5 @@
|
||||
-- control.lua
|
||||
-- Nov 2016
|
||||
-- Apr 2017
|
||||
|
||||
-- Oarc's Separated Spawn Scenario
|
||||
--
|
||||
@ -9,7 +9,6 @@
|
||||
-- Credit:
|
||||
-- RSO mod to RSO author - Orzelek - I contacted him via the forum
|
||||
-- Tags - Taken from WOGs scenario
|
||||
-- Event - Taken from WOGs scenario (looks like original source was 3Ra)
|
||||
-- Rocket Silo - Taken from Frontier as an idea
|
||||
--
|
||||
-- Feel free to re-use anything you want. It would be nice to give me credit
|
||||
@ -29,7 +28,6 @@ require("locale/oarc_utils")
|
||||
require("locale/rso/rso_control")
|
||||
require("locale/frontier_silo")
|
||||
require("locale/tag")
|
||||
require("locale/blueprintstring/bps")
|
||||
|
||||
-- Main Configuration File
|
||||
require("config")
|
||||
@ -87,9 +85,8 @@ end
|
||||
----------------------------------------
|
||||
script.on_init(function(event)
|
||||
|
||||
-- Configures the map settings for enemies
|
||||
-- This controls evolution growth factors and enemy expansion settings.
|
||||
ConfigureAlienStartingParams()
|
||||
CreateLobbySurface()
|
||||
CreateGameSurface(MAP_SETTINGS_NO_RESOURCES)
|
||||
|
||||
if ENABLE_SEPARATE_SPAWNS then
|
||||
InitSpawnGlobalsAndForces()
|
||||
@ -102,11 +99,7 @@ script.on_init(function(event)
|
||||
end
|
||||
|
||||
if FRONTIER_ROCKET_SILO_MODE then
|
||||
ChartRocketSiloArea(game.forces[MAIN_FORCE])
|
||||
end
|
||||
|
||||
if ENABLE_BLUEPRINT_STRING then
|
||||
bps_init()
|
||||
ChartRocketSiloArea(game.forces[MAIN_FORCE], game.surfaces[GAME_SURFACE_NAME])
|
||||
end
|
||||
|
||||
global.welcome_msg = WELCOME_MSG
|
||||
@ -163,9 +156,6 @@ script.on_event(defines.events.on_gui_click, function(event)
|
||||
SharedSpwnOptsGuiClick(event)
|
||||
end
|
||||
|
||||
if ENABLE_BLUEPRINT_STRING then
|
||||
bps_on_gui_click(event)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@ -173,7 +163,7 @@ end)
|
||||
-- Player Events
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_player_joined_game, function(event)
|
||||
|
||||
game.players[event.player_index].teleport(game.forces[MAIN_FORCE].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME)
|
||||
PlayerJoinedMessages(event)
|
||||
|
||||
if ENABLE_TAGS then
|
||||
@ -182,6 +172,8 @@ script.on_event(defines.events.on_player_joined_game, function(event)
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_player_created, function(event)
|
||||
game.players[event.player_index].teleport(game.forces[MAIN_FORCE].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME)
|
||||
|
||||
SetOarcServerMessages(event)
|
||||
|
||||
if ENABLE_LONGREACH then
|
||||
@ -200,11 +192,13 @@ script.on_event(defines.events.on_player_created, function(event)
|
||||
end
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_player_died, function(event)
|
||||
if ENABLE_GRAVESTONE_CHESTS then
|
||||
CreateGravestoneChestsOnDeath(event)
|
||||
end
|
||||
end)
|
||||
-- Disabled as of 0.15.x
|
||||
-- Gravestone is now part of vanilla game! WOO!
|
||||
-- script.on_event(defines.events.on_player_died, function(event)
|
||||
-- if ENABLE_GRAVESTONE_CHESTS then
|
||||
-- CreateGravestoneChestsOnDeath(event)
|
||||
-- end
|
||||
-- end)
|
||||
|
||||
script.on_event(defines.events.on_player_respawned, function(event)
|
||||
if not ENABLE_SEPARATE_SPAWNS then
|
||||
@ -234,26 +228,25 @@ end)
|
||||
|
||||
----------------------------------------
|
||||
-- On Research Finished
|
||||
-- This is where you can permanently add/remove researched techs
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_research_finished, function(event)
|
||||
if FRONTIER_ROCKET_SILO_MODE then
|
||||
RemoveRocketSiloRecipe(event)
|
||||
end
|
||||
|
||||
if ENABLE_BLUEPRINT_STRING then
|
||||
bps_on_research_finished(event)
|
||||
RemoveRecipe(event.research.force, "rocket-silo")
|
||||
end
|
||||
|
||||
-- Example of how to remove a particular recipe:
|
||||
-- RemoveRecipe(event, "beacon")
|
||||
|
||||
if (global.oarcDebugEnabled) then
|
||||
AddRecipe(event.research.force, "rocket-silo");
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
----------------------------------------
|
||||
-- BPS Specific Event
|
||||
-- Other?
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_robot_built_entity, function(event)
|
||||
if ENABLE_BLUEPRINT_STRING then
|
||||
bps_on_robot_built_entity(event)
|
||||
end
|
||||
end)
|
||||
-- script.on_event(defines.events.on_robot_built_entity, function(event)
|
||||
|
||||
-- end)
|
2
locale
2
locale
@ -1 +1 @@
|
||||
Subproject commit 74961dd7269a8c9a5621403125796d4381a288bd
|
||||
Subproject commit c916629809bdd2f04f1dd1db67a55726880beaf4
|
@ -57,7 +57,10 @@ function FindUnusedSpawns(event)
|
||||
-- If a uniqueSpawn was created for the player, mark it as unused.
|
||||
if (global.uniqueSpawns[player.name] ~= nil) then
|
||||
table.insert(global.unusedSpawns, global.uniqueSpawns[player.name])
|
||||
global.uniqueSpawns[player.name] = nil
|
||||
|
||||
-- TODO: Test player joining and leaving quickly to ensure
|
||||
-- spawn points are not messed up...
|
||||
-- global.uniqueSpawns[player.name] = nil
|
||||
SendBroadcastMsg(player.name .. " base was freed up because they left within 5 minutes of joining.")
|
||||
end
|
||||
|
||||
@ -167,8 +170,10 @@ function InitSpawnGlobalsAndForces()
|
||||
end
|
||||
|
||||
game.create_force(MAIN_FORCE)
|
||||
game.forces[MAIN_FORCE].set_spawn_position(game.forces["player"].get_spawn_position("nauvis"), "nauvis")
|
||||
game.forces[MAIN_FORCE].set_spawn_position(game.forces["player"].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME)
|
||||
SetCeaseFireBetweenAllForces()
|
||||
SetFriendlyBetweenAllForces()
|
||||
AntiGriefing(game.forces[MAIN_FORCE])
|
||||
end
|
||||
|
||||
|
||||
@ -187,9 +192,9 @@ end
|
||||
|
||||
function SendPlayerToNewSpawnAndCreateIt(player, spawn)
|
||||
-- Send the player to that position
|
||||
player.teleport(spawn)
|
||||
player.teleport(spawn, GAME_SURFACE_NAME)
|
||||
GivePlayerStarterItems(player)
|
||||
ChartArea(player.force, player.position, 4)
|
||||
ChartArea(player.force, player.position, 4, player.surface)
|
||||
|
||||
-- If we get a valid spawn point, setup the area
|
||||
if ((spawn.x ~= 0) and (spawn.y ~= 0)) then
|
||||
@ -203,9 +208,9 @@ end
|
||||
|
||||
function SendPlayerToSpawn(player)
|
||||
if (DoesPlayerHaveCustomSpawn(player)) then
|
||||
player.teleport(global.playerSpawns[player.name])
|
||||
player.teleport(global.playerSpawns[player.name], GAME_SURFACE_NAME)
|
||||
else
|
||||
player.teleport(game.forces[MAIN_FORCE].get_spawn_position("nauvis"))
|
||||
player.teleport(game.forces[MAIN_FORCE].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME)
|
||||
end
|
||||
end
|
||||
|
||||
@ -215,7 +220,7 @@ function SendPlayerToRandomSpawn(player)
|
||||
local counter = 0
|
||||
|
||||
if (rndSpawn == 0) then
|
||||
player.teleport(game.forces[MAIN_FORCE].get_spawn_position("nauvis"))
|
||||
player.teleport(game.forces[MAIN_FORCE].get_spawn_position(GAME_SURFACE_NAME), GAME_SURFACE_NAME)
|
||||
else
|
||||
counter = counter + 1
|
||||
for name,spawnPos in pairs(global.uniqueSpawns) do
|
||||
|
@ -261,9 +261,9 @@ function SpawnOptsGuiClick(event)
|
||||
if (buttonClicked == "default_spawn_btn") then
|
||||
CreateSpawnCtrlGui(player)
|
||||
GivePlayerStarterItems(player)
|
||||
ChangePlayerSpawn(player, player.force.get_spawn_position("nauvis"))
|
||||
ChangePlayerSpawn(player, player.force.get_spawn_position(GAME_SURFACE_NAME))
|
||||
SendBroadcastMsg(player.name .. " joined the main force!")
|
||||
ChartArea(player.force, player.position, 4)
|
||||
ChartArea(player.force, player.position, 4, player.surface)
|
||||
|
||||
elseif ((buttonClicked == "isolated_spawn_near") or (buttonClicked == "isolated_spawn_far")) then
|
||||
CreateSpawnCtrlGui(player)
|
||||
@ -284,14 +284,14 @@ function SpawnOptsGuiClick(event)
|
||||
|
||||
-- Find coordinates of a good place to spawn
|
||||
if (buttonClicked == "isolated_spawn_far") then
|
||||
newSpawn = FindUngeneratedCoordinates(FAR_MIN_DIST,FAR_MAX_DIST)
|
||||
newSpawn = FindUngeneratedCoordinates(FAR_MIN_DIST,FAR_MAX_DIST, player.surface)
|
||||
elseif (buttonClicked == "isolated_spawn_near") then
|
||||
newSpawn = FindUngeneratedCoordinates(NEAR_MIN_DIST,NEAR_MAX_DIST)
|
||||
newSpawn = FindUngeneratedCoordinates(NEAR_MIN_DIST,NEAR_MAX_DIST, player.surface)
|
||||
end
|
||||
|
||||
-- If that fails, find a random map edge in a rand direction.
|
||||
if ((newSpawn.x == 0) and (newSpawn.x == 0)) then
|
||||
newSpawn = FindMapEdge(GetRandomVector())
|
||||
newSpawn = FindMapEdge(GetRandomVector(), player.surface)
|
||||
DebugPrint("Resorting to find map edge! x=" .. newSpawn.x .. ",y=" .. newSpawn.y)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user