mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
ops
This commit is contained in:
@@ -5799,12 +5799,19 @@ function WAREHOUSE:_SpawnAssetPrepareTemplate(asset, alias)
|
|||||||
template.route.routeRelativeTOT=true
|
template.route.routeRelativeTOT=true
|
||||||
template.route.points = {}
|
template.route.points = {}
|
||||||
|
|
||||||
|
local N=asset.grouping or #template.units
|
||||||
|
|
||||||
-- Handle units.
|
-- Handle units.
|
||||||
for i=1,#template.units do
|
for i=1,N do
|
||||||
|
|
||||||
-- Unit template.
|
-- Unit template.
|
||||||
local unit = template.units[i]
|
local unit = template.units[i]
|
||||||
|
|
||||||
|
-- If more units are in the
|
||||||
|
if i>#template.units then
|
||||||
|
unit=UTILS.DeepCopy(template.units[1])
|
||||||
|
end
|
||||||
|
|
||||||
-- Nillify the unit ID.
|
-- Nillify the unit ID.
|
||||||
unit.unitId=nil
|
unit.unitId=nil
|
||||||
|
|
||||||
|
|||||||
@@ -1464,6 +1464,31 @@ function AIRWING:onafterNewAsset(From, Event, To, asset, assignment)
|
|||||||
squad:GetCallsign(asset)
|
squad:GetCallsign(asset)
|
||||||
squad:GetModex(asset)
|
squad:GetModex(asset)
|
||||||
|
|
||||||
|
if squad.ngrouping then
|
||||||
|
local template=asset.template
|
||||||
|
|
||||||
|
local N=math.max(#template.units, squad.ngrouping)
|
||||||
|
|
||||||
|
-- Handle units.
|
||||||
|
for i=1,N do
|
||||||
|
|
||||||
|
-- Unit template.
|
||||||
|
local unit = template.units[i]
|
||||||
|
|
||||||
|
-- If grouping is larger than units present, copy first unit.
|
||||||
|
if i>#template.units then
|
||||||
|
unit=UTILS.DeepCopy(template.units[1])
|
||||||
|
end
|
||||||
|
|
||||||
|
--Remove units if original template contains more than in grouping.
|
||||||
|
if squad.ngrouping<#template.units and i>#template.units then
|
||||||
|
unit=nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
asset.nunits=squad.ngrouping
|
||||||
|
end
|
||||||
|
|
||||||
-- Add asset to squadron.
|
-- Add asset to squadron.
|
||||||
squad:AddAsset(asset)
|
squad:AddAsset(asset)
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
-- @field #string templatename Name of the template group.
|
-- @field #string templatename Name of the template group.
|
||||||
-- @field #string aircrafttype Type of the airframe the squadron is using.
|
-- @field #string aircrafttype Type of the airframe the squadron is using.
|
||||||
-- @field Wrapper.Group#GROUP templategroup Template group.
|
-- @field Wrapper.Group#GROUP templategroup Template group.
|
||||||
|
-- @field #number ngrouping User defined number of units in the asset group.
|
||||||
-- @field #table assets Squadron assets.
|
-- @field #table assets Squadron assets.
|
||||||
-- @field #table missiontypes Capabilities (mission types and performances) of the squadron.
|
-- @field #table missiontypes Capabilities (mission types and performances) of the squadron.
|
||||||
-- @field #string livery Livery of the squadron.
|
-- @field #string livery Livery of the squadron.
|
||||||
|
|||||||
Reference in New Issue
Block a user