mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Progress
This commit is contained in:
parent
d2efc61ddc
commit
7ec2d3425c
@ -110,10 +110,10 @@ end
|
|||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param Unit#UNIT CargoCarrier
|
-- @param Unit#UNIT CargoCarrier
|
||||||
-- @param #number Speed
|
-- @param #number Speed
|
||||||
function CARGO:UnBoard( Speed )
|
function CARGO:UnBoard( Speed, Distance, Angle )
|
||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
self:_NextEvent( self.FsmP.UnBoard, Speed )
|
self:_NextEvent( self.FsmP.UnBoard, Speed, Distance, Angle )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Load Cargo to a Carrier.
|
--- Load Cargo to a Carrier.
|
||||||
@ -181,13 +181,12 @@ function CARGO:OnUnLoaded( FsmP, Event, From, To )
|
|||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
self:T( "Cargo " .. self.Name .. " unloaded from " .. self.CargoCarrier:GetName() )
|
self:T( "Cargo " .. self.Name .. " unloaded from " .. self.CargoCarrier:GetName() )
|
||||||
self.CargoCarrier = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #CARGO self
|
--- @param #CARGO self
|
||||||
function CARGO:_NextEvent( NextEvent, ... )
|
function CARGO:_NextEvent( NextEvent, ... )
|
||||||
self:F( self.Name )
|
self:F( self.Name )
|
||||||
self.CargoScheduler:Schedule( self.FsmP, NextEvent, arg, 1 ) -- This schedules the next event, but only if scheduling is activated.
|
SCHEDULER:New( self.FsmP, NextEvent, arg, 1 ) -- This schedules the next event, but only if scheduling is activated.
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -224,10 +223,9 @@ function CARGO_REPRESENTABLE:New( Mission, CargoObject, Type, Name, Weight, Repo
|
|||||||
{ name = 'Boarded', from = 'Boarding', to = 'Boarding' },
|
{ name = 'Boarded', from = 'Boarding', to = 'Boarding' },
|
||||||
{ name = 'Load', from = 'Boarding', to = 'Loaded' },
|
{ name = 'Load', from = 'Boarding', to = 'Loaded' },
|
||||||
{ name = 'Load', from = 'UnLoaded', to = 'Loaded' },
|
{ name = 'Load', from = 'UnLoaded', to = 'Loaded' },
|
||||||
{ name = 'UnBoard', from = 'Loaded', to = 'UnLoading' },
|
{ name = 'UnBoard', from = 'Loaded', to = 'UnBoarding' },
|
||||||
{ name = 'UnLoad', from = 'UnLoading', to = 'UnBoarding' },
|
{ name = 'UnBoarded', from = 'UnBoarding', to = 'UnBoarding' },
|
||||||
{ name = 'UnBoard', from = 'UnBoarding', to = 'UnBoarding' },
|
{ name = 'UnLoad', from = 'UnBoarding', to = 'UnLoaded' },
|
||||||
{ name = 'UnBoarded', from = 'UnBoarding', to = 'UnLoaded' },
|
|
||||||
{ name = 'UnLoad', from = 'Loaded', to = 'UnLoaded' },
|
{ name = 'UnLoad', from = 'Loaded', to = 'UnLoaded' },
|
||||||
},
|
},
|
||||||
callbacks = {
|
callbacks = {
|
||||||
@ -316,45 +314,30 @@ function CARGO_REPRESENTABLE:OnUnBoard( FsmP, Event, From, To, Speed, Distance,
|
|||||||
-- (eg. cargo can be on a oil derrick, moving the cargo on the oil derrick will drop the cargo on the sea).
|
-- (eg. cargo can be on a oil derrick, moving the cargo on the oil derrick will drop the cargo on the sea).
|
||||||
if not self.CargoInAir then
|
if not self.CargoInAir then
|
||||||
|
|
||||||
if self.FsmP:is( "Loaded" ) then
|
if self.FsmP:is( "UnLoading" ) then
|
||||||
self:_NextEvent( FsmP.UnLoad, Distance, Angle )
|
self:_NextEvent( FsmP.UnLoad, 3, Angle )
|
||||||
|
self:_NextEvent( FsmP.UnBoard, Speed, Distance, Angle )
|
||||||
else
|
else
|
||||||
local Points = {}
|
local Points = {}
|
||||||
|
|
||||||
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
||||||
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
||||||
|
self:T( { CargoCarrierHeading, CargoDeployHeading } )
|
||||||
local CargoDeployPointVec2 = StartPointVec2:Translate( Distance, CargoDeployHeading )
|
local CargoDeployPointVec2 = StartPointVec2:Translate( Distance, CargoDeployHeading )
|
||||||
|
local CargoDeployPointVec2 = CargoDeployPointVec2:GetRandomPointVec2InRadius( self.NearRadius )
|
||||||
|
|
||||||
Points[#Points+1] = StartPointVec2:RoutePointGround( Speed )
|
Points[#Points+1] = StartPointVec2:RoutePointGround( Speed )
|
||||||
Points[#Points+1] = CargoDeployPointVec2:RoutePointGround( Speed )
|
Points[#Points+1] = CargoDeployPointVec2:RoutePointGround( Speed )
|
||||||
|
|
||||||
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
||||||
self.CargoObject:SetTask( TaskRoute, 4 )
|
self.CargoObject:SetTask( TaskRoute, 1 )
|
||||||
|
|
||||||
self:_NextEvent( FsmP.UnBoarded )
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- UnBoarded Event.
|
|
||||||
-- @param #CARGO self
|
|
||||||
-- @param StateMachine#STATEMACHINE_PROCESS FsmP
|
|
||||||
-- @param #string Event
|
|
||||||
-- @param #string From
|
|
||||||
-- @param #string To
|
|
||||||
-- @param Unit#UNIT CargoCarrier
|
|
||||||
function CARGO_REPRESENTABLE:OnUnBoarded( FsmP, Event, From, To )
|
|
||||||
self:F()
|
|
||||||
|
|
||||||
if self.CargoObject:GetVelocityKMH() <= 0.1 then
|
|
||||||
else
|
|
||||||
self:_NextEvent( FsmP.UnBoarded )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Load Event.
|
--- Load Event.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param StateMachine#STATEMACHINE_PROCESS FsmP
|
-- @param StateMachine#STATEMACHINE_PROCESS FsmP
|
||||||
|
|||||||
@ -264,19 +264,19 @@ end
|
|||||||
-- @param #table SpawnTemplate
|
-- @param #table SpawnTemplate
|
||||||
-- @return #DATABASE self
|
-- @return #DATABASE self
|
||||||
function DATABASE:Spawn( SpawnTemplate )
|
function DATABASE:Spawn( SpawnTemplate )
|
||||||
self:F2( SpawnTemplate.name )
|
self:F( SpawnTemplate.name )
|
||||||
|
|
||||||
self:T2( { SpawnTemplate.SpawnCountryID, SpawnTemplate.SpawnCategoryID } )
|
self:T( { SpawnTemplate.SpawnCountryID, SpawnTemplate.SpawnCategoryID } )
|
||||||
|
|
||||||
-- Copy the spawn variables of the template in temporary storage, nullify, and restore the spawn variables.
|
-- Copy the spawn variables of the template in temporary storage, nullify, and restore the spawn variables.
|
||||||
local SpawnCoalitionID = SpawnTemplate.SpawnCoalitionID
|
local SpawnCoalitionID = SpawnTemplate.CoalitionID
|
||||||
local SpawnCountryID = SpawnTemplate.SpawnCountryID
|
local SpawnCountryID = SpawnTemplate.CountryID
|
||||||
local SpawnCategoryID = SpawnTemplate.SpawnCategoryID
|
local SpawnCategoryID = SpawnTemplate.CategoryID
|
||||||
|
|
||||||
-- Nullify
|
-- Nullify
|
||||||
SpawnTemplate.SpawnCoalitionID = nil
|
SpawnTemplate.CoalitionID = nil
|
||||||
SpawnTemplate.SpawnCountryID = nil
|
SpawnTemplate.CountryID = nil
|
||||||
SpawnTemplate.SpawnCategoryID = nil
|
SpawnTemplate.CategoryID = nil
|
||||||
|
|
||||||
self:_RegisterTemplate( SpawnTemplate, SpawnCoalitionID, SpawnCategoryID, SpawnCountryID )
|
self:_RegisterTemplate( SpawnTemplate, SpawnCoalitionID, SpawnCategoryID, SpawnCountryID )
|
||||||
|
|
||||||
@ -284,9 +284,9 @@ function DATABASE:Spawn( SpawnTemplate )
|
|||||||
coalition.addGroup( SpawnCountryID, SpawnCategoryID, SpawnTemplate )
|
coalition.addGroup( SpawnCountryID, SpawnCategoryID, SpawnTemplate )
|
||||||
|
|
||||||
-- Restore
|
-- Restore
|
||||||
SpawnTemplate.SpawnCoalitionID = SpawnCoalitionID
|
SpawnTemplate.CoalitionID = SpawnCoalitionID
|
||||||
SpawnTemplate.SpawnCountryID = SpawnCountryID
|
SpawnTemplate.CountryID = SpawnCountryID
|
||||||
SpawnTemplate.SpawnCategoryID = SpawnCategoryID
|
SpawnTemplate.CategoryID = SpawnCategoryID
|
||||||
|
|
||||||
local SpawnGroup = self:AddGroup( SpawnTemplate.name )
|
local SpawnGroup = self:AddGroup( SpawnTemplate.name )
|
||||||
return SpawnGroup
|
return SpawnGroup
|
||||||
@ -330,6 +330,10 @@ function DATABASE:_RegisterTemplate( GroupTemplate, CoalitionID, CategoryID, Cou
|
|||||||
GroupTemplate.route.spans = nil
|
GroupTemplate.route.spans = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
GroupTemplate.CategoryID = CategoryID
|
||||||
|
GroupTemplate.CoalitionID = CoalitionID
|
||||||
|
GroupTemplate.CountryID = CountryID
|
||||||
|
|
||||||
self.Templates.Groups[GroupTemplateName].GroupName = GroupTemplateName
|
self.Templates.Groups[GroupTemplateName].GroupName = GroupTemplateName
|
||||||
self.Templates.Groups[GroupTemplateName].Template = GroupTemplate
|
self.Templates.Groups[GroupTemplateName].Template = GroupTemplate
|
||||||
self.Templates.Groups[GroupTemplateName].groupId = GroupTemplate.groupId
|
self.Templates.Groups[GroupTemplateName].groupId = GroupTemplate.groupId
|
||||||
@ -354,26 +358,27 @@ function DATABASE:_RegisterTemplate( GroupTemplate, CoalitionID, CategoryID, Cou
|
|||||||
|
|
||||||
for unit_num, UnitTemplate in pairs( GroupTemplate.units ) do
|
for unit_num, UnitTemplate in pairs( GroupTemplate.units ) do
|
||||||
|
|
||||||
local UnitTemplateName = env.getValueDictByKey(UnitTemplate.name)
|
UnitTemplate.name = env.getValueDictByKey(UnitTemplate.name)
|
||||||
self.Templates.Units[UnitTemplateName] = {}
|
|
||||||
self.Templates.Units[UnitTemplateName].UnitName = UnitTemplateName
|
self.Templates.Units[UnitTemplate.name] = {}
|
||||||
self.Templates.Units[UnitTemplateName].Template = UnitTemplate
|
self.Templates.Units[UnitTemplate.name].UnitName = UnitTemplate.name
|
||||||
self.Templates.Units[UnitTemplateName].GroupName = GroupTemplateName
|
self.Templates.Units[UnitTemplate.name].Template = UnitTemplate
|
||||||
self.Templates.Units[UnitTemplateName].GroupTemplate = GroupTemplate
|
self.Templates.Units[UnitTemplate.name].GroupName = GroupTemplateName
|
||||||
self.Templates.Units[UnitTemplateName].GroupId = GroupTemplate.groupId
|
self.Templates.Units[UnitTemplate.name].GroupTemplate = GroupTemplate
|
||||||
self.Templates.Units[UnitTemplateName].CategoryID = CategoryID
|
self.Templates.Units[UnitTemplate.name].GroupId = GroupTemplate.groupId
|
||||||
self.Templates.Units[UnitTemplateName].CoalitionID = CoalitionID
|
self.Templates.Units[UnitTemplate.name].CategoryID = CategoryID
|
||||||
self.Templates.Units[UnitTemplateName].CountryID = CountryID
|
self.Templates.Units[UnitTemplate.name].CoalitionID = CoalitionID
|
||||||
|
self.Templates.Units[UnitTemplate.name].CountryID = CountryID
|
||||||
|
|
||||||
if UnitTemplate.skill and (UnitTemplate.skill == "Client" or UnitTemplate.skill == "Player") then
|
if UnitTemplate.skill and (UnitTemplate.skill == "Client" or UnitTemplate.skill == "Player") then
|
||||||
self.Templates.ClientsByName[UnitTemplateName] = UnitTemplate
|
self.Templates.ClientsByName[UnitTemplate.name] = UnitTemplate
|
||||||
self.Templates.ClientsByName[UnitTemplateName].CategoryID = CategoryID
|
self.Templates.ClientsByName[UnitTemplate.name].CategoryID = CategoryID
|
||||||
self.Templates.ClientsByName[UnitTemplateName].CoalitionID = CoalitionID
|
self.Templates.ClientsByName[UnitTemplate.name].CoalitionID = CoalitionID
|
||||||
self.Templates.ClientsByName[UnitTemplateName].CountryID = CountryID
|
self.Templates.ClientsByName[UnitTemplate.name].CountryID = CountryID
|
||||||
self.Templates.ClientsByID[UnitTemplate.unitId] = UnitTemplate
|
self.Templates.ClientsByID[UnitTemplate.unitId] = UnitTemplate
|
||||||
end
|
end
|
||||||
|
|
||||||
TraceTable[#TraceTable+1] = self.Templates.Units[UnitTemplateName].UnitName
|
TraceTable[#TraceTable+1] = self.Templates.Units[UnitTemplate.name].UnitName
|
||||||
end
|
end
|
||||||
|
|
||||||
self:E( TraceTable )
|
self:E( TraceTable )
|
||||||
|
|||||||
@ -185,7 +185,7 @@ function POINT_VEC3:SetZ( z )
|
|||||||
self.z = z
|
self.z = z
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return a random Vec3 point within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
--- Return a random Vec2 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param DCSTypes#Distance OuterRadius
|
-- @param DCSTypes#Distance OuterRadius
|
||||||
-- @param DCSTypes#Distance InnerRadius
|
-- @param DCSTypes#Distance InnerRadius
|
||||||
@ -206,17 +206,28 @@ function POINT_VEC3:GetRandomVec2InRadius( OuterRadius, InnerRadius )
|
|||||||
RadialMultiplier = OuterRadius * Radials
|
RadialMultiplier = OuterRadius * Radials
|
||||||
end
|
end
|
||||||
|
|
||||||
local RandomVec3
|
local RandomVec2
|
||||||
if OuterRadius > 0 then
|
if OuterRadius > 0 then
|
||||||
RandomVec3 = { x = math.cos( Theta ) * RadialMultiplier + self:GetX(), y = math.sin( Theta ) * RadialMultiplier + self:GetZ() }
|
RandomVec2 = { x = math.cos( Theta ) * RadialMultiplier + self:GetX(), y = math.sin( Theta ) * RadialMultiplier + self:GetZ() }
|
||||||
else
|
else
|
||||||
RandomVec3 = { x = self:GetX(), y = self:GetZ() }
|
RandomVec2 = { x = self:GetX(), y = self:GetZ() }
|
||||||
end
|
end
|
||||||
|
|
||||||
return RandomVec3
|
return RandomVec2
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return a random Vec3 point within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
--- Return a random POINT_VEC2 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
||||||
|
-- @param #POINT_VEC3 self
|
||||||
|
-- @param DCSTypes#Distance OuterRadius
|
||||||
|
-- @param DCSTypes#Distance InnerRadius
|
||||||
|
-- @return #POINT_VEC2
|
||||||
|
function POINT_VEC3:GetRandomPointVec2InRadius( OuterRadius, InnerRadius )
|
||||||
|
self:F2( { OuterRadius, InnerRadius } )
|
||||||
|
|
||||||
|
return POINT_VEC2:NewFromVec2( self:GetRandomPointVec2InRadius( OuterRadius, InnerRadius ) )
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Return a random Vec3 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param DCSTypes#Distance OuterRadius
|
-- @param DCSTypes#Distance OuterRadius
|
||||||
-- @param DCSTypes#Distance InnerRadius
|
-- @param DCSTypes#Distance InnerRadius
|
||||||
@ -230,6 +241,16 @@ function POINT_VEC3:GetRandomVec3InRadius( OuterRadius, InnerRadius )
|
|||||||
return RandomVec3
|
return RandomVec3
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Return a random POINT_VEC3 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
||||||
|
-- @param #POINT_VEC3 self
|
||||||
|
-- @param DCSTypes#Distance OuterRadius
|
||||||
|
-- @param DCSTypes#Distance InnerRadius
|
||||||
|
-- @return #POINT_VEC3
|
||||||
|
function POINT_VEC3:GetRandomPointVec3InRadius( OuterRadius, InnerRadius )
|
||||||
|
|
||||||
|
return POINT_VEC3:NewFromVec3( self:GetRandomVec3InRadius( OuterRadius, InnerRadius ) )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Return a direction vector Vec3 from POINT_VEC3 to the POINT_VEC3.
|
--- Return a direction vector Vec3 from POINT_VEC3 to the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
@ -295,8 +316,10 @@ function POINT_VEC3:Translate( Distance, Angle )
|
|||||||
local TX = Distance * math.cos( Radians ) + SX
|
local TX = Distance * math.cos( Radians ) + SX
|
||||||
local TY = Distance * math.sin( Radians ) + SY
|
local TY = Distance * math.sin( Radians ) + SY
|
||||||
|
|
||||||
local SourceVec3 = self:GetVec3()
|
self:SetX( TX )
|
||||||
return ( ( TargetVec3.x - SourceVec3.x ) ^ 2 + ( TargetVec3.y - SourceVec3.y ) ^ 2 + ( TargetVec3.z - SourceVec3.z ) ^ 2 ) ^ 0.5
|
self:SetY( TY )
|
||||||
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Provides a Bearing / Range string
|
--- Provides a Bearing / Range string
|
||||||
@ -626,7 +649,7 @@ end
|
|||||||
--- Set the x coordinate of the POINT_VEC2.
|
--- Set the x coordinate of the POINT_VEC2.
|
||||||
-- @param #number x The x coordinate.
|
-- @param #number x The x coordinate.
|
||||||
function POINT_VEC2:SetX( x )
|
function POINT_VEC2:SetX( x )
|
||||||
elf.x = x
|
self.x = x
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the y coordinate of the POINT_VEC2.
|
--- Set the y coordinate of the POINT_VEC2.
|
||||||
|
|||||||
@ -209,6 +209,7 @@ function POSITIONABLE:GetHeading()
|
|||||||
if PositionableHeading < 0 then
|
if PositionableHeading < 0 then
|
||||||
PositionableHeading = PositionableHeading + 2 * math.pi
|
PositionableHeading = PositionableHeading + 2 * math.pi
|
||||||
end
|
end
|
||||||
|
PositionableHeading = PositionableHeading * 180 / math.pi
|
||||||
self:T2( PositionableHeading )
|
self:T2( PositionableHeading )
|
||||||
return PositionableHeading
|
return PositionableHeading
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1003,9 +1003,9 @@ function SPAWN:_GetTemplate( SpawnTemplatePrefix )
|
|||||||
error( 'No Template returned for SpawnTemplatePrefix = ' .. SpawnTemplatePrefix )
|
error( 'No Template returned for SpawnTemplatePrefix = ' .. SpawnTemplatePrefix )
|
||||||
end
|
end
|
||||||
|
|
||||||
SpawnTemplate.SpawnCoalitionID = self:_GetGroupCoalitionID( SpawnTemplatePrefix )
|
--SpawnTemplate.SpawnCoalitionID = self:_GetGroupCoalitionID( SpawnTemplatePrefix )
|
||||||
SpawnTemplate.SpawnCategoryID = self:_GetGroupCategoryID( SpawnTemplatePrefix )
|
--SpawnTemplate.SpawnCategoryID = self:_GetGroupCategoryID( SpawnTemplatePrefix )
|
||||||
SpawnTemplate.SpawnCountryID = self:_GetGroupCountryID( SpawnTemplatePrefix )
|
--SpawnTemplate.SpawnCountryID = self:_GetGroupCountryID( SpawnTemplatePrefix )
|
||||||
|
|
||||||
self:T3( { SpawnTemplate } )
|
self:T3( { SpawnTemplate } )
|
||||||
return SpawnTemplate
|
return SpawnTemplate
|
||||||
@ -1026,12 +1026,12 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex )
|
|||||||
--SpawnTemplate.lateActivation = false
|
--SpawnTemplate.lateActivation = false
|
||||||
SpawnTemplate.lateActivation = false
|
SpawnTemplate.lateActivation = false
|
||||||
|
|
||||||
if SpawnTemplate.SpawnCategoryID == Group.Category.GROUND then
|
if SpawnTemplate.CategoryID == Group.Category.GROUND then
|
||||||
self:T3( "For ground units, visible needs to be false..." )
|
self:T3( "For ground units, visible needs to be false..." )
|
||||||
SpawnTemplate.visible = false
|
SpawnTemplate.visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if SpawnTemplate.SpawnCategoryID == Group.Category.HELICOPTER or SpawnTemplate.SpawnCategoryID == Group.Category.AIRPLANE then
|
if SpawnTemplate.CategoryID == Group.Category.HELICOPTER or SpawnTemplate.CategoryID == Group.Category.AIRPLANE then
|
||||||
SpawnTemplate.uncontrolled = false
|
SpawnTemplate.uncontrolled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1064,7 +1064,7 @@ function SPAWN:_RandomizeRoute( SpawnIndex )
|
|||||||
SpawnTemplate.route.points[t].y = SpawnTemplate.route.points[t].y + math.random( self.SpawnRandomizeRouteRadius * -1, self.SpawnRandomizeRouteRadius )
|
SpawnTemplate.route.points[t].y = SpawnTemplate.route.points[t].y + math.random( self.SpawnRandomizeRouteRadius * -1, self.SpawnRandomizeRouteRadius )
|
||||||
|
|
||||||
-- Manage randomization of altitude for airborne units ...
|
-- Manage randomization of altitude for airborne units ...
|
||||||
if SpawnTemplate.SpawnCategoryID == Group.Category.AIRPLANE or SpawnTemplate.SpawnCategoryID == Group.Category.HELICOPTER then
|
if SpawnTemplate.CategoryID == Group.Category.AIRPLANE or SpawnTemplate.CategoryID == Group.Category.HELICOPTER then
|
||||||
if SpawnTemplate.route.points[t].alt and self.SpawnRandomizeRouteHeight then
|
if SpawnTemplate.route.points[t].alt and self.SpawnRandomizeRouteHeight then
|
||||||
SpawnTemplate.route.points[t].alt = SpawnTemplate.route.points[t].alt + math.random( 1, self.SpawnRandomizeRouteHeight )
|
SpawnTemplate.route.points[t].alt = SpawnTemplate.route.points[t].alt + math.random( 1, self.SpawnRandomizeRouteHeight )
|
||||||
end
|
end
|
||||||
|
|||||||
@ -152,6 +152,14 @@ function UNIT:FindByName( UnitName )
|
|||||||
return UnitFound
|
return UnitFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Return the name of the UNIT.
|
||||||
|
-- @param #UNIT self
|
||||||
|
-- @return #string The UNIT name.
|
||||||
|
function UNIT:Name()
|
||||||
|
|
||||||
|
return self.UnitName
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #UNIT self
|
--- @param #UNIT self
|
||||||
-- @return DCSUnit#Unit
|
-- @return DCSUnit#Unit
|
||||||
@ -179,7 +187,8 @@ end
|
|||||||
-- @param #number Heading The heading of the unit respawn.
|
-- @param #number Heading The heading of the unit respawn.
|
||||||
function UNIT:ReSpawn( SpawnVec3, Heading )
|
function UNIT:ReSpawn( SpawnVec3, Heading )
|
||||||
|
|
||||||
local SpawnGroupTemplate = _DATABASE:GetGroupTemplateFromUnitName( self:GetName() )
|
local SpawnGroupTemplate = UTILS.DeepCopy( _DATABASE:GetGroupTemplateFromUnitName( self:Name() ) )
|
||||||
|
self:T( SpawnGroupTemplate )
|
||||||
local SpawnGroup = self:GetGroup()
|
local SpawnGroup = self:GetGroup()
|
||||||
|
|
||||||
if SpawnGroup then
|
if SpawnGroup then
|
||||||
@ -205,7 +214,9 @@ function UNIT:ReSpawn( SpawnVec3, Heading )
|
|||||||
end
|
end
|
||||||
|
|
||||||
for UnitTemplateID, UnitTemplateData in pairs( SpawnGroupTemplate.units ) do
|
for UnitTemplateID, UnitTemplateData in pairs( SpawnGroupTemplate.units ) do
|
||||||
if UnitTemplateData.name == self:GetName() then
|
self:T( UnitTemplateData.name )
|
||||||
|
if UnitTemplateData.name == self:Name() then
|
||||||
|
self:T("Adjusting")
|
||||||
SpawnGroupTemplate.units[UnitTemplateID].alt = SpawnVec3.y
|
SpawnGroupTemplate.units[UnitTemplateID].alt = SpawnVec3.y
|
||||||
SpawnGroupTemplate.units[UnitTemplateID].x = SpawnVec3.x
|
SpawnGroupTemplate.units[UnitTemplateID].x = SpawnVec3.x
|
||||||
SpawnGroupTemplate.units[UnitTemplateID].y = SpawnVec3.z
|
SpawnGroupTemplate.units[UnitTemplateID].y = SpawnVec3.z
|
||||||
|
|||||||
Binary file not shown.
@ -12,4 +12,4 @@ InfantryCargo:Load( CargoCarrier )
|
|||||||
-- This will Unboard the Cargo from the Carrier.
|
-- This will Unboard the Cargo from the Carrier.
|
||||||
-- The Cargo will run from the Carrier to a point in the NearRadius around the Carrier.
|
-- The Cargo will run from the Carrier to a point in the NearRadius around the Carrier.
|
||||||
-- Unboard the Cargo with a speed of 10 km/h, go to 200 meters 180 degrees from the Carrier, iin a zone of 25 meters (NearRadius).
|
-- Unboard the Cargo with a speed of 10 km/h, go to 200 meters 180 degrees from the Carrier, iin a zone of 25 meters (NearRadius).
|
||||||
InfantryCargo:UnBoard( CargoCarrier, 10, 200, 180 )
|
InfantryCargo:UnBoard( 10, 200, 180 )
|
||||||
Loading…
x
Reference in New Issue
Block a user