Skip to content

Commit

Permalink
Merge pull request #271 from Oarcinae/dev_2.1.13
Browse files Browse the repository at this point in the history
Dev 2.1.13 (Secondary spawn support for remaining Space Age planets)
  • Loading branch information
Oarcinae authored Nov 20, 2024
2 parents eb81157 + 0bd2df7 commit 908abf6
Show file tree
Hide file tree
Showing 25 changed files with 1,195 additions and 1,292 deletions.
14 changes: 14 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
---------------------------------------------------------------------------------------------------
Version: 2.1.13
Date: 2024-11-20
Major Features:
- Adding support for secondary spawns on Gleba, Vulcanus and Aquilo. This is still experimental and will likely have some issues. Please report any bugs you find. If you want to use this feature, you must go into the in game GUI and check the enable secondary spawns checkbox for the other planets specifically.
Changes:
- Stop regrowth deleting cargo pods at center of map. (By marking the center chunks as permanent.)
- Change surface regrowth checkboxes to be enabled/disabled by the global setting to make it obvious that they are dependent on the global setting.
- Change moat selection to enabled by default.
Bugfixes:
- Fix regrowth surface setting not respecting previous setting state when surface is first created.
- Remove offline enemy attack error messages. (Not really a bug, just false error messages.)
Info:
- Add RU translation (thanks KORESHon!)
---------------------------------------------------------------------------------------------------
Version: 2.1.12
Date: 2024-11-13
Bugfixes:
Expand Down
10 changes: 10 additions & 0 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ script.on_event(defines.events.on_tick, function(event)
RegrowthOnTick()
end
RegrowthForceRemovalOnTick() -- Allows for abandoned base cleanup without regrowth enabled.

if storage.ocfg.gameplay.modified_enemy_spawning then
RemoveDemolishersInWarningZone(event)
end
end)

----------------------------------------
Expand Down Expand Up @@ -343,6 +347,12 @@ script.on_event(defines.events.on_biter_base_built, function(event)
end
end)

script.on_event(defines.events.on_segment_entity_created, function(event)
if storage.ocfg.gameplay.modified_enemy_spawning then
TrackDemolishers(event)
end
end)

----------------------------------------
-- On unit group finished gathering
-- This is where I remove biter waves on offline players
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oarc-mod",
"version": "2.1.12",
"version": "2.1.13",
"factorio_version": "2.0",
"title": "Oarc Multiplayer Spawn",
"author": "Oarcinae",
Expand Down
34 changes: 22 additions & 12 deletions lib/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

require("lib/planet_configs/nauvis")
require("lib/planet_configs/fulgora")
require("lib/planet_configs/vulcanus")
require("lib/planet_configs/gleba")
require("lib/planet_configs/aquilo")

---@alias SpawnShapeChoice "circle" | "octagon" | "square"
SPAWN_SHAPE_CHOICE_CIRCLE = "circle"
Expand Down Expand Up @@ -363,22 +366,22 @@ OCFG = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
},
-- ["vulcanus"] = {
-- starting_items = NAUVIS_STARTER_ITEMS,
-- spawn_config = NAUVIS_SPAWN_CONFIG
-- },
["vulcanus"] = {
starting_items = VULCANUS_STARTER_ITEMS,
spawn_config = VULCANUS_SPAWN_CONFIG
},
["fulgora"] = {
starting_items = FULGORA_STARTER_ITEMS,
spawn_config = FULGORA_SPAWN_CONFIG
},
-- ["gleba"] = {
-- starting_items = NAUVIS_STARTER_ITEMS,
-- spawn_config = NAUVIS_SPAWN_CONFIG
-- },
-- ["aquilo"] = {
-- starting_items = NAUVIS_STARTER_ITEMS,
-- spawn_config = NAUVIS_SPAWN_CONFIG
-- }
["gleba"] = {
starting_items = GLEBA_STARTER_ITEMS,
spawn_config = GLEBA_SPAWN_CONFIG
},
["aquilo"] = {
starting_items = AQUILO_STARTER_ITEMS,
spawn_config = AQUILO_SPAWN_CONFIG
}
},

-- Surfaces blacklist (Ignore these surfaces completely for spawning and regrowth!)
Expand Down Expand Up @@ -511,6 +514,7 @@ OCFG = {
---@field shared_chest_position OarcOffsetPosition Location of shared chest relative to spawn center (if enabled)
---@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)
---@field gleba_resources table<string, OarcConfigGlebaResource> Spawn area config for gleba-style resources (like plants and stromatolites)

---@class OarcConfigSpawnGeneral
---@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.
Expand Down Expand Up @@ -560,6 +564,12 @@ OCFG = {
---@field x_offset_next integer
---@field y_offset_next integer

---@class OarcConfigGlebaResource
---@field tile string The tile to place
---@field entities string[] The entities that can be placed on the tile
---@field size integer The size of the resource patch
---@field density number How often we attempt to place an entity per tile (so if the entity is bigger, then even a density < 1 might still completely fill the area)

---@class OarcStoreItem
---@field cost integer
---@field count integer
Expand Down
7 changes: 7 additions & 0 deletions lib/config_parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ function RuntimeModSettingChanged(event)
local new_value = storage.ocfg.gameplay.enable_coin_shop
AddRemoveOarcGuiTabForAllPlayers(OARC_ITEM_SHOP_TAB_NAME, settings.global[event.setting].value --[[@as boolean]], true)
end

--Exception for regrowth, refresh the content tab so the checkboxes get updated
if (event.setting == "oarc-mod-enable-regrowth") then
for _,player in pairs(game.players) do
OarcGuiRefreshContent(player)
end
end
end

---A probably quit stupid function to let me lookup and set the storage.ocfg entries using a key table.
Expand Down
1 change: 1 addition & 0 deletions lib/gui_tabs/mod_info_faq.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function CreateModInfoTab(tab_container, player)
CreateFAQEntry(scroll_pane, { "oarc-mod-faq-what-is-this-mod" }, { "oarc-mod-faq-what-is-this-mod-answer" })
CreateFAQEntry(scroll_pane, { "oarc-mod-faq-other-surfaces" }, { "oarc-mod-faq-other-surfaces-answer" })
CreateFAQEntry(scroll_pane, { "oarc-mod-faq-secondary-spawns" }, { "oarc-mod-faq-secondary-spawns-answer" })
CreateFAQEntry(scroll_pane, { "oarc-mod-faq-enemy-scaling" }, { "oarc-mod-faq-enemy-scaling-answer" })
CreateFAQEntry(scroll_pane, { "oarc-mod-faq-what-are-teams" }, { "oarc-mod-faq-what-are-teams-answer" })
CreateFAQEntry(scroll_pane, { "oarc-mod-faq-shared-spawn" }, { "oarc-mod-faq-shared-spawn-answer" })
CreateFAQEntry(scroll_pane, { "oarc-mod-faq-buddy-spawn" }, { "oarc-mod-faq-buddy-spawn-answer" })
Expand Down
5 changes: 3 additions & 2 deletions lib/gui_tabs/settings_controls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ function CreateSurfaceSettingsSection(container, player)
AddSurfaceCheckboxSetting(surface_table, name, "secondary_enabled", allowed.secondary, player.admin,
{ "oarc-settings-tab-surface-secondary-checkbox-tooltip" })

local regrowth_enabled = TableContains(storage.rg.active_surfaces, name)
AddSurfaceCheckboxSetting(surface_table, name, "regrowth_enabled", regrowth_enabled, player.admin,
local surface_regrowth = IsRegrowthEnabledOnSurface(name)
local global_regrowth = storage.ocfg.regrowth.enable_regrowth
AddSurfaceCheckboxSetting(surface_table, name, "regrowth_enabled", surface_regrowth, player.admin and global_regrowth,
{"oarc-settings-tab-surface-regrowth-checkbox-tooltip"})
end

Expand Down
6 changes: 3 additions & 3 deletions lib/gui_tabs/surface_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ end
---Create an items selection section
---@param container LuaGuiElement
---@param surface_name string
---@param header string
---@param header LocalisedString
---@param setting_name string
---@param max_count integer?
---@return nil
Expand Down Expand Up @@ -320,10 +320,10 @@ end
---Create an integer textfield with a label
---@param container LuaGuiElement
---@param surface_name string
---@param label string
---@param label LocalisedString
---@param setting_name string
---@param entry_name string
---@param tooltip string
---@param tooltip LocalisedString
---@return nil
function CreateSpawnConfigIntegerField(container, surface_name, label, setting_name, entry_name, tooltip)

Expand Down
9 changes: 6 additions & 3 deletions lib/oarc_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,13 @@ function RerollSpawn(player)
-- Send them to the holding pen
SafeTeleport(player, game.surfaces[HOLDING_PEN_SURFACE_NAME], {x=0,y=0})

-- Queue joiners too!
-- Queue joiners too (if they are on this surface?)
for _,joiner in pairs(old_spawn_point.joiners) do
QueuePlayerForSpawn(joiner, delayed_spawn)
SafeTeleport(game.players[joiner], game.surfaces[HOLDING_PEN_SURFACE_NAME], {x=0,y=0})
local joiner_player = game.players[joiner]
if (joiner_player ~= nil) and joiner_player.surface.name == surface_name then
QueuePlayerForSpawn(joiner, delayed_spawn)
SafeTeleport(game.players[joiner], game.surfaces[HOLDING_PEN_SURFACE_NAME], {x=0,y=0})
end
end

-- Announce
Expand Down
Loading

0 comments on commit 908abf6

Please sign in to comment.