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

Made starting resources configurable

This commit is contained in:
Oarcinae 2016-12-16 14:57:00 -05:00
parent d3dcde2636
commit ee7d491a54
3 changed files with 70 additions and 24 deletions

View File

@ -5,15 +5,15 @@
-- Messages
--------------------------------------------------------------------------------
WELCOME_MSG = "[INSERT SERVER OWNER MSG HERE!]"
-- WELCOME_MSG = "Welcome to Oarc's official server! Follow @_Oarc_ for server updates."
-- WELCOME_MSG = "[INSERT SERVER OWNER MSG HERE!]"
WELCOME_MSG = "Welcome to Oarc's official server! Follow @_Oarc_ for server updates."
GAME_MODE_MSG = "In the current game mode, a satellite must be launched from an existing far away rocket silo to win!"
-- GAME_MODE_MSG = "The current game mode is just basic vanilla!"
MODULES_ENABLED = "Mods Enabled: Separate Spawns, RSO, Gravestone Chests, Long-Reach"
-- MODULES_ENABLED = "Mods Enabled: Gravestone-Chests"
WELCOME_MSG_TITLE = "[INSERT SERVER OWNER MSG HERE!]"
-- WELCOME_MSG_TITLE = "Welcome to Oarc's Server"
-- WELCOME_MSG_TITLE = "[INSERT SERVER OWNER MSG HERE!]"
WELCOME_MSG_TITLE = "Welcome to Oarc's Server"
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."
@ -81,7 +81,7 @@ FAR_MAX_DIST = 200 --125
---------------------------------------
-- Start resource amounts
START_IRON_AMOUNT = 1500
START_IRON_AMOUNT = 1800
START_COPPER_AMOUNT = 1500
START_STONE_AMOUNT = 1500
START_COAL_AMOUNT = 1500
@ -89,7 +89,25 @@ START_OIL_AMOUNT = 30000
-- Start resource position and size
MAX_START_RESOURCE_PATCH_SIZE = 15
-- Position is relative to player starting location
START_RESOURCE_STONE_POS_X = -25
START_RESOURCE_STONE_POS_Y = -31
START_RESOURCE_STONE_SIZE = 15
START_RESOURCE_COAL_POS_X = -25
START_RESOURCE_COAL_POS_Y = -16
START_RESOURCE_COAL_SIZE = 15
START_RESOURCE_COPPER_POS_X = -25
START_RESOURCE_COPPER_POS_Y = 0
START_RESOURCE_COPPER_SIZE = 15
START_RESOURCE_IRON_POS_X = -25
START_RESOURCE_IRON_POS_Y = 15
START_RESOURCE_IRON_SIZE = 15
START_RESOURCE_OIL_POS_X = -30
START_RESOURCE_OIL_POS_Y = 0
---------------------------------------
-- Safe Spawn Area Options

View File

@ -466,7 +466,7 @@ function AutofillTurret(player, turret)
-- Check the result and print the right text to inform the user what happened.
if (ret > 0) then
-- Inserted ammo successfully
FlyingText("Inserted ammo x" .. ret, turret.position, my_color_red)
-- FlyingText("Inserted ammo x" .. ret, turret.position, my_color_red)
elseif (ret == -1) then
FlyingText("Out of ammo!", turret.position, my_color_red)
elseif (ret == -2) then

View File

@ -257,45 +257,73 @@ function GenerateStartingResources(player)
local surface = player.surface
-- Generate stone
local stonePos = {x=player.position.x-25,
y=player.position.y-31}
local stonePos = {x=player.position.x+START_RESOURCE_STONE_POS_X,
y=player.position.y+START_RESOURCE_STONE_POS_Y}
-- Generate coal
local coalPos = {x=player.position.x-25,
y=player.position.y-16}
local coalPos = {x=player.position.x+START_RESOURCE_COAL_POS_X,
y=player.position.y+START_RESOURCE_COAL_POS_Y}
-- Generate copper ore
local copperOrePos = {x=player.position.x-25,
y=player.position.y+0}
local copperOrePos = {x=player.position.x+START_RESOURCE_COPPER_POS_X,
y=player.position.y+START_RESOURCE_COPPER_POS_Y}
-- Generate iron ore
local ironOrePos = {x=player.position.x-25,
y=player.position.y+15}
local ironOrePos = {x=player.position.x+START_RESOURCE_IRON_POS_X,
y=player.position.y+START_RESOURCE_IRON_POS_Y}
-- Tree generation is taken care of in chunk generation
-- Generate oil patches
surface.create_entity({name="crude-oil", amount=START_OIL_AMOUNT,
position={player.position.x-30, player.position.y-2}})
position={player.position.x+START_RESOURCE_OIL_POS_X, player.position.y+START_RESOURCE_OIL_POS_Y-2}})
surface.create_entity({name="crude-oil", amount=START_OIL_AMOUNT,
position={player.position.x-30, player.position.y+2}})
position={player.position.x+START_RESOURCE_OIL_POS_X, player.position.y+START_RESOURCE_OIL_POS_Y+2}})
local midPoint = math.floor(MAX_START_RESOURCE_PATCH_SIZE/2)
for y=0, MAX_START_RESOURCE_PATCH_SIZE do
for x=0, MAX_START_RESOURCE_PATCH_SIZE do
local midPoint = math.floor(START_RESOURCE_STONE_SIZE/2)
for y=0, START_RESOURCE_STONE_SIZE do
for x=0, START_RESOURCE_STONE_SIZE do
if ((x-midPoint)^2 + (y-midPoint)^2 < midPoint^2) then
surface.create_entity({name="iron-ore", amount=START_IRON_AMOUNT,
position={ironOrePos.x+x, ironOrePos.y+y}})
surface.create_entity({name="copper-ore", amount=START_COPPER_AMOUNT,
position={copperOrePos.x+x, copperOrePos.y+y}})
surface.create_entity({name="stone", amount=START_STONE_AMOUNT,
position={stonePos.x+x, stonePos.y+y}})
end
end
end
local midPoint = math.floor(START_RESOURCE_COAL_SIZE/2)
for y=0, START_RESOURCE_COAL_SIZE do
for x=0, START_RESOURCE_COAL_SIZE do
if ((x-midPoint)^2 + (y-midPoint)^2 < midPoint^2) then
surface.create_entity({name="coal", amount=START_COAL_AMOUNT,
position={coalPos.x+x, coalPos.y+y}})
end
end
end
local midPoint = math.floor(START_RESOURCE_COPPER_SIZE/2)
for y=0, START_RESOURCE_COPPER_SIZE do
for x=0, START_RESOURCE_COPPER_SIZE do
if ((x-midPoint)^2 + (y-midPoint)^2 < midPoint^2) then
surface.create_entity({name="copper-ore", amount=START_COPPER_AMOUNT,
position={copperOrePos.x+x, copperOrePos.y+y}})
end
end
end
local midPoint = math.floor(START_RESOURCE_IRON_SIZE/2)
for y=0, START_RESOURCE_IRON_SIZE do
for x=0, START_RESOURCE_IRON_SIZE do
if ((x-midPoint)^2 + (y-midPoint)^2 < midPoint^2) then
surface.create_entity({name="iron-ore", amount=START_IRON_AMOUNT,
position={ironOrePos.x+x, ironOrePos.y+y}})
end
end
end
end
function DoesPlayerHaveCustomSpawn(player)