mirror of
https://github.com/iTracerFacer/DCS_MissionDev.git
synced 2025-12-03 04:14:46 +00:00
Fixed salvage cargo spawning for wrong side.
This commit is contained in:
parent
9c406cb83e
commit
d79e5e2878
@ -11710,7 +11710,8 @@ function CTLD:_SpawnSlingLoadSalvageCrate(unitPos, unitTypeName, enemySide, even
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Create unique crate name
|
-- 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))
|
local crateName = string.format('SALVAGE-%s-%06d', sidePrefix, math.random(100000, 999999))
|
||||||
|
|
||||||
-- Enforce active salvage crate cap before spawning
|
-- Enforce active salvage crate cap before spawning
|
||||||
@ -11728,13 +11729,19 @@ function CTLD:_SpawnSlingLoadSalvageCrate(unitPos, unitTypeName, enemySide, even
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Spawn the static cargo
|
-- Spawn the static cargo
|
||||||
local countryId = self.CountryId
|
-- Spawn the crate for the coalition that can recover it (enemySide)
|
||||||
if eventData and eventData.initiator and eventData.initiator.getCountry then
|
local countryId = nil
|
||||||
local success, result = pcall(function() return eventData.initiator:getCountry() end)
|
if CTLD._instances then
|
||||||
if success and result then
|
for _, inst in ipairs(CTLD._instances) do
|
||||||
countryId = result
|
if inst and inst.Side == enemySide and inst.CountryId then
|
||||||
|
countryId = inst.CountryId
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if not countryId then
|
||||||
|
countryId = _defaultCountryForSide(enemySide)
|
||||||
|
end
|
||||||
|
|
||||||
local staticData = {
|
local staticData = {
|
||||||
['type'] = cargoType,
|
['type'] = cargoType,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user