1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2025-01-18 02:58:37 +02:00

Multiple 0.15 fixes and preparation for separate forces/teams.

This commit is contained in:
Oarcinae 2017-04-26 20:59:48 -04:00
parent 1bf0d4e55b
commit cf269a041d
5 changed files with 101 additions and 23 deletions

View File

@ -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, Long-Reach, Autofill"
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.3.0):"
OTHER_MSG2 = "0.15 Compatibility Update - Still in Beta!?!"
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"
@ -31,7 +31,7 @@ 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 - Happy 0.15 Release!"
WELCOME_MSG_TITLE_OARC = "Welcome to Oarc's Server - Happy 0.15.X Bug Fest!"
--------------------------------------------------------------------------------
@ -68,6 +68,13 @@ ENABLE_AUTOFILL = 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
@ -86,9 +93,10 @@ 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_OIL_AMOUNT = 30000
START_URANIUM_AMOUNT = 1000
START_OIL_AMOUNT = 300000
-- Start resource shape
-- If this is true, it will be a circle
@ -113,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
@ -198,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
@ -211,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 = true
global.oarcDebugEnabled = true

View File

@ -85,6 +85,9 @@ end
----------------------------------------
script.on_init(function(event)
CreateLobbySurface()
CreateGameSurface(MAP_SETTINGS_NO_RESOURCES)
if ENABLE_SEPARATE_SPAWNS then
InitSpawnGlobalsAndForces()
end
@ -96,7 +99,7 @@ script.on_init(function(event)
end
if FRONTIER_ROCKET_SILO_MODE then
ChartRocketSiloArea(game.forces[MAIN_FORCE])
ChartRocketSiloArea(game.forces[MAIN_FORCE], game.surfaces[GAME_SURFACE_NAME])
end
global.welcome_msg = WELCOME_MSG
@ -160,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
@ -169,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
@ -227,14 +232,14 @@ end)
----------------------------------------
script.on_event(defines.events.on_research_finished, function(event)
if FRONTIER_ROCKET_SILO_MODE then
RemoveRocketSiloRecipe(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, "resource-monitoring");
AddRecipe(event.research.force, "rocket-silo");
end
end)

2
locale

@ -1 +1 @@
Subproject commit 1c2d53a810d264e4080c5693a80b6ce26d9f4723
Subproject commit c916629809bdd2f04f1dd1db67a55726880beaf4

View File

@ -170,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
@ -190,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
@ -206,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
@ -218,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

View File

@ -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