1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2025-01-05 22:53:48 +02:00

Merge pull request #212 from Oarcinae/209-change-default-fluid-resource-spacing-from-4-to-6

Added a new spacing config for fluid resources and changed default to 6 from 4.
This commit is contained in:
Oarcinae 2024-10-23 21:22:24 -04:00 committed by GitHub
commit 15537d321a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 4 deletions

View File

@ -3,6 +3,9 @@ Version: 2.1.3
Date: ????
Minor Features:
- Add GPS ping for when player clicks on someone's location in the player list.
Changes:
- Change default spacing between fluid resource patches (like crude-oil) to be 6 instead of 4.
- Added config setting to control the spacing between fluid resource patches. (Not exposed in the GUI.)
---------------------------------------------------------------------------------------------------
Version: 2.1.2
Date: 2024-10-23

View File

@ -153,6 +153,7 @@ NAUVIS_SPAWN_CONFIG =
{
num_patches = 2,
amount = 900000,
spacing = 6, -- Spacing between each patch, only used for automatic placing.
-- These are only used if not using automatic placing.
-- Starting position offset (relative to bottom/south of spawn area)
@ -658,8 +659,20 @@ OCFG = {
---@field size_multiplier number Size multiplier for the starting resource deposits.
---@field amount_multiplier number Amount multiplier for the starting resource deposits.
---@alias OarcConfigSolidResource { amount: integer, size: integer, x_offset: integer, y_offset: integer } Amount and placement of solid resource tiles in the spawn area.
---@alias OarcConfigFluidResource { num_patches: integer, amount: integer, x_offset_start: integer, y_offset_start: integer, x_offset_next: integer, y_offset_next: integer } Amount and placement of fluid resource patches in the spawn area.
---@class OarcConfigSolidResource
---@field amount integer
---@field size integer
---@field x_offset integer
---@field y_offset integer
---@class OarcConfigFluidResource
---@field num_patches integer
---@field amount integer
---@field spacing integer
---@field x_offset_start integer
---@field y_offset_start integer
---@field x_offset_next integer
---@field y_offset_next integer
---@class OarcStoreItem
---@field cost integer

View File

@ -301,7 +301,7 @@ function GenerateStartingResources(surface, position)
elseif (storage.ocfg.spawn_general.shape == SPAWN_SHAPE_CHOICE_SQUARE) then
PlaceResourcesInSquare(surface, position, size_mod, amount_mod)
end
-- Generate resources using specified offsets if auto placement is disabled.
else
for r_name, r_data in pairs(storage.ocfg.surfaces_config[surface.name].spawn_config.solid_resources --[[@as table<string, OarcConfigSolidResource>]]) do
@ -315,11 +315,11 @@ function GenerateStartingResources(surface, position)
-- Reference position is the bottom of the spawn area.
if storage.ocfg.resource_placement.enabled then
local y_offset = storage.ocfg.resource_placement.distance_to_edge
local spacing = 4 -- HARDCODED FLUID PATCH SPACING SIZE!
local fluid_ref_pos = { x = position.x, y = position.y + storage.ocfg.spawn_general.spawn_radius_tiles - y_offset }
for r_name, r_data in pairs(storage.ocfg.surfaces_config[surface.name].spawn_config.fluid_resources --[[@as table<string, OarcConfigFluidResource>]]) do
local spacing = r_data.spacing
local oil_patch_x = fluid_ref_pos.x - (((r_data.num_patches-1) * spacing) / 2)
local oil_patch_y = fluid_ref_pos.y

View File

@ -0,0 +1,10 @@
--Adding the "spacing" setting for fluid resources config.
for surface_name, surface_config in pairs(storage.ocfg.surfaces_config) do
local fluid_resources = surface_config.spawn_config.fluid_resources
for fluid_name, resource in pairs(fluid_resources) do
if resource.spacing == nil then
resource.spacing = 6
log("Updating fluid resources [" .. fluid_name .. "] config with new 'spacing' setting.")
end
end
end