Fix for incorrect spawn

Spawn group takes a country enum not a coalition enum.. oops! Fixed!
This commit is contained in:
Ciaran Fisher
2015-05-12 20:38:28 +01:00
parent 0209793142
commit 5818243ef2
2 changed files with 43 additions and 40 deletions
+16 -13
View File
@@ -299,10 +299,13 @@ function ctld.spawnGroupAtTrigger(_groupSide, _number, _triggerName, _searchRadi
return
end
local _country
if _groupSide == "red" then
_groupSide = 1
_country = 0
else
_groupSide = 2
_country = 2
end
if _number < 1 then
@@ -319,7 +322,7 @@ function ctld.spawnGroupAtTrigger(_groupSide, _number, _triggerName, _searchRadi
local _types = ctld.generateTroopTypes(_groupSide,_number)
local _droppedTroops = ctld.spawnDroppedGroup(_groupSide,_pos3, _types, false,_searchRadius);
local _droppedTroops = ctld.spawnDroppedGroup(_country,_groupSide,_pos3, _types, false,_searchRadius);
if _groupSide == 1 then
@@ -341,9 +344,9 @@ function ctld.preLoadTransport(_unitName, _number,_troops)
if _unit ~= nil then
-- will replace any units currently on board
-- if not ctld.troopsOnboard(_unit,_troops) then
-- if not ctld.troopsOnboard(_unit,_troops) then
ctld.loadTroops(_unit,_troops,_number)
-- end
-- end
end
end
@@ -388,7 +391,7 @@ function ctld.getTransportUnit(_unitName)
return nil
end
function ctld.spawnCrateStatic(_side,_unitId,_point,_name,_weight)
function ctld.spawnCrateStatic(_country,_unitId,_point,_name,_weight)
local _crate = {
["category"] = "Cargo",
@@ -409,10 +412,10 @@ function ctld.spawnCrateStatic(_side,_unitId,_point,_name,_weight)
local _spawnedCrate
if _side == 1 then
_spawnedCrate = coalition.addStaticObject(_side, _crate)
if _country == 1 then
_spawnedCrate = coalition.addStaticObject(_country, _crate)
else
_spawnedCrate = coalition.addStaticObject(_side, _crate)
_spawnedCrate = coalition.addStaticObject(_country, _crate)
end
return _spawnedCrate
@@ -454,7 +457,7 @@ function ctld.spawnCrate(_args)
local _name = string.format("%s #%i", _crateType.desc, _unitId)
local _spawnedCrate = ctld.spawnCrateStatic(_side,_unitId,{x=_point.x+_xOffset,z=_point.z + _yOffset},_name,_crateType.weight)
local _spawnedCrate = ctld.spawnCrateStatic(_heli:getCountry(),_unitId,{x=_point.x+_xOffset,z=_point.z + _yOffset},_name,_crateType.weight)
if _side == 1 then
-- _spawnedCrate = coalition.addStaticObject(_side, _spawnedCrate)
@@ -520,7 +523,7 @@ function ctld.deployTroops(_heli,_troops)
if _onboard.troops ~= nil and #_onboard.troops > 0 then
local _droppedTroops = ctld.spawnDroppedGroup(_heli:getCoalition(),_heli:getPoint(), _onboard.troops, false)
local _droppedTroops = ctld.spawnDroppedGroup(_heli:getCountry(),_heli:getCoalition(),_heli:getPoint(), _onboard.troops, false)
if _heli:getCoalition() == 1 then
@@ -537,7 +540,7 @@ function ctld.deployTroops(_heli,_troops)
else
if _onboard.vehicles ~= nil and #_onboard.vehicles > 0 then
local _droppedVehicles = ctld.spawnDroppedGroup(_heli:getCoalition(),_heli:getPoint(), _onboard.vehicles, true)
local _droppedVehicles = ctld.spawnDroppedGroup(_heli:getCountry(),_heli:getCoalition(),_heli:getPoint(), _onboard.vehicles, true)
if _heli:getCoalition() == 1 then
@@ -1126,7 +1129,7 @@ function ctld.spawnCrateGroup(_heli, _positions, _types)
end
end
local _spawnedGroup = coalition.addGroup(_side, Group.Category.GROUND, _group)
local _spawnedGroup = coalition.addGroup(_heli:getCountry(), Group.Category.GROUND, _group)
--activate by moving and so we can set ROE and Alarm state
@@ -1141,7 +1144,7 @@ end
-- spawn normal group
function ctld.spawnDroppedGroup(_side,_point, _types, _spawnBehind,_maxSearch)
function ctld.spawnDroppedGroup(_country,_side,_point, _types, _spawnBehind,_maxSearch)
local _id = mist.getNextGroupId()
@@ -1189,7 +1192,7 @@ function ctld.spawnDroppedGroup(_side,_point, _types, _spawnBehind,_maxSearch)
end
end
local _spawnedGroup = coalition.addGroup(_side, Group.Category.GROUND, _group)
local _spawnedGroup = coalition.addGroup(_country, Group.Category.GROUND, _group)
-- find nearest enemy and head there
BIN
View File
Binary file not shown.