mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2025-02-07 13:07:58 +02:00
Add remove decoratives non-mod setting.
This commit is contained in:
parent
07295f6a17
commit
0aeb536864
@ -315,6 +315,9 @@ OCFG = {
|
||||
|
||||
-- Spawn a circle/octagon/square of trees around this base outline.
|
||||
shape = SPAWN_SHAPE_CHOICE_CIRCLE,
|
||||
|
||||
-- Remove decorations for a cleaner look.
|
||||
remove_decoratives = false,
|
||||
},
|
||||
|
||||
-- Handle placement of starting resources within the spawn area.
|
||||
@ -523,6 +526,7 @@ OCFG = {
|
||||
---@field resources_shape SpawnResourcesShapeChoice The starting resources deposits shape.
|
||||
---@field force_tiles boolean Force the land area circle at the spawn to be a single tile (default grass on Nauvis), otherwise it defaults to the existing terrain and uses landfill to fill gaps.
|
||||
---@field shape SpawnShapeChoice Spawn a circle/octagon/square of trees around this base outline.
|
||||
---@field remove_decoratives boolean Remove decorations for a cleaner look.
|
||||
|
||||
---@class OarcConfigSpawnSafeArea
|
||||
---@field safe_radius number Safe area has no aliens This is the radius in chunks of safe area.
|
||||
|
@ -83,7 +83,8 @@ OCFG_KEYS =
|
||||
["coin_generation.enabled"] = {mod_key = "" , ocfg_keys = {"coin_generation", "enabled"}, type = "boolean", caption = {"oarc-coin-generation-caption"}, tooltip = {"oarc-coin-generation-tooltip"}},
|
||||
["coin_generation.auto_decon_coins"] = {mod_key = "" , ocfg_keys = {"coin_generation", "auto_decon_coins"}, type = "boolean", caption = {"oarc-auto-decon-coins-caption"}, tooltip = {"oarc-auto-decon-coins-tooltip"}},
|
||||
["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"}}
|
||||
["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"}},
|
||||
|
||||
}
|
||||
|
||||
|
@ -756,11 +756,11 @@ end
|
||||
---Resources are generated at a delayed time when the player is moved to the spawn point! It only works off of
|
||||
---the closest spawn point!!
|
||||
---@param surface LuaSurface
|
||||
---@param chunkArea BoundingBox
|
||||
---@param chunk_area BoundingBox
|
||||
---@return nil
|
||||
function SetupAndClearSpawnAreas(surface, chunkArea)
|
||||
function SetupAndClearSpawnAreas(surface, chunk_area)
|
||||
|
||||
local closest_spawn = GetClosestUniqueSpawn(surface.name, chunkArea.left_top)
|
||||
local closest_spawn = GetClosestUniqueSpawn(surface.name, chunk_area.left_top)
|
||||
if (closest_spawn == nil) then return end
|
||||
|
||||
--[[@type OarcConfigSpawnGeneral]]
|
||||
@ -768,9 +768,9 @@ function SetupAndClearSpawnAreas(surface, chunkArea)
|
||||
local surface_spawn_config = storage.ocfg.surfaces_config[surface.name].spawn_config
|
||||
local radius = general_spawn_config.spawn_radius_tiles * surface_spawn_config.radius_modifier
|
||||
|
||||
local chunkAreaCenter = {
|
||||
x = chunkArea.left_top.x + (CHUNK_SIZE / 2),
|
||||
y = chunkArea.left_top.y + (CHUNK_SIZE / 2)
|
||||
local chunk_area_center = {
|
||||
x = chunk_area.left_top.x + (CHUNK_SIZE / 2),
|
||||
y = chunk_area.left_top.y + (CHUNK_SIZE / 2)
|
||||
}
|
||||
|
||||
-- If there is a buddy spawn, we need to setup both areas TOGETHER so they overlap.
|
||||
@ -783,27 +783,32 @@ 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, radius + CHUNK_SIZE)
|
||||
if not CheckIfInArea(chunkAreaCenter, landArea) then
|
||||
local land_area = GetAreaAroundPos(spawn.position, radius + CHUNK_SIZE)
|
||||
if not CheckIfInArea(chunk_area_center, land_area) then
|
||||
goto CONTINUE
|
||||
end
|
||||
|
||||
-- Remove decoratives
|
||||
if (general_spawn_config.remove_decoratives) then
|
||||
surface.destroy_decoratives {area = chunk_area}
|
||||
end
|
||||
|
||||
-- Remove trees/resources inside the spawn area
|
||||
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", "plant", "lightning-attractor", "simple-entity"}, spawn.position, radius + 5)
|
||||
RemoveInCircle(surface, chunk_area, {"resource", "cliff", "tree", "plant", "lightning-attractor", "simple-entity"}, spawn.position, radius + 5)
|
||||
elseif (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_SQUARE) then
|
||||
RemoveInSquare(surface, chunkArea, {"resource", "cliff", "tree", "plant", "lightning-attractor", "simple-entity"}, spawn.position, radius + 5)
|
||||
RemoveInSquare(surface, chunk_area, {"resource", "cliff", "tree", "plant", "lightning-attractor", "simple-entity"}, spawn.position, radius + 5)
|
||||
end
|
||||
|
||||
if (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_CIRCLE) then
|
||||
CreateCropCircle(surface, spawn, chunkArea)
|
||||
CreateCropCircle(surface, spawn, chunk_area)
|
||||
elseif (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_OCTAGON) then
|
||||
CreateCropOctagon(surface, spawn, chunkArea)
|
||||
CreateCropOctagon(surface, spawn, chunk_area)
|
||||
elseif (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_SQUARE) then
|
||||
CreateCropSquare(surface, spawn, chunkArea)
|
||||
CreateCropSquare(surface, spawn, chunk_area)
|
||||
end
|
||||
|
||||
script.raise_event("oarc-mod-on-chunk-generated-near-spawn", {surface = surface, chunk_area = chunkArea, spawn_data = spawn})
|
||||
script.raise_event("oarc-mod-on-chunk-generated-near-spawn", {surface = surface, chunk_area = chunk_area, spawn_data = spawn})
|
||||
:: CONTINUE ::
|
||||
end
|
||||
end
|
||||
|
@ -391,6 +391,8 @@ oarc-player-self-reset-caption=Player Self Reset
|
||||
oarc-player-self-reset-tooltip=Allow players to reset themselves in the spawn controls.
|
||||
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-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!
|
||||
|
5
migrations/oarc-mod-V2.1.17.lua
Normal file
5
migrations/oarc-mod-V2.1.17.lua
Normal file
@ -0,0 +1,5 @@
|
||||
-- Add the new remove decoratives setting
|
||||
if storage.ocfg.spawn_general.remove_decoratives == nil then
|
||||
log("Adding new remove_decoratives setting to spawn_general config.")
|
||||
storage.ocfg.spawn_general.remove_decoratives = false -- Defaults to false
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user