mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2024-12-12 10:13:58 +02:00
Allow disabling of resource randomization. Added gleba resource spawning to square style base gen.
This commit is contained in:
parent
3153eb2526
commit
46bd577c97
@ -7,7 +7,8 @@ Date: ????
|
||||
Bugfixes:
|
||||
- Fix incorrect names printed for infinite technology research.
|
||||
Minor Features:
|
||||
- Add a setting to clear decoratives in the spawn area. (Not enabled by default, not visible in the native mod settings.)
|
||||
- Add a non-mod setting to clear decoratives in the spawn area. (Not enabled by default, not visible in the native mod settings.)
|
||||
- Add a non-mod setting to allow toggling the the random ordering of resource placement within the spawn area.
|
||||
Info:
|
||||
- Add more info to the template scenario to help with understanding how to override settings.
|
||||
- Disable some of the extra debug logging.
|
||||
|
@ -359,6 +359,8 @@ OCFG = {
|
||||
-- Amount multiplier for the starting resource deposits.
|
||||
amount_multiplier = 1.0,
|
||||
|
||||
-- Randomize the order of resource placement.
|
||||
random_order = true,
|
||||
},
|
||||
|
||||
-- Spawn configuration specific to each surface, including starting & respawn items.
|
||||
@ -552,6 +554,7 @@ OCFG = {
|
||||
---@field linear_spacing number Spacing between resource deposits in tiles. Only applicable for square spawns.
|
||||
---@field size_multiplier number Size multiplier for the starting resource deposits.
|
||||
---@field amount_multiplier number Amount multiplier for the starting resource deposits.
|
||||
---@field random_order boolean Randomize the order of resource placement.
|
||||
|
||||
---@class OarcConfigSolidResource
|
||||
---@field amount integer
|
||||
|
@ -85,6 +85,7 @@ OCFG_KEYS =
|
||||
["gameplay.enable_player_self_reset"] = {mod_key = "" , ocfg_keys = {"gameplay", "enable_player_self_reset"}, type = "boolean", caption = {"oarc-player-self-reset-caption"}, tooltip = {"oarc-player-self-reset-tooltip"}},
|
||||
["gameplay.scale_spawner_damage"] = {mod_key = "" , ocfg_keys = {"gameplay", "scale_spawner_damage"}, type = "boolean", caption = {"oarc-scale-spawner-damage-caption"}, tooltip = {"oarc-scale-spawner-damage-tooltip"}},
|
||||
["spawn_general.remove_decoratives"] = {mod_key = "" , ocfg_keys = {"spawn_general", "remove_decoratives"}, type = "boolean", caption = {"oarc-remove-decoratives-caption"}, tooltip = {"oarc-remove-decoratives-tooltip"}},
|
||||
["resource_placement.random_order"] = {mod_key = "" , ocfg_keys = {"resource_placement", "random_order"}, type = "boolean", caption = {"oarc-resource-placement-random-order-caption"}, tooltip = {"oarc-resource-placement-random-order-tooltip"}},
|
||||
|
||||
}
|
||||
|
||||
|
@ -480,18 +480,17 @@ function GenerateStartingResources(surface, position)
|
||||
end
|
||||
end
|
||||
|
||||
---Places starting resource deposits in a semi-circle around the spawn point.
|
||||
---@param surface LuaSurface
|
||||
---@param position TilePosition --The center of the spawn area
|
||||
---@param size_mod number
|
||||
---@param amount_mod number
|
||||
---@return nil
|
||||
function PlaceResourcesInSemiCircle(surface, position, size_mod, amount_mod)
|
||||
---Get a list of resources from solid_resources and gleba_resources, will be randomly shuffled if
|
||||
---resource_placement.random_order is true.
|
||||
---@param surface_name string
|
||||
---@return table<string>
|
||||
function GetResourceList(surface_name)
|
||||
|
||||
-- Create list of resource tiles
|
||||
---@type table<string>
|
||||
local spawn_config = storage.ocfg.surfaces_config[surface_name].spawn_config
|
||||
|
||||
-- Create list of solid resource tiles
|
||||
local r_list = {}
|
||||
local solid_resources = storage.ocfg.surfaces_config[surface.name].spawn_config.solid_resources
|
||||
local solid_resources = spawn_config.solid_resources
|
||||
if solid_resources ~= nil then
|
||||
for r_name, _ in pairs(solid_resources) do
|
||||
if (r_name ~= "") then
|
||||
@ -500,8 +499,8 @@ function PlaceResourcesInSemiCircle(surface, position, size_mod, amount_mod)
|
||||
end
|
||||
end
|
||||
|
||||
-- Gleba style resources like plants
|
||||
local gleba_resources = storage.ocfg.surfaces_config[surface.name].spawn_config.gleba_resources
|
||||
-- Gleba style resources like plants that need to be placed on certain tiles
|
||||
local gleba_resources = spawn_config.gleba_resources
|
||||
if gleba_resources ~= nil then
|
||||
for g_name, _ in pairs(gleba_resources) do
|
||||
if (g_name ~= "") then
|
||||
@ -511,7 +510,24 @@ function PlaceResourcesInSemiCircle(surface, position, size_mod, amount_mod)
|
||||
end
|
||||
|
||||
---@type table<string>
|
||||
local shuffled_list = FYShuffle(r_list)
|
||||
local shuffled_list = r_list
|
||||
if storage.ocfg.resource_placement.random_order then
|
||||
shuffled_list = FYShuffle(r_list)
|
||||
end
|
||||
|
||||
return shuffled_list
|
||||
end
|
||||
|
||||
---Places starting resource deposits in a semi-circle around the spawn point.
|
||||
---@param surface LuaSurface
|
||||
---@param position TilePosition --The center of the spawn area
|
||||
---@param size_mod number
|
||||
---@param amount_mod number
|
||||
---@return nil
|
||||
function PlaceResourcesInSemiCircle(surface, position, size_mod, amount_mod)
|
||||
|
||||
---@type table<string>
|
||||
local shuffled_list = GetResourceList(surface.name)
|
||||
local num_resources = table_size(shuffled_list)
|
||||
|
||||
-- This places resources in a semi-circle
|
||||
@ -542,7 +558,6 @@ function PlaceResourcesInSemiCircle(surface, position, size_mod, amount_mod)
|
||||
local theta = ((angle_final_radians - angle_offset_radians) / (num_resources-1));
|
||||
local count = 0
|
||||
|
||||
|
||||
for _, r_name in pairs(shuffled_list) do
|
||||
local angle = (theta * count) + angle_offset_radians;
|
||||
|
||||
@ -571,16 +586,8 @@ end
|
||||
---@return nil
|
||||
function PlaceResourcesInSquare(surface, position, size_mod, amount_mod)
|
||||
|
||||
-- Create list of resource tiles
|
||||
---@type table<string>
|
||||
local r_list = {}
|
||||
for r_name, _ in pairs(storage.ocfg.surfaces_config[surface.name].spawn_config.solid_resources --[[@as table<string, OarcConfigSolidResource>]]) do
|
||||
if (r_name ~= "") then
|
||||
table.insert(r_list, r_name)
|
||||
end
|
||||
end
|
||||
---@type table<string>
|
||||
local shuffled_list = FYShuffle(r_list)
|
||||
local shuffled_list = GetResourceList(surface.name)
|
||||
|
||||
local spawn_general = storage.ocfg.spawn_general
|
||||
local spawn_config = storage.ocfg.surfaces_config[surface.name].spawn_config
|
||||
@ -624,7 +631,7 @@ function GenerateFinalSpawnPieces(delayed_spawn)
|
||||
-- Create the spawn resources here
|
||||
GenerateStartingResources(surface, delayed_spawn.position)
|
||||
|
||||
local radius = storage.ocfg.spawn_general.spawn_radius_tiles * spawn_config.radius_modifier
|
||||
local radius = ocfg.spawn_general.spawn_radius_tiles * spawn_config.radius_modifier
|
||||
|
||||
-- Reference position is RIGHT (WEST) of the spawn area.
|
||||
local sharing_ref_pos = {
|
||||
|
@ -393,6 +393,8 @@ oarc-scale-spawner-damage-caption=Scale Spawner Damage
|
||||
oarc-scale-spawner-damage-tooltip=Scales damage done to spawners with evolution factor and distance to closest spawn point. This helps compensate for spawner health scaling at a high evolution factor.
|
||||
oarc-remove-decoratives-caption=Remove Decoratives
|
||||
oarc-remove-decoratives-tooltip=Removes decoratives in the spawn area to make it look nice and clean.
|
||||
oarc-resource-placement-random-order-caption=Random Resource Placement Order
|
||||
oarc-resource-placement-random-order-tooltip=Randomizes the order in which resources are placed in the spawn area. Provides some minor variety in the starting area.
|
||||
|
||||
oarc-teams-both-disabled-msg=Invalid setting! Both main force and separate teams are disabled! Enabling main force.
|
||||
oarc-spawn-distance-invalid-msg=Invalid setting! Near spawn min distance is greater than or equal to near spawn max distance!
|
||||
|
Loading…
Reference in New Issue
Block a user