You've already forked FactorioScenarioMultiplayerSpawn
mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2025-10-08 22:52:03 +02:00
Fixing critical bug stopping loading the mod in an existing save.
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 2.1.23
|
||||
Date: 2025-01-19
|
||||
Bugfixes:
|
||||
- Fix crash on migration when adding mod to an existing game.
|
||||
- Change spawn cleanup nearby bases safety check to use "minimum_distance_to_existing_chunks" distance to avoid wiping a nearby buddy's base.
|
||||
Modding:
|
||||
- Add a hidden setting to allow disabling solo spawns. (Not exposed in the GUI.)
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 2.1.22
|
||||
Date: 2025-01-14
|
||||
Bugfixes:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "oarc-mod",
|
||||
"version": "2.1.22",
|
||||
"version": "2.1.23",
|
||||
"factorio_version": "2.0",
|
||||
"title": "Oarc Multiplayer Spawn",
|
||||
"author": "Oarcinae",
|
||||
|
@@ -272,6 +272,9 @@ OCFG = {
|
||||
|
||||
-- Allow players to reset themselves in the spawn controls
|
||||
enable_player_self_reset = true,
|
||||
|
||||
-- Disables solo spawns. Only buddy spawns will work.
|
||||
disable_solo_spawns = false,
|
||||
},
|
||||
|
||||
-- This is a separate feature that is part of the mod that helps keep the map size down. Not required but useful.
|
||||
@@ -497,6 +500,7 @@ OCFG = {
|
||||
---@field enable_shared_chest boolean Enables a single shared chest using the native linked-chest entity in factorio.
|
||||
---@field enable_coin_shop boolean Enable the coin shop GUI for players to buy items with coins.
|
||||
---@field enable_player_self_reset boolean Allow players to reset themselves in the spawn controls
|
||||
---@field disable_solo_spawns boolean Disables solo spawns. Only buddy spawns will work. This is a hidden setting.
|
||||
|
||||
---@class OarcConfigRegrowth
|
||||
---@field enable_regrowth boolean Cleans up unused chunks periodically. Helps keep map size down.
|
||||
|
@@ -1053,14 +1053,14 @@ function UniqueSpawnCleanupRemove(player_name, unique_spawn)
|
||||
|
||||
local spawn_config = storage.ocfg.surfaces_config[unique_spawn.surface_name].spawn_config
|
||||
|
||||
local total_spawn_width = (storage.ocfg.spawn_general.spawn_radius_tiles * spawn_config.radius_modifier) +
|
||||
storage.ocfg.spawn_general.moat_width_tiles
|
||||
-- The only bases within this distance should be buddy bases in theory.
|
||||
local near_bases_minimum_distance = (storage.ocfg.gameplay.minimum_distance_to_existing_chunks - 1) * CHUNK_SIZE
|
||||
|
||||
-- Check if it was near someone else's base. (Really just buddy base is possible I think?)
|
||||
-- Check if it was near someone else's base.
|
||||
nearOtherSpawn = false
|
||||
for player_index, spawn in pairs(storage.unique_spawns[unique_spawn.surface_name]) do
|
||||
if ((player_index ~= player_name) and
|
||||
(util.distance(unique_spawn.position, spawn.position) < (total_spawn_width * 3))) then
|
||||
(util.distance(unique_spawn.position, spawn.position) < near_bases_minimum_distance)) then
|
||||
log("Won't remove base as it's close to another spawn: " .. player_index)
|
||||
nearOtherSpawn = true
|
||||
end
|
||||
|
@@ -287,8 +287,9 @@ end
|
||||
---@param parent_flow LuaGuiElement
|
||||
---@param enable_shared_spawns boolean
|
||||
---@param max_shared_players integer
|
||||
---@param disable_solo_spawns boolean
|
||||
---@return nil
|
||||
function CreateSoloSpawnFrame(parent_flow, enable_shared_spawns, max_shared_players)
|
||||
function CreateSoloSpawnFrame(parent_flow, enable_shared_spawns, max_shared_players, disable_solo_spawns)
|
||||
|
||||
solo_spawn_frame = parent_flow.add {
|
||||
name = "solo_spawn_frame",
|
||||
@@ -302,6 +303,12 @@ function CreateSoloSpawnFrame(parent_flow, enable_shared_spawns, max_shared_play
|
||||
solo_spawn_frame.style.bottom_margin = 0
|
||||
|
||||
AddLabel(solo_spawn_frame, nil, { "oarc-spawn-menu-solo-header" }, my_label_header_style)
|
||||
|
||||
if disable_solo_spawns then
|
||||
AddLabel(solo_spawn_frame, nil, { "oarc-solo-spawn-disabled" }, my_warning_style)
|
||||
return
|
||||
end
|
||||
|
||||
AddLabel(solo_spawn_frame, nil, { "oarc-starting-area-normal" }, my_label_style)
|
||||
|
||||
-- A note about sharing spawns
|
||||
@@ -609,7 +616,7 @@ function DisplaySpawnOptions(player)
|
||||
storage.spawn_choices[player.name] = spawn_choices_entry
|
||||
|
||||
CreateSpawnSettingsFrame(sGui, gameplay) -- The settings for configuring a spawn
|
||||
CreateSoloSpawnFrame(sGui, gameplay.enable_shared_spawns, gameplay.number_of_players_per_shared_spawn) -- The primary method of spawning
|
||||
CreateSoloSpawnFrame(sGui, gameplay.enable_shared_spawns, gameplay.number_of_players_per_shared_spawn, gameplay.disable_solo_spawns) -- The primary method of spawning
|
||||
CreateSharedSpawnFrame(sGui, gameplay.enable_shared_spawns) -- Spawn options to join another player's base.
|
||||
CreateBuddySpawnFrame(sGui, player, gameplay.enable_buddy_spawn, gameplay.enable_separate_teams) -- Awesome buddy spawning system
|
||||
|
||||
|
@@ -51,6 +51,8 @@ oarc-join-shared-button-disable=Select A Player First!
|
||||
oarc-join-shared-button-tooltip=This will send a request to join the selected player's shared spawn area. You can cancel the request if you change your mind.
|
||||
oarc-join-someone-info=You can request to join someone else's starting area. This requires at least 1 person to have allowed access to their base and to have space for you to join.
|
||||
|
||||
oarc-solo-spawn-disabled=Solo spawns are disabled in this mode.
|
||||
|
||||
oarc-no-shared-avail=There are currently no shared bases availble to spawn at.
|
||||
oarc-join-check-again=Check Again
|
||||
oarc-shared-spawn-disabled=Shared spawns are disabled in this mode.
|
||||
|
@@ -54,6 +54,9 @@ for surface_index, spawns in pairs(storage.unique_spawns) do
|
||||
end
|
||||
|
||||
-- Make sure any existing players current surface is tracked
|
||||
if storage.player_surfaces == nil then
|
||||
storage.player_surfaces = {}
|
||||
end
|
||||
for _, player in pairs(game.players) do
|
||||
if player.character then
|
||||
storage.player_surfaces[player.name] = player.character.surface.name
|
||||
|
Reference in New Issue
Block a user