From d79e5e28785b186312de0f0664d9080e55d45e68 Mon Sep 17 00:00:00 2001 From: iTracerFacer <134304944+iTracerFacer@users.noreply.github.com> Date: Sat, 15 Nov 2025 00:44:44 -0600 Subject: [PATCH] Fixed salvage cargo spawning for wrong side. --- Moose_CTLD_Pure/Moose_CTLD.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Moose_CTLD_Pure/Moose_CTLD.lua b/Moose_CTLD_Pure/Moose_CTLD.lua index bc90c2d..a8de958 100644 --- a/Moose_CTLD_Pure/Moose_CTLD.lua +++ b/Moose_CTLD_Pure/Moose_CTLD.lua @@ -11710,7 +11710,8 @@ function CTLD:_SpawnSlingLoadSalvageCrate(unitPos, unitTypeName, enemySide, even end -- Create unique crate name - local sidePrefix = (enemySide == coalition.side.BLUE) and 'R' or 'B' + -- Use prefix that matches the coalition allowed to collect this crate + local sidePrefix = (enemySide == coalition.side.BLUE) and 'B' or 'R' local crateName = string.format('SALVAGE-%s-%06d', sidePrefix, math.random(100000, 999999)) -- Enforce active salvage crate cap before spawning @@ -11728,13 +11729,19 @@ function CTLD:_SpawnSlingLoadSalvageCrate(unitPos, unitTypeName, enemySide, even end -- Spawn the static cargo - local countryId = self.CountryId - if eventData and eventData.initiator and eventData.initiator.getCountry then - local success, result = pcall(function() return eventData.initiator:getCountry() end) - if success and result then - countryId = result + -- Spawn the crate for the coalition that can recover it (enemySide) + local countryId = nil + if CTLD._instances then + for _, inst in ipairs(CTLD._instances) do + if inst and inst.Side == enemySide and inst.CountryId then + countryId = inst.CountryId + break + end end end + if not countryId then + countryId = _defaultCountryForSide(enemySide) + end local staticData = { ['type'] = cargoType,