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

Exposed more of the resource placement as mod settings. Changed default positioning to be relative to spawn radius instead of spawn center. Move more of spawn config to be in general settings, not surface specific.

This commit is contained in:
Oarcinae 2024-09-23 22:48:08 -04:00
parent 8e3be1915a
commit d133179a74
12 changed files with 549 additions and 188 deletions

View File

@ -1,6 +1,19 @@
---------------------------------------------------------------------------------------------------
Version: 2.0.0
Date: 21. 10. 2024
Date: 2024-09-23
Major Features:
- Initial release of a proper mod version. This is essentially a rewrite of the original scenario in mod form.
- Coin shop, energy and item sharing are all removed for now until I get time to re-implement or turn them into separate mods.
- Initial release of a formal mod (non-scenario) version. This is essentially a rewrite of the original scenario in mod form.
- Added support for spawning on different surfaces in preparation for space age support.
- Updated all GUIs to be more in line with style recommendations and to be more user friendly.
- New preview GUI while spawn is being generated and instant transition to the new spawn when ready.
- Exposed most of the mod settings in the custom in game mod GUI. This provides a nicer interface than the native mod settings allows.
Bugfixes:
- Fixed an issue where active radars would block spawn areas from being cleaned up if a player left within the removal window.
- Fixed an issue where regrowth would sometimes delete chunks with vehicles, robots or spidertron in them.
- Added several mods as hidden dependencies to avoid fatal errors on startup due to incompatible load order issues.
Optimizations:
- New implementation of shared electricity should stop any possibility of desync with the old method as well as improve performance. (Uses cross-surface power connections.)
- New implementation of shared items should also improve performance. (Uses linked-chest.)
Info:
- Several of the soft-mod features have been removed (including the coin shop).
- Space age support will not be available until some time after it is released. I will need time to test and implement it. For now, this is provided as a feature for experimentation.

View File

@ -282,6 +282,7 @@ script.on_event(defines.events.on_gui_selection_state_changed, function(event)
if not event.element.valid then return end -- Should we ever react to invalid GUI elements?
SeparateSpawnsGuiSelectionStateChanged(event)
SettingsControlsTabGuiSelectionStateChanged(event)
end)
script.on_event(defines.events.on_gui_text_changed, function(event)

View File

@ -10,10 +10,8 @@ Not specific:
Minor:
- Add refresh chunks around spidertrons based on their vision
- If dead when resetting spawn... possibly delay the opening of the welcome GUI or block spawning until character is spawned?
- Pull out general spawn config from surfaces config
- Expose old enemy scaling as an option? And/or remove unnecessary checks/logs
- Refresh players in admin controls when dropdown is clicked
- Default to selecting SELF in admin controls player dropdown?
- Add a setting for forcing primary spawns to only be on default surface maybe?
Performance:
@ -137,4 +135,7 @@ Other Ideas, Not Committed:
- Test and make sure scenario settings overrides get written back to mod settings to avoid any out of sync settings.
- Test teleporting to other surfaces
- Test on_player_changed_surface
- Run the profiler
- Run the profiler
- Pull out general spawn config from surfaces config
- Redo resource placement to be simpler (and make a linear layout for square base)
- Default to selecting SELF in admin controls player dropdown?

View File

@ -12,12 +12,14 @@
-- Additionally, many settings are exposed in the game itself and can be chanced once you launch.
-- For convenience you can provide you own config-scenario.lua file in the scenarios/OARC folder to override these settings.
---@enum SpawnShapeChoice
SPAWN_SHAPE_CHOICE = {
circle = 1,
octagon = 2,
square = 3,
}
---@alias SpawnShapeChoice "circle" | "octagon" | "square"
SPAWN_SHAPE_CHOICE_CIRCLE = "circle"
SPAWN_SHAPE_CHOICE_OCTAGON = "octagon"
SPAWN_SHAPE_CHOICE_SQUARE = "square"
---@alias SpawnResourcesShapeChoice "circle" | "square"
RESOURCES_SHAPE_CHOICE_CIRCLE = "circle"
RESOURCES_SHAPE_CHOICE_SQUARE = "square"
---@type OarcConfigStartingItems
NAUVIS_STARTER_ITEMS =
@ -51,32 +53,6 @@ NAUVIS_STARTER_ITEMS =
---@type OarcConfigSpawn
NAUVIS_SPAWN_CONFIG =
{
general = {
-- Create a circle of land area for the spawn
-- If you make this much bigger than a few chunks, good luck!
-- (It takes a long time to generate new chunks!)
spawn_radius_tiles = CHUNK_SIZE*2,
-- Width of the moat around the spawn area.
-- If you change the spawn area size, you might have to adjust this as well.
moat_width_tiles = 8,
-- Width of the tree ring around the spawn area.
-- If you change the spawn area size, you might have to adjust this as well.
tree_width_tiles = 5,
-- Start resource shape. true = circle, false = square.
resources_circle_shape = true,
-- Force the land area circle at the spawn to be fully grass, otherwise it defaults to the existing terrain
-- or uses landfill.
force_grass = false,
-- Spawn a circle/octagon/square of trees around this base outline.
shape = SPAWN_SHAPE_CHOICE.circle,
},
-- Safe Spawn Area Options
-- The default settings here are balanced for my recommended map gen settings (close to train world).
safe_area =
@ -100,67 +76,53 @@ NAUVIS_SPAWN_CONFIG =
danger_reduction = 5,
},
-- Location of water strip within the spawn area (horizontal)
-- Location of water strip within the spawn area (2 horizontal rows)
-- The offset is from the TOP (NORTH) of the spawn area.
water = {
x_offset = -4,
y_offset = -48,
y_offset = 10,
length = 8,
},
-- Location of shared power pole relative to spawn center (if enabled)
-- Location of shared power pole within the spawn area (if enabled)
-- The offset is from the RIGHT (WEST) of the spawn area.
shared_power_pole_position = {
x_offset=-4,
y_offset=-54
x_offset=-10,
y_offset=0
},
-- Location of shared chest relative to spawn center (if enabled)
-- Location of shared chest within the spawn area (if enabled)
-- The offset is from the RIGHT (WEST) of the spawn area.
shared_chest_position = {
x_offset=4,
y_offset=-54
},
-- Handle placement of starting resources
resource_rand_pos_settings =
{
-- Autoplace resources (randomly in circle)
-- This will ignore the fixed x_offset/y_offset values in solid_resources.
-- Only works for solid_resources at the moment, not oil patches/water.
enabled = true,
-- Distance from center of spawn that resources are placed.
radius = 45,
-- At what angle (in radians) do resources start.
-- 0 means starts directly east.
-- Resources are placed clockwise from there.
angle_offset = 2.32, -- 2.32 is approx SSW.
-- At what andle do we place the last resource.
-- angle_offset and angle_final determine spacing and placement.
angle_final = 4.46 -- 4.46 is approx NNW.
x_offset=-10,
y_offset=1
},
-- Solid resource tiles
-- If you are running with mods that add or change resources, you'll want to customize this.
-- Offsets only are applicable if auto placement is disabled. Offsets are from CENTER of spawn area.
solid_resources = {
["iron-ore"] = {
amount = 1500,
size = 18,
size = 21,
x_offset = -29,
y_offset = 16
},
["copper-ore"] = {
amount = 1200,
size = 18,
size = 21,
x_offset = -28,
y_offset = -3
},
["stone"] = {
amount = 1200,
size = 16,
size = 21,
x_offset = -27,
y_offset = -34
},
["coal"] = {
amount = 1200,
size = 16,
size = 21,
x_offset = -27,
y_offset = -20
}
@ -168,14 +130,17 @@ NAUVIS_SPAWN_CONFIG =
-- Fluid resource patches like oil
-- If you are running with mods that add or change resources, you'll want to customize this.
-- The offset is from the BOTTOM (SOUTH) of the spawn area.
fluid_resources =
{
["crude-oil"] =
{
num_patches = 2,
amount = 900000,
-- Starting position offset (relative to bottom/south of spawn area)
x_offset_start = -3,
y_offset_start = 48,
y_offset_start = -10,
-- Additional position offsets for each new oil patch (relative to previous oil patch)
x_offset_next = 6,
y_offset_next = 0
}
@ -320,9 +285,76 @@ OCFG = {
cleanup_interval = 60,
},
-- Spawn configuration (starting items and spawn area config) for each surface.
-- General spawn settings (size, shape, etc.)
spawn_general = {
-- Create a circle of land area for the spawn
-- If you make this much bigger than a few chunks, good luck!
-- (It takes a long time to generate new chunks!)
spawn_radius_tiles = CHUNK_SIZE*2,
-- Width of the moat around the spawn area.
-- If you change the spawn area size, you might have to adjust this as well.
moat_width_tiles = 8,
-- Width of the tree ring around the spawn area.
-- If you change the spawn area size, you might have to adjust this as well.
tree_width_tiles = 5,
-- Starting resources deposits shape.
resources_shape = RESOURCES_SHAPE_CHOICE_CIRCLE,
-- Force the land area circle at the spawn to be fully grass, otherwise it defaults to the existing terrain
-- or uses landfill.
force_grass = false,
-- Spawn a circle/octagon/square of trees around this base outline.
shape = SPAWN_SHAPE_CHOICE_CIRCLE,
},
-- Handle placement of starting resources within the spawn area.
resource_placement =
{
-- Autoplace resources (randomly in circle)
-- This will ignore the fixed x_offset/y_offset values in solid_resources.
-- Only works for solid_resources at the moment, not oil patches/water.
enabled = true,
-- Distance in tiles from the edge of spawn that resources are placed. Only applicable for circular spawns.
distance_to_edge = 20,
-- At what angle (in radians) do resources start.
-- 0 means starts directly east.
-- Resources are placed clockwise from there.
angle_offset = 2.32, -- 2.32 is approx SSW.
-- At what andle do we place the last resource.
-- angle_offset and angle_final determine spacing and placement.
angle_final = 4.46, -- 4.46 is approx NNW.
-- Vertical offset in tiles for the deposit resource placement. Starting from top-left corner.
-- Only applicable for square spawns.
vertical_offset = 20,
-- Horizontal offset in tiles for the deposit resource placement. Starting from top-left corner.
-- Only applicable for square spawns.
horizontal_offset = 20,
-- Spacing between resource deposits in tiles.
-- Only applicable for square spawns.
linear_spacing = 6,
-- Size multiplier for the starting resource deposits.
size_multiplier = 1.0,
-- Amount multiplier for the starting resource deposits.
amount_multiplier = 1.0,
},
-- Spawn configuration specific to each surface, including starting & respawn items.
---@type table<string, OarcConfigSurface>
surfaces_config =
surfaces_config =
{
["nauvis"] = {
starting_items = NAUVIS_STARTER_ITEMS,
@ -381,6 +413,8 @@ OCFG = {
---@field server_info OarcConfigServerInfo Personalized server info for the welcome GUI and Info panel.
---@field gameplay OarcConfigGameplaySettings Various mod gameplay settings
---@field regrowth OarcConfigRegrowth Regrowth specific settings (keeps map size down)
---@field spawn_general OarcConfigSpawnGeneral General spawn settings (size, shape, etc.)
---@field resource_placement OarcConfigSpawnResourcePlacementSettings Resource placement settings
---@field surfaces_config table<string, OarcConfigSurface> Spawn configuration (starting items and spawn area config) for each surface.
---@field surfaces_blacklist table<string> List of surfaces to ignore automatically.
---@field surfaces_blacklist_match table<string> List of surfaces to ignore automatically if the start of the string matches the surface name.
@ -436,12 +470,10 @@ OCFG = {
---@field player_respawn_items table Items provided after EVERY respawn (disabled by default)
---@class OarcConfigSpawn
---@field general OarcConfigSpawnGeneral General spawn settings (size, shape, etc.)
---@field safe_area OarcConfigSpawnSafeArea How safe is the spawn area?
---@field water OarcConfigSpawnWater Water strip settings
---@field shared_power_pole_position OarcOffsetPosition Location of shared power pole relative to spawn center (if enabled)
---@field shared_chest_position OarcOffsetPosition Location of shared chest relative to spawn center (if enabled)
---@field resource_rand_pos_settings OarcConfigSpawnResourceRandPosSettings Resource placement settings
---@field solid_resources table<string, OarcConfigSolidResource> Spawn area config for solid resource tiles
---@field fluid_resources table<string, OarcConfigFluidResource> Spawn area config for fluid resource patches (like oil)
@ -449,7 +481,7 @@ OCFG = {
---@field spawn_radius_tiles number THIS IS WHAT SETS THE SPAWN CIRCLE SIZE! Create a circle of land area for the spawn If you make this much bigger than a few chunks, good luck.
---@field moat_width_tiles number Width of the moat around the spawn area. If you change the spawn area size, you might have to adjust this as well.
---@field tree_width_tiles number Width of the tree ring around the spawn area. If you change the spawn area size, you might have to adjust this as well.
---@field resources_circle_shape boolean Start resource shape. true = circle, false = square.
---@field resources_shape SpawnResourcesShapeChoice The starting resources deposits shape.
---@field force_grass boolean Force the land area circle at the spawn to be fully grass, otherwise it defaults to the existing terrain.
---@field shape SpawnShapeChoice Spawn a circle/octagon/square of trees around this base outline.
@ -467,11 +499,16 @@ OCFG = {
---@alias OarcOffsetPosition { x_offset: number, y_offset: number } An offset position intended to be relative to the spawn center.
---@class OarcConfigSpawnResourceRandPosSettings
---@field enabled boolean Autoplace resources (randomly in circle) This will ignore the fixed x_offset/y_offset values in solid_resources. Only works for solid_resources at the moment, not oil patches/water.
---@field radius number Distance from center of spawn that resources are placed.
---@field angle_offset number At what angle (in radians) do resources start. 0 means starts directly east. Resources are placed clockwise from there.
---@field angle_final number At what andle do we place the last resource. angle_offset and angle_final determine spacing and placement.
---@class OarcConfigSpawnResourcePlacementSettings
---@field enabled boolean Autoplace resources. This will ignore the fixed x_offset/y_offset values in solid_resources. Only works for solid_resources at the moment, not oil patches/water.
---@field distance_to_edge number Distance in tiles from the edge of spawn that resources are placed. Only applicable for circular spawns.
---@field angle_offset number At what angle (in radians) do resources start. 0 means starts directly east. Resources are placed clockwise from there. Only applicable for circular spawns.
---@field angle_final number At what andle do we place the last resource. angle_offset and angle_final determine spacing and placement. Only applicable for circular spawns.
---@field vertical_offset number Vertical offset in tiles for the deposit resource placement. Only applicable for square spawns.
---@field horizontal_offset number Horizontal offset in tiles for the deposit resource placement. Only applicable for square spawns.
---@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.
---@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.

View File

@ -1,4 +1,5 @@
-- This file is used to validate the config.lua file and handle any mod settings conflicts.
-- DON'T JUDGE ME! I wanted to try and make a nice in game setting GUI since the native mod settings GUI is so limited.
---Provides a way to look up the config settings key from the mod settings key.
---@alias OarcSettingsLookup { mod_key: string, ocfg_keys: table<integer, string>, type: string }
@ -48,6 +49,25 @@ OCFG_KEYS =
["regrowth.enable_world_eater"] = {mod_key = "oarc-mod-enable-world-eater" , ocfg_keys = {"regrowth", "enable_world_eater"}, type = "boolean"},
["regrowth.enable_abandoned_base_cleanup"] = {mod_key = "oarc-mod-enable-abandoned-base-cleanup" , ocfg_keys = {"regrowth", "enable_abandoned_base_cleanup"}, type = "boolean"},
["regrowth.cleanup_interval"] = {mod_key = "oarc-mod-regrowth-cleanup-interval-min" , ocfg_keys = {"regrowth", "cleanup_interval"}, type = "integer"},
["General Spawn Area Config"] = {mod_key = "" , ocfg_keys = {""}, type = "header"},
["spawn_general.spawn_radius_tiles"] = {mod_key = "oarc-mod-spawn-general-radius-tiles" , ocfg_keys = {"spawn_general", "spawn_radius_tiles"}, type = "integer"},
["spawn_general.moat_width_tiles"] = {mod_key = "oarc-mod-spawn-general-moat-width-tiles" , ocfg_keys = {"spawn_general", "moat_width_tiles"}, type = "integer"},
["spawn_general.tree_width_tiles"] = {mod_key = "oarc-mod-spawn-general-tree-width-tiles" , ocfg_keys = {"spawn_general", "tree_width_tiles"}, type = "integer"},
["spawn_general.resources_shape"] = {mod_key = "oarc-mod-spawn-general-enable-resources-circle-shape" , ocfg_keys = {"spawn_general", "resources_shape"}, type = "string-list"},
["spawn_general.force_grass"] = {mod_key = "oarc-mod-spawn-general-enable-force-grass" , ocfg_keys = {"spawn_general", "force_grass"}, type = "boolean"},
["spawn_general.shape"] = {mod_key = "oarc-mod-spawn-general-shape" , ocfg_keys = {"spawn_general", "shape"}, type = "string-list"},
["Starting Resources Placement"] = {mod_key = "" , ocfg_keys = {""}, type = "header"},
["resource_placement.enabled"] = {mod_key = "oarc-mod-resource-placement-enabled" , ocfg_keys = {"resource_placement", "enabled"}, type = "boolean"},
["resource_placement.distance_to_edge"] = {mod_key = "oarc-mod-resource-placement-distance-to-edge" , ocfg_keys = {"resource_placement", "distance_to_edge"}, type = "integer"},
["resource_placement.angle_offset"] = {mod_key = "oarc-mod-resource-placement-angle-offset" , ocfg_keys = {"resource_placement", "angle_offset"}, type = "double"},
["resource_placement.angle_final"] = {mod_key = "oarc-mod-resource-placement-angle-final" , ocfg_keys = {"resource_placement", "angle_final"}, type = "double"},
["resource_placement.vertical_offset"] = {mod_key = "oarc-mod-resource-placement-vertical-offset" , ocfg_keys = {"resource_placement", "vertical_offset"}, type = "integer"},
["resource_placement.horizontal_offset"] = {mod_key = "oarc-mod-resource-placement-horizontal-offset" , ocfg_keys = {"resource_placement", "horizontal_offset"}, type = "integer"},
["resource_placement.linear_spacing"] = {mod_key = "oarc-mod-resource-placement-linear-spacing" , ocfg_keys = {"resource_placement", "linear_spacing"}, type = "integer"},
["resource_placement.size_multiplier"] = {mod_key = "oarc-mod-resource-placement-size-multiplier" , ocfg_keys = {"resource_placement", "size_multiplier"}, type = "double"},
["resource_placement.amount_multiplier"] = {mod_key = "oarc-mod-resource-placement-amount-multiplier" , ocfg_keys = {"resource_placement", "amount_multiplier"}, type = "double"}
}
---Easy reverse lookup for mod settings keys.
@ -93,6 +113,23 @@ OCFG_MOD_KEYS =
["oarc-mod-enable-world-eater"] = "regrowth.enable_world_eater",
["oarc-mod-enable-abandoned-base-cleanup"] = "regrowth.enable_abandoned_base_cleanup",
["oarc-mod-regrowth-cleanup-interval-min"] = "regrowth.cleanup_interval",
["oarc-mod-spawn-general-radius-tiles"] = "spawn_general.spawn_radius_tiles",
["oarc-mod-spawn-general-moat-width-tiles"] = "spawn_general.moat_width_tiles",
["oarc-mod-spawn-general-tree-width-tiles"] = "spawn_general.tree_width_tiles",
["oarc-mod-spawn-general-enable-resources-circle-shape"] = "spawn_general.resources_shape",
["oarc-mod-spawn-general-enable-force-grass"] = "spawn_general.force_grass",
["oarc-mod-spawn-general-shape"] = "spawn_general.shape",
["oarc-mod-resource-placement-enabled"] = "resource_placement.enabled",
["oarc-mod-resource-placement-distance-to-edge"] = "resource_placement.distance_to_edge",
["oarc-mod-resource-placement-angle-offset"] = "resource_placement.angle_offset",
["oarc-mod-resource-placement-angle-final"] = "resource_placement.angle_final",
["oarc-mod-resource-placement-vertical-offset"] = "resource_placement.vertical_offset",
["oarc-mod-resource-placement-horizontal-offset"] = "resource_placement.horizontal_offset",
["oarc-mod-resource-placement-linear-spacing"] = "resource_placement.linear_spacing",
["oarc-mod-resource-placement-size-multiplier"] = "resource_placement.size_multiplier",
["oarc-mod-resource-placement-amount-multiplier"] = "resource_placement.amount_multiplier"
}

View File

@ -53,13 +53,18 @@ function CreateServerInfoTab(tab_container, player)
horizontal_flow.style.horizontally_stretchable = true
AddLabel(horizontal_flow, nil, {"oarc-server-info-ban-select-player"}, my_label_style)
horizontal_flow.add{
local drop_down = horizontal_flow.add{
name = "ban_players_dropdown",
tags = { action = "oarc_server_info_tab", setting = "ban_players_dropdown" },
type = "drop-down",
items = player_list
}
-- If there is only one player, select it by default (for testing convenience)
if (#player_list == 1) then
drop_down.selected_index = 1
end
local dragger = horizontal_flow.add{
type="empty-widget",
style="draggable_space_header"

View File

@ -58,6 +58,8 @@ function CreateModSettingsSection(container, player)
AddIntegerSetting(container, index, entry, player.admin)
elseif (entry.type == "double") then
AddDoubleSetting(container, index, entry, player.admin)
elseif (entry.type == "string-list") then
AddStringListDropdownSetting(container, index, entry, player.admin)
end
end
end
@ -380,8 +382,9 @@ function AddDoubleSetting(tab_container, index, entry, enabled)
name = "textfield",
type = "textfield",
numeric = true,
allow_decimal = true,
caption = { "mod-setting-name."..entry.mod_key },
text = GetGlobalOarcConfigUsingKeyTable(entry.ocfg_keys),
text = string.format("%.2f", GetGlobalOarcConfigUsingKeyTable(entry.ocfg_keys)),
enabled = enabled,
tooltip = tooltip,
tags = { action = "oarc_settings_tab", setting = index },
@ -389,6 +392,47 @@ function AddDoubleSetting(tab_container, index, entry, enabled)
textfield.style.width = 50
end
---Create a dropdown setting for a string setting with allowed_values set
---@param tab_container LuaGuiElement
---@param index string
---@param entry OarcSettingsLookup
---@param enabled boolean
---@return nil
function AddStringListDropdownSetting(tab_container, index, entry, enabled)
local horizontal_flow = tab_container.add {
type = "flow",
direction = "horizontal",
}
horizontal_flow.add {
type = "label",
caption = { "mod-setting-name."..entry.mod_key },
tooltip = { "mod-setting-description."..entry.mod_key },
}
local dragger = horizontal_flow.add {
type = "empty-widget",
}
dragger.style.horizontally_stretchable = true
local allowed_values = game.mod_setting_prototypes[entry.mod_key].allowed_values --[[@as string[] ]]
local selected_index = 1
for i,v in pairs(allowed_values) do
if (v == GetGlobalOarcConfigUsingKeyTable(entry.ocfg_keys)) then
selected_index = i
break
end
end
local dropdown = horizontal_flow.add {
type = "drop-down",
items = allowed_values,
selected_index = selected_index,
enabled = enabled,
tooltip = { "mod-setting-description."..entry.mod_key },
tags = { action = "oarc_settings_tab", setting = index },
}
end
---Creates a checkbox setting for surface related settings.
---@param parent LuaGuiElement
---@param surface_name string
@ -439,4 +483,21 @@ function SettingsSurfaceControlsTabGuiClick(event)
end
end
end
end
---Handles dropdown selection events
---@param event EventData.on_gui_selection_state_changed
---@return nil
function SettingsControlsTabGuiSelectionStateChanged(event)
if not (event.element.valid) then return end
local gui_elem = event.element
if (gui_elem.tags.action ~= "oarc_settings_tab") then return end
local index = gui_elem.tags.setting
local entry = OCFG_KEYS[index]
if (entry.type == "string-list") then
settings.global[entry.mod_key] = { value = gui_elem.items[gui_elem.selected_index] }
end
end

View File

@ -1320,10 +1320,10 @@ end
function CreateCropCircle(surface, centerPos, chunkArea, tileRadius, fillTile, moat, bridge)
local tile_radius_sqr = tileRadius ^ 2
local moat_width = global.ocfg.surfaces_config[surface.name].spawn_config.general.moat_width_tiles
local moat_width = global.ocfg.spawn_general.moat_width_tiles
local moat_radius_sqr = ((tileRadius + moat_width)^2)
local tree_width = global.ocfg.surfaces_config[surface.name].spawn_config.general.tree_width_tiles
local tree_width = global.ocfg.spawn_general.tree_width_tiles
local tree_radius_sqr_inner = ((tileRadius - 1 - tree_width) ^ 2) -- 1 less to make sure trees are inside the spawn area
local tree_radius_sqr_outer = ((tileRadius - 1) ^ 2)
@ -1338,7 +1338,7 @@ function CreateCropCircle(surface, centerPos, chunkArea, tileRadius, fillTile, m
-- Fill in all unexpected water (or force grass)
if (distSqr <= tile_radius_sqr) then
if (surface.get_tile(i, j).collides_with("water-tile") or
global.ocfg.surfaces_config[surface.name].spawn_config.general.force_grass) then
global.ocfg.spawn_general.force_grass) then
table.insert(dirtTiles, { name = fillTile, position = { i, j } })
end
end
@ -1373,11 +1373,11 @@ end
---@param bridge boolean
---@return nil
function CreateCropOctagon(surface, centerPos, chunkArea, tileRadius, fillTile, moat, bridge)
local moat_width = global.ocfg.surfaces_config[surface.name].spawn_config.general.moat_width_tiles
local moat_width = global.ocfg.spawn_general.moat_width_tiles
local moat_width_outer = tileRadius + moat_width
local tree_width = global.ocfg.surfaces_config[surface.name].spawn_config.general.tree_width_tiles
local tree_width = global.ocfg.spawn_general.tree_width_tiles
local tree_distance_inner = tileRadius - tree_width
local dirtTiles = {}
@ -1391,7 +1391,7 @@ function CreateCropOctagon(surface, centerPos, chunkArea, tileRadius, fillTile,
-- Fill in all unexpected water (or force grass)
if (distVar <= tileRadius) then
if (surface.get_tile(i, j).collides_with("water-tile") or
global.ocfg.surfaces_config[surface.name].spawn_config.general.force_grass) then
global.ocfg.spawn_general.force_grass) then
table.insert(dirtTiles, { name = fillTile, position = { i, j } })
end
end
@ -1426,10 +1426,10 @@ end
---@return nil
function CreateCropSquare(surface, centerPos, chunkArea, tileRadius, fillTile, moat, bridge)
local moat_width = global.ocfg.surfaces_config[surface.name].spawn_config.general.moat_width_tiles
local moat_width = global.ocfg.spawn_general.moat_width_tiles
local moat_width_outer = tileRadius + moat_width
local tree_width = global.ocfg.surfaces_config[surface.name].spawn_config.general.tree_width_tiles
local tree_width = global.ocfg.spawn_general.tree_width_tiles
local tree_distance_inner = tileRadius - tree_width
local dirtTiles = {}
@ -1442,7 +1442,7 @@ function CreateCropSquare(surface, centerPos, chunkArea, tileRadius, fillTile, m
-- Fill in all unexpected water (or force grass)
if (max_distance <= tileRadius) then
if (surface.get_tile(i, j).collides_with("water-tile") or
global.ocfg.surfaces_config[surface.name].spawn_config.general.force_grass) then
global.ocfg.spawn_general.force_grass) then
table.insert(dirtTiles, { name = fillTile, position = { i, j } })
end
end
@ -1491,7 +1491,7 @@ function CreateMoat(surface, centerPos, chunkArea, tileRadius, moatTile, bridge,
local distVar = math.floor((centerPos.x - i) ^ 2 + (centerPos.y - j) ^ 2)
-- Create a circle of water
if ((distVar < tileRadSqr + (1500 * global.ocfg.surfaces_config[surface.name].spawn_config.general.moat_width_tiles)) and
if ((distVar < tileRadSqr + (1500 * global.ocfg.spawn_general.moat_width_tiles)) and
(distVar > tileRadSqr)) then
table.insert(tiles, { name = moatTile, position = { i, j } })
end
@ -1525,9 +1525,15 @@ function GenerateResourcePatch(surface, resourceName, diameter, position, amount
if (diameter == 0) then
return
end
-- Right now only 2 shapes are supported. Circle and Square.
local square_shape = (global.ocfg.spawn_general.resources_shape == RESOURCES_SHAPE_CHOICE_SQUARE)
for y = -midPoint, midPoint do
for x = -midPoint, midPoint do
if (not global.ocfg.surfaces_config[surface.name].spawn_config.general.resources_circle_shape or ((x) ^ 2 + (y) ^ 2 < midPoint ^ 2)) then
-- Either it's a square, or it's a circle so we check if it's inside the circle.
if (square_shape or ((x) ^ 2 + (y) ^ 2 < midPoint ^ 2)) then
surface.create_entity({
name = resourceName,
amount = amount,

View File

@ -264,55 +264,37 @@ end
-- Generate the basic starter resource around a given location.
---@param surface LuaSurface
---@param position TilePosition
---@param position TilePosition --The center of the spawn area
---@return nil
function GenerateStartingResources(surface, position)
local rand_settings = global.ocfg.surfaces_config[surface.name].spawn_config.resource_rand_pos_settings
local size_mod = global.ocfg.resource_placement.size_multiplier
local amount_mod = global.ocfg.resource_placement.amount_multiplier
-- Generate all resource tile patches
if (not rand_settings.enabled) then
if (not global.ocfg.resource_placement.enabled) then
for r_name, r_data in pairs(global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources --[[@as table<string, OarcConfigSolidResource>]]) do
local pos = { x = position.x + r_data.x_offset, y = position.y + r_data.y_offset }
GenerateResourcePatch(surface, r_name, r_data.size, pos, r_data.amount)
GenerateResourcePatch(surface, r_name, r_data.size * size_mod, pos, r_data.amount * amount_mod)
end
-- Generate resources in random order around the spawn point. Tweak in config.lua
else
-- Create list of resource tiles
---@type table<string>
local r_list = {}
for r_name, _ in pairs(global.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)
-- This places resources in a semi-circle
local angle_offset = rand_settings.angle_offset
local num_resources = table_size(global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources)
local theta = ((rand_settings.angle_final - rand_settings.angle_offset) / num_resources);
local count = 0
for _, r_name in pairs(shuffled_list) do
local angle = (theta * count) + angle_offset;
local tx = (rand_settings.radius * math.cos(angle)) + position.x
local ty = (rand_settings.radius * math.sin(angle)) + position.y
local pos = { x = math.floor(tx), y = math.floor(ty) }
local resourceConfig = global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources[r_name]
GenerateResourcePatch(surface, r_name, resourceConfig.size, pos, resourceConfig.amount)
count = count + 1
if (global.ocfg.spawn_general.shape == SPAWN_SHAPE_CHOICE_CIRCLE) or (global.ocfg.spawn_general.shape == SPAWN_SHAPE_CHOICE_OCTAGON) then
PlaceResourcesInSemiCircle(surface, position)
elseif (global.ocfg.spawn_general.shape == SPAWN_SHAPE_CHOICE_SQUARE) then
PlaceResourcesInSquare(surface, position)
end
end
-- Generate special fluid resource patches (oil)
-- Reference position is the bottom of the spawn area.
local fluid_ref_pos = { x = position.x,
y = position.y + global.ocfg.spawn_general.spawn_radius_tiles }
for r_name, r_data in pairs(global.ocfg.surfaces_config[surface.name].spawn_config.fluid_resources --[[@as table<string, OarcConfigFluidResource>]]) do
local oil_patch_x = position.x + r_data.x_offset_start
local oil_patch_y = position.y + r_data.y_offset_start
local oil_patch_x = fluid_ref_pos.x + r_data.x_offset_start
local oil_patch_y = fluid_ref_pos.y + r_data.y_offset_start
for i = 1, r_data.num_patches do
surface.create_entity({
name = r_name,
@ -325,6 +307,83 @@ 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
function PlaceResourcesInSemiCircle(surface, position)
local size_mod = global.ocfg.resource_placement.size_multiplier
local amount_mod = global.ocfg.resource_placement.amount_multiplier
-- Create list of resource tiles
---@type table<string>
local r_list = {}
for r_name, _ in pairs(global.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)
-- This places resources in a semi-circle
local angle_offset = global.ocfg.resource_placement.angle_offset
local num_resources = table_size(global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources)
local theta = ((global.ocfg.resource_placement.angle_final - global.ocfg.resource_placement.angle_offset) / num_resources);
local count = 0
local radius = global.ocfg.spawn_general.spawn_radius_tiles - global.ocfg.resource_placement.distance_to_edge
for _, r_name in pairs(shuffled_list) do
local angle = (theta * count) + angle_offset;
local tx = (radius * math.cos(angle)) + position.x
local ty = (radius * math.sin(angle)) + position.y
local pos = { x = math.floor(tx), y = math.floor(ty) }
local resourceConfig = global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources[r_name]
GenerateResourcePatch(surface, r_name, resourceConfig.size * size_mod, pos, resourceConfig.amount * amount_mod)
count = count + 1
end
end
---Places starting resource deposits in a line starting at the top left of the spawn point.
---@param surface LuaSurface
---@param position TilePosition --The center of the spawn area
function PlaceResourcesInSquare(surface, position)
local size_mod = global.ocfg.resource_placement.size_multiplier
local amount_mod = global.ocfg.resource_placement.amount_multiplier
-- Create list of resource tiles
---@type table<string>
local r_list = {}
for r_name, _ in pairs(global.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)
-- Get the top left position of the spawn area
local resource_position = { x = position.x - global.ocfg.spawn_general.spawn_radius_tiles,
y = position.y - global.ocfg.spawn_general.spawn_radius_tiles }
-- Offset the starting position
resource_position.x = resource_position.x + global.ocfg.resource_placement.horizontal_offset
resource_position.y = resource_position.y + global.ocfg.resource_placement.vertical_offset
-- Place vertically using linear spacing
for _, r_name in pairs(shuffled_list) do
local resourceConfig = global.ocfg.surfaces_config[surface.name].spawn_config.solid_resources[r_name]
local size = resourceConfig.size * size_mod
GenerateResourcePatch(surface, r_name, size, resource_position, resourceConfig.amount * amount_mod)
resource_position.y = resource_position.y + size + global.ocfg.resource_placement.linear_spacing
end
end
---Sends the player to their spawn point
---@param delayed_spawn OarcDelayedSpawn
---@return nil
@ -339,30 +398,41 @@ function SendPlayerToNewSpawnAndCreateIt(delayed_spawn)
-- Generate water strip only if we don't have a moat.
if (not delayed_spawn.moat) then
local water_data = spawn_config.water
-- Reference position is the top of the spawn area.
local reference_pos = {
x = delayed_spawn.position.x,
y = delayed_spawn.position.y - global.ocfg.spawn_general.spawn_radius_tiles
}
CreateWaterStrip(game.surfaces[delayed_spawn.surface],
{ x = delayed_spawn.position.x + water_data.x_offset, y = delayed_spawn.position.y + water_data.y_offset },
{ x = reference_pos.x + water_data.x_offset, y = reference_pos.y + water_data.y_offset },
water_data.length)
CreateWaterStrip(game.surfaces[delayed_spawn.surface],
{ x = delayed_spawn.position.x + water_data.x_offset, y = delayed_spawn.position.y + water_data.y_offset + 1 },
{ x = reference_pos.x + water_data.x_offset, y = reference_pos.y + water_data.y_offset + 1 },
water_data.length)
end
-- Create the spawn resources here
GenerateStartingResources(game.surfaces[delayed_spawn.surface], delayed_spawn.position)
-- Reference position is RIGHT (WEST) of the spawn area.
local sharing_ref_pos = {
x = delayed_spawn.position.x + global.ocfg.spawn_general.spawn_radius_tiles,
y = delayed_spawn.position.y
}
-- Create shared power poles
if (ocfg.gameplay.enable_shared_power) then
local power_pole_position = {
x = delayed_spawn.position.x + spawn_config.shared_power_pole_position.x_offset,
y = delayed_spawn.position.y + spawn_config.shared_power_pole_position.y_offset }
x = sharing_ref_pos.x + spawn_config.shared_power_pole_position.x_offset,
y = sharing_ref_pos.y + spawn_config.shared_power_pole_position.y_offset }
CreateSharedPowerPolePair(game.surfaces[delayed_spawn.surface], power_pole_position)
end
-- Create shared chest
if (ocfg.gameplay.enable_shared_chest) then
local chest_position = {
x = delayed_spawn.position.x + spawn_config.shared_chest_position.x_offset,
y = delayed_spawn.position.y + spawn_config.shared_chest_position.y_offset }
x = sharing_ref_pos.x + spawn_config.shared_chest_position.x_offset,
y = sharing_ref_pos.y + spawn_config.shared_chest_position.y_offset }
CreateSharedChest(game.surfaces[delayed_spawn.surface], chest_position)
end
@ -375,7 +445,7 @@ function SendPlayerToNewSpawnAndCreateIt(delayed_spawn)
DisplayWelcomeGroundTextAtSpawn(player, delayed_spawn.surface, delayed_spawn.position)
-- Chart the area.
ChartArea(player.force, delayed_spawn.position, math.ceil(spawn_config.general.spawn_radius_tiles / CHUNK_SIZE),
ChartArea(player.force, delayed_spawn.position, math.ceil(global.ocfg.spawn_general.spawn_radius_tiles / CHUNK_SIZE),
player.surface)
if (player.gui.screen.wait_for_spawn_dialog ~= nil) then
@ -450,7 +520,9 @@ function SetupAndClearSpawnAreas(surface, chunkArea)
local closest_spawn = GetClosestUniqueSpawn(surface.name, chunkArea.left_top)
if (closest_spawn == nil) then return end
local spawn_config --[[@as OarcConfigSpawn]] = global.ocfg.surfaces_config[surface.name].spawn_config
--[[@type OarcConfigSpawnGeneral]]
local general_spawn_config = global.ocfg.spawn_general
local chunkAreaCenter = {
x = chunkArea.left_top.x + (CHUNK_SIZE / 2),
y = chunkArea.left_top.y + (CHUNK_SIZE / 2)
@ -466,65 +538,56 @@ function SetupAndClearSpawnAreas(surface, chunkArea)
for _, spawn in pairs(spawns) do
-- If the chunk is within the main land area, then clear trees/resources and create the land spawn areas
-- (guaranteed land with a circle of trees)
local landArea = GetAreaAroundPos(spawn.position, spawn_config.general.spawn_radius_tiles + CHUNK_SIZE)
local landArea = GetAreaAroundPos(spawn.position, general_spawn_config.spawn_radius_tiles + CHUNK_SIZE)
if not CheckIfInArea(chunkAreaCenter, landArea) then
goto CONTINUE
end
-- Remove trees/resources inside the spawn area
if (spawn_config.general.shape == SPAWN_SHAPE_CHOICE.circle) or (spawn_config.general.shape == SPAWN_SHAPE_CHOICE.octagon) then
RemoveInCircle(surface, chunkArea, {"resource", "cliff", "tree"}, spawn.position, spawn_config.general.spawn_radius_tiles + 5)
elseif (spawn_config.general.shape == SPAWN_SHAPE_CHOICE.square) then
RemoveInSquare(surface, chunkArea, {"resource", "cliff", "tree"}, spawn.position, spawn_config.general.spawn_radius_tiles + 5)
if (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_CIRCLE) or (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_OCTAGON) then
RemoveInCircle(surface, chunkArea, {"resource", "cliff", "tree"}, spawn.position, general_spawn_config.spawn_radius_tiles + 5)
elseif (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_SQUARE) then
RemoveInSquare(surface, chunkArea, {"resource", "cliff", "tree"}, spawn.position, general_spawn_config.spawn_radius_tiles + 5)
end
-- Fill in the spawn area with landfill and create a circle of trees around it.
local fill_tile = "landfill"
if spawn_config.general.force_grass then
if general_spawn_config.force_grass then
fill_tile = "grass-1"
end
if (spawn_config.general.shape == SPAWN_SHAPE_CHOICE.circle) then
if (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_CIRCLE) then
CreateCropCircle(
surface,
spawn.position,
chunkArea,
spawn_config.general.spawn_radius_tiles,
general_spawn_config.spawn_radius_tiles,
fill_tile,
spawn.moat,
global.ocfg.gameplay.enable_moat_bridging
)
elseif (spawn_config.general.shape == SPAWN_SHAPE_CHOICE.octagon) then
elseif (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_OCTAGON) then
CreateCropOctagon(
surface,
spawn.position,
chunkArea,
spawn_config.general.spawn_radius_tiles,
general_spawn_config.spawn_radius_tiles,
fill_tile,
spawn.moat,
global.ocfg.gameplay.enable_moat_bridging
)
elseif (spawn_config.general.shape == SPAWN_SHAPE_CHOICE.square) then
elseif (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_SQUARE) then
CreateCropSquare(
surface,
spawn.position,
chunkArea,
spawn_config.general.spawn_radius_tiles,
general_spawn_config.spawn_radius_tiles,
fill_tile,
spawn.moat,
global.ocfg.gameplay.enable_moat_bridging
)
end
-- if (spawn.moat) then
-- CreateMoat(surface,
-- spawn.position,
-- chunkArea,
-- spawn_config.general.spawn_radius_tiles,
-- "water",
-- global.ocfg.gameplay.enable_moat_bridging)
-- end
:: CONTINUE ::
end
end
@ -708,8 +771,8 @@ function UniqueSpawnCleanupRemove(player_name)
if (primary_spawn == nil) then return end -- Safety
log("UniqueSpawnCleanupRemove - " .. player_name)
local total_spawn_width = global.ocfg.surfaces_config[primary_spawn.surface_name].spawn_config.general.spawn_radius_tiles +
global.ocfg.surfaces_config[primary_spawn.surface_name].spawn_config.general.moat_width_tiles
local total_spawn_width = global.ocfg.spawn_general.spawn_radius_tiles +
global.ocfg.spawn_general.moat_width_tiles
-- Check if it was near someone else's base. (Really just buddy base is possible I think?)
nearOtherSpawn = false
@ -1103,8 +1166,8 @@ function QueuePlayerForDelayedSpawn(player_name, surface, spawn_position, moat_e
InitUniqueSpawnGlobals(player_name, surface, spawn_position, moat_enabled, primary, buddy_name)
-- Add a 1 chunk buffer to be safe
local total_spawn_width = global.ocfg.surfaces_config[surface].spawn_config.general.spawn_radius_tiles +
global.ocfg.surfaces_config[surface].spawn_config.general.moat_width_tiles
local total_spawn_width = global.ocfg.spawn_general.spawn_radius_tiles +
global.ocfg.spawn_general.moat_width_tiles
local spawn_chunk_radius = math.ceil(total_spawn_width / CHUNK_SIZE) + 1
local delay_spawn_seconds = 5 * spawn_chunk_radius
@ -1130,7 +1193,7 @@ function QueuePlayerForDelayedSpawn(player_name, surface, spawn_position, moat_e
DisplayPleaseWaitForSpawnDialog(game.players[player_name], delay_spawn_seconds, game.surfaces[surface], spawn_position)
RegrowthMarkAreaSafeGivenTilePos(surface, spawn_position,
math.ceil(global.ocfg.surfaces_config[surface].spawn_config.general.spawn_radius_tiles / CHUNK_SIZE), true)
math.ceil(global.ocfg.spawn_general.spawn_radius_tiles / CHUNK_SIZE), true)
-- Chart the area to be able to display the minimap while the player waits.
ChartArea(game.players[player_name].force,

View File

@ -40,7 +40,7 @@ function CreateSharedPowerPolePair(surface, position)
TemporaryHelperText(
{ "oarc-shared-power-pole-helper-txt" },
surface,
{position.x, position.y+1},
{position.x, position.y},
TICKS_PER_MINUTE*2,
"right"
)
@ -96,9 +96,9 @@ function CreateSharedChest(surface, position)
TemporaryHelperText(
{ "oarc-shared-chest-helper-txt" },
surface,
{position.x, position.y+1},
{position.x, position.y},
TICKS_PER_MINUTE*2,
"left"
"right"
)
return chest

View File

@ -44,6 +44,22 @@ oarc-mod-enable-world-eater=World eater (map cleanup - additional)
oarc-mod-enable-abandoned-base-cleanup=Cleanup abandoned bases
oarc-mod-regrowth-cleanup-interval-min=Regrowth cleanup interval
oarc-mod-spawn-general-radius-tiles=Spawn area radius
oarc-mod-spawn-general-moat-width-tiles=Spawn moat width
oarc-mod-spawn-general-tree-width-tiles=Spawn tree ring width
oarc-mod-spawn-general-enable-resources-circle-shape=Spawn resource deposits shape
oarc-mod-spawn-general-enable-force-grass=Force spawn area grass
oarc-mod-spawn-general-shape=Spawn area shape
oarc-mod-resource-placement-enabled=Starting resource auto placement
oarc-mod-resource-placement-distance-to-edge=Starting resource distance to edge
oarc-mod-resource-placement-angle-offset=Starting resource angle offset
oarc-mod-resource-placement-angle-final=Starting resource angle final
oarc-mod-resource-placement-vertical-offset=Starting resource vertical offset
oarc-mod-resource-placement-horizontal-offset=Starting resource horizontal offset
oarc-mod-resource-placement-linear-spacing=Starting resource linear spacing
oarc-mod-resource-placement-size-multiplier=Starting resource size multiplier
oarc-mod-resource-placement-amount-multiplier=Starting resource amount multiplier
[mod-setting-description]
oarc-mod-default-allow-spawning-on-other-surfaces=This controls the default starting setting for whether to allow spawning on other surfaces. If enabled, by default all other surfaces will be available for players to spawn on. [color=red]If you have other mods installed that add additional surfaces, I recommend leaving this disabled. Regardless of this setting, you can configure which surfaces allow spawning using the in game settings menu.[/color]
@ -87,3 +103,20 @@ oarc-mod-enable-regrowth=Enables regrowth. This slowly removes inactive chunks o
oarc-mod-enable-world-eater=Enables world eater. This requires regrowth. This slowly checks all chunks for a lack of player structures and entities and marks them for removal. This helps to keep the map (and file size) smaller over time. This is more of an experimental feature, use at your own risk.
oarc-mod-enable-abandoned-base-cleanup=Abandoned bases will be cleaned up if players leave within a short time of joining. This does NOT require regrowth to be enabled.
oarc-mod-regrowth-cleanup-interval-min=This is the interval in minutes that the regrowth cleanup will run. Whenever a map cleanup happens, the game freezes for a second, so you don't want to run this too often! Abandoned base cleanup happens immediately when a player leaves and is not affected by this setting.
oarc-mod-spawn-general-radius-tiles=This is the radius of the spawn area in tiles. I would not make this much smaller then 2 chunks (64) and not too huge unless you want spawns to take a long time to generate.
oarc-mod-spawn-general-moat-width-tiles=This is the width of the moat around the spawn area in tiles, if a moat is enabled and selected at spawn time.
oarc-mod-spawn-general-tree-width-tiles=This is the width of the tree ring around the spawn area in tiles. It guarantees some trees near to spawn.
oarc-mod-spawn-general-enable-resources-circle-shape=This is the shape of the starting area resource deposits.
oarc-mod-spawn-general-enable-force-grass=Enabling this will make the entire spawn area pure grass. Disabling will use landfill as needed instead.
oarc-mod-spawn-general-shape=This is the shape of the spawn area.
oarc-mod-resource-placement-enabled=You should leave this enabled unless you are manually specifying resource placements in the custom scenario!
oarc-mod-resource-placement-distance-to-edge=This is the distance from the edge of the spawn area that resources will be placed. Only applicable for circle/octagon shaped spawns.
oarc-mod-resource-placement-angle-offset=This is the starting angle offset (in radians) for the resource placement. At what angle (in radians) do resources start. 0 = east. 3.14 = west. Resources are placed clockwise starting at this angle. Only applicable for circle/octagon shaped spawns.
oarc-mod-resource-placement-angle-final=This is the final angle offset (in radians) for the resource placement. At what angle (in radians) do resources end. 0 = east. 3.14 = west. Resources are placed clockwise ending at this angle. Only applicable for circle/octagon shaped spawns.
oarc-mod-resource-placement-vertical-offset=This is the vertical offset (in tiles) for the resource placement from the top-left of the spawn. Only applicable for square shaped spawns.
oarc-mod-resource-placement-horizontal-offset=This is the horizontal offset (in tiles) for the resource placement from the top-left of the spawn. Only applicable for square shaped spawns.
oarc-mod-resource-placement-linear-spacing=This is the linear spacing (in tiles) between resources. Only applicable for square shaped spawns.
oarc-mod-resource-placement-size-multiplier=This changes the size of the resource deposits. Default settings should provide close to a vanilla starting experience.
oarc-mod-resource-placement-amount-multiplier=This changes the richness of the resource deposits. Default settings should provide close to a vanilla starting experience.

View File

@ -270,30 +270,134 @@ data:extend({
order = "g4"
},
{
type = "int-setting",
name = "oarc-mod-spawn-general-radius-tiles",
setting_type = "runtime-global",
default_value = 64,
minimum_value = 32,
maximum_value = 6400,
order = "h1"
},
{
type = "int-setting",
name = "oarc-mod-spawn-general-moat-width-tiles",
setting_type = "runtime-global",
default_value = 8,
minimum_value = 1,
maximum_value = 32,
order = "h2"
},
{
type = "int-setting",
name = "oarc-mod-spawn-general-tree-width-tiles",
setting_type = "runtime-global",
default_value = 5,
minimum_value = 1,
maximum_value = 32,
order = "h3"
},
{
type = "string-setting",
name = "oarc-mod-spawn-general-enable-resources-circle-shape",
setting_type = "runtime-global",
default_value = "circle",
allowed_values = {"circle", "square"},
order = "h4"
},
{
type = "bool-setting",
name = "oarc-mod-spawn-general-enable-force-grass",
setting_type = "runtime-global",
default_value = false,
order = "h5"
}, {
type = "string-setting",
name = "oarc-mod-spawn-general-shape",
setting_type = "runtime-global",
default_value = "circle",
allowed_values = {"circle", "octagon", "square"},
order = "h6"
},
-- Vanilla spawn point are not implemented yet.
-- {
-- type = "bool-setting",
-- name = "oarc-mod-enable-vanilla-spawn-points",
-- setting_type = "runtime-global",
-- default_value = true
-- },
-- {
-- type = "int-setting",
-- name = "oarc-mod-number-of-vanilla-spawn-points",
-- setting_type = "runtime-global",
-- default_value = 5,
-- minimum_value = 1,
-- maximum_value = 10
-- },
-- {
-- type = "int-setting",
-- name = "oarc-mod-vanilla-spawn-point-spacing",
-- setting_type = "runtime-global",
-- default_value = 10,
-- minimum_value = 5,
-- maximum_value = 20
-- },
{
type = "bool-setting",
name = "oarc-mod-resource-placement-enabled",
setting_type = "runtime-global",
default_value = true,
order = "i1"
},
{
type = "int-setting",
name = "oarc-mod-resource-placement-distance-to-edge",
setting_type = "runtime-global",
default_value = 20,
minimum_value = 0,
maximum_value = 96,
order = "i2"
},
{
type = "double-setting",
name = "oarc-mod-resource-placement-angle-offset",
setting_type = "runtime-global",
default_value = 2.32,
minimum_value = 0,
maximum_value = 6.28,
order = "i3"
},
{
type = "double-setting",
name = "oarc-mod-resource-placement-angle-final",
setting_type = "runtime-global",
default_value = 4.46,
minimum_value = 0,
maximum_value = 6.28,
order = "i4"
},
{
type = "int-setting",
name = "oarc-mod-resource-placement-vertical-offset",
setting_type = "runtime-global",
default_value = 20,
minimum_value = 0,
maximum_value = 96,
order = "i5"
},
{
type = "int-setting",
name = "oarc-mod-resource-placement-horizontal-offset",
setting_type = "runtime-global",
default_value = 20,
minimum_value = 0,
maximum_value = 96,
order = "i6"
},
{
type = "int-setting",
name = "oarc-mod-resource-placement-linear-spacing",
setting_type = "runtime-global",
default_value = 6,
minimum_value = 0,
maximum_value = 32,
order = "i7"
},
{
type = "double-setting",
name = "oarc-mod-resource-placement-size-multiplier",
setting_type = "runtime-global",
default_value = 1.0,
minimum_value = 0,
maximum_value = 10,
order = "i8"
},
{
type = "double-setting",
name = "oarc-mod-resource-placement-amount-multiplier",
setting_type = "runtime-global",
default_value = 1.0,
minimum_value = 0,
maximum_value = 10,
order = "i9"
},
})