mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Progress
This commit is contained in:
parent
92f1f08d5f
commit
b9a94271b2
@ -297,6 +297,43 @@ function CARGO_REPRESENTABLE:OnBoarded( FsmP, Event, From, To, CargoCarrier )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- UnBoard Event.
|
||||||
|
-- @param #CARGO_REPRESENTABLE self
|
||||||
|
-- @param StateMachine#STATEMACHINE_PROCESS FsmP
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string To
|
||||||
|
-- @param Unit#UNIT CargoCarrier
|
||||||
|
function CARGO_REPRESENTABLE:OnUnBoard( FsmP, Event, From, To, Speed, Angle, Distance )
|
||||||
|
self:F()
|
||||||
|
|
||||||
|
self.CargoInAir = self.CargoObject:InAir()
|
||||||
|
|
||||||
|
self:T( self.CargoInAir )
|
||||||
|
|
||||||
|
-- Only unboard the cargo when the carrier is not in the air.
|
||||||
|
-- (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
|
||||||
|
|
||||||
|
local Points = {}
|
||||||
|
|
||||||
|
local PointStartVec2 = self.CargoCarrier:GetPointVec2()
|
||||||
|
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||||
|
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
||||||
|
local PointEndVec2 = CargoCarrier:GetPointVec2()
|
||||||
|
|
||||||
|
|
||||||
|
Points[#Points+1] = PointStartVec2:RoutePointGround( Speed )
|
||||||
|
Points[#Points+1] = PointEndVec2:RoutePointGround( Speed )
|
||||||
|
|
||||||
|
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
||||||
|
self.CargoObject:SetTask( TaskRoute, 4 )
|
||||||
|
end
|
||||||
|
|
||||||
|
self:_NextEvent( FsmP.Boarded, CargoCarrier )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- UnBoarded Event.
|
--- UnBoarded Event.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @param StateMachine#STATEMACHINE_PROCESS FsmP
|
-- @param StateMachine#STATEMACHINE_PROCESS FsmP
|
||||||
@ -886,17 +923,17 @@ function CARGO_ZONE:Signal()
|
|||||||
if SignalUnit then
|
if SignalUnit then
|
||||||
|
|
||||||
self:T( 'Signalling Unit' )
|
self:T( 'Signalling Unit' )
|
||||||
local SignalVehiclePos = SignalUnit:GetPointVec3()
|
local SignalVehicleVec3 = SignalUnit:GetVec3()
|
||||||
SignalVehiclePos.y = SignalVehiclePos.y + 2
|
SignalVehicleVec3.y = SignalVehicleVec3.y + 2
|
||||||
|
|
||||||
if self.SignalType.ID == CARGO_ZONE.SIGNAL.TYPE.SMOKE.ID then
|
if self.SignalType.ID == CARGO_ZONE.SIGNAL.TYPE.SMOKE.ID then
|
||||||
|
|
||||||
trigger.action.smoke( SignalVehiclePos, self.SignalColor.TRIGGERCOLOR )
|
trigger.action.smoke( SignalVehicleVec3, self.SignalColor.TRIGGERCOLOR )
|
||||||
Signalled = true
|
Signalled = true
|
||||||
|
|
||||||
elseif self.SignalType.ID == CARGO_ZONE.SIGNAL.TYPE.FLARE.ID then
|
elseif self.SignalType.ID == CARGO_ZONE.SIGNAL.TYPE.FLARE.ID then
|
||||||
|
|
||||||
trigger.action.signalFlare( SignalVehiclePos, self.SignalColor.TRIGGERCOLOR , 0 )
|
trigger.action.signalFlare( SignalVehicleVec3, self.SignalColor.TRIGGERCOLOR , 0 )
|
||||||
Signalled = false
|
Signalled = false
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -904,15 +941,15 @@ function CARGO_ZONE:Signal()
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
local ZonePointVec3 = self:GetPointVec3( self.SignalHeight ) -- Get the zone position + the landheight + 2 meters
|
local ZoneVec3 = self:GetPointVec3( self.SignalHeight ) -- Get the zone position + the landheight + 2 meters
|
||||||
|
|
||||||
if self.SignalType.ID == CARGO_ZONE.SIGNAL.TYPE.SMOKE.ID then
|
if self.SignalType.ID == CARGO_ZONE.SIGNAL.TYPE.SMOKE.ID then
|
||||||
|
|
||||||
trigger.action.smoke( ZonePointVec3, self.SignalColor.TRIGGERCOLOR )
|
trigger.action.smoke( ZoneVec3, self.SignalColor.TRIGGERCOLOR )
|
||||||
Signalled = true
|
Signalled = true
|
||||||
|
|
||||||
elseif self.SignalType.ID == CARGO_ZONE.SIGNAL.TYPE.FLARE.ID then
|
elseif self.SignalType.ID == CARGO_ZONE.SIGNAL.TYPE.FLARE.ID then
|
||||||
trigger.action.signalFlare( ZonePointVec3, self.SignalColor.TRIGGERCOLOR, 0 )
|
trigger.action.signalFlare( ZoneVec3, self.SignalColor.TRIGGERCOLOR, 0 )
|
||||||
Signalled = false
|
Signalled = false
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -506,15 +506,15 @@ end
|
|||||||
|
|
||||||
--- (AIR) Delivering weapon at the point on the ground.
|
--- (AIR) Delivering weapon at the point on the ground.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param DCSTypes#Vec2 PointVec2 2D-coordinates of the point to deliver weapon at.
|
-- @param DCSTypes#Vec2 Vec2 2D-coordinates of the point to deliver weapon at.
|
||||||
-- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
|
-- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
|
||||||
-- @param DCSTypes#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
|
-- @param DCSTypes#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
|
||||||
-- @param #number AttackQty (optional) Desired quantity of passes. The parameter is not the same in AttackControllable and AttackUnit tasks.
|
-- @param #number AttackQty (optional) Desired quantity of passes. The parameter is not the same in AttackControllable and AttackUnit tasks.
|
||||||
-- @param DCSTypes#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
|
-- @param DCSTypes#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
|
||||||
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
|
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
|
||||||
-- @return DCSTask#Task The DCS task structure.
|
-- @return DCSTask#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskBombing( PointVec2, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack )
|
function CONTROLLABLE:TaskBombing( Vec2, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack )
|
||||||
self:F2( { self.ControllableName, PointVec2, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack } )
|
self:F2( { self.ControllableName, Vec2, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack } )
|
||||||
|
|
||||||
-- Bombing = {
|
-- Bombing = {
|
||||||
-- id = 'Bombing',
|
-- id = 'Bombing',
|
||||||
@ -531,7 +531,7 @@ function CONTROLLABLE:TaskBombing( PointVec2, WeaponType, WeaponExpend, AttackQt
|
|||||||
local DCSTask
|
local DCSTask
|
||||||
DCSTask = { id = 'Bombing',
|
DCSTask = { id = 'Bombing',
|
||||||
params = {
|
params = {
|
||||||
point = PointVec2,
|
point = Vec2,
|
||||||
weaponType = WeaponType,
|
weaponType = WeaponType,
|
||||||
expend = WeaponExpend,
|
expend = WeaponExpend,
|
||||||
attackQty = AttackQty,
|
attackQty = AttackQty,
|
||||||
@ -624,15 +624,15 @@ end
|
|||||||
|
|
||||||
--- (AIR) Attacking the map object (building, structure, e.t.c).
|
--- (AIR) Attacking the map object (building, structure, e.t.c).
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param DCSTypes#Vec2 PointVec2 2D-coordinates of the point the map object is closest to. The distance between the point and the map object must not be greater than 2000 meters. Object id is not used here because Mission Editor doesn't support map object identificators.
|
-- @param DCSTypes#Vec2 Vec2 2D-coordinates of the point the map object is closest to. The distance between the point and the map object must not be greater than 2000 meters. Object id is not used here because Mission Editor doesn't support map object identificators.
|
||||||
-- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
|
-- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
|
||||||
-- @param DCSTypes#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
|
-- @param DCSTypes#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
|
||||||
-- @param #number AttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
|
-- @param #number AttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
|
||||||
-- @param DCSTypes#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
|
-- @param DCSTypes#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
|
||||||
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
|
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
|
||||||
-- @return DCSTask#Task The DCS task structure.
|
-- @return DCSTask#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskAttackMapObject( PointVec2, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack )
|
function CONTROLLABLE:TaskAttackMapObject( Vec2, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack )
|
||||||
self:F2( { self.ControllableName, PointVec2, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack } )
|
self:F2( { self.ControllableName, Vec2, WeaponType, WeaponExpend, AttackQty, Direction, ControllableAttack } )
|
||||||
|
|
||||||
-- AttackMapObject = {
|
-- AttackMapObject = {
|
||||||
-- id = 'AttackMapObject',
|
-- id = 'AttackMapObject',
|
||||||
@ -649,7 +649,7 @@ function CONTROLLABLE:TaskAttackMapObject( PointVec2, WeaponType, WeaponExpend,
|
|||||||
local DCSTask
|
local DCSTask
|
||||||
DCSTask = { id = 'AttackMapObject',
|
DCSTask = { id = 'AttackMapObject',
|
||||||
params = {
|
params = {
|
||||||
point = PointVec2,
|
point = Vec2,
|
||||||
weaponType = WeaponType,
|
weaponType = WeaponType,
|
||||||
expend = WeaponExpend,
|
expend = WeaponExpend,
|
||||||
attackQty = AttackQty,
|
attackQty = AttackQty,
|
||||||
@ -793,11 +793,11 @@ end
|
|||||||
-- If another controllable is on land the unit / controllable will orbit around.
|
-- If another controllable is on land the unit / controllable will orbit around.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param Controllable#CONTROLLABLE FollowControllable The controllable to be followed.
|
-- @param Controllable#CONTROLLABLE FollowControllable The controllable to be followed.
|
||||||
-- @param DCSTypes#Vec3 PointVec3 Position of the unit / lead unit of the controllable relative lead unit of another controllable in frame reference oriented by course of lead unit of another controllable. If another controllable is on land the unit / controllable will orbit around.
|
-- @param DCSTypes#Vec3 Vec3 Position of the unit / lead unit of the controllable relative lead unit of another controllable in frame reference oriented by course of lead unit of another controllable. If another controllable is on land the unit / controllable will orbit around.
|
||||||
-- @param #number LastWaypointIndex Detach waypoint of another controllable. Once reached the unit / controllable Follow task is finished.
|
-- @param #number LastWaypointIndex Detach waypoint of another controllable. Once reached the unit / controllable Follow task is finished.
|
||||||
-- @return DCSTask#Task The DCS task structure.
|
-- @return DCSTask#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskFollow( FollowControllable, PointVec3, LastWaypointIndex )
|
function CONTROLLABLE:TaskFollow( FollowControllable, Vec3, LastWaypointIndex )
|
||||||
self:F2( { self.ControllableName, FollowControllable, PointVec3, LastWaypointIndex } )
|
self:F2( { self.ControllableName, FollowControllable, Vec3, LastWaypointIndex } )
|
||||||
|
|
||||||
-- Follow = {
|
-- Follow = {
|
||||||
-- id = 'Follow',
|
-- id = 'Follow',
|
||||||
@ -818,7 +818,7 @@ function CONTROLLABLE:TaskFollow( FollowControllable, PointVec3, LastWaypointInd
|
|||||||
DCSTask = { id = 'Follow',
|
DCSTask = { id = 'Follow',
|
||||||
params = {
|
params = {
|
||||||
controllableId = FollowControllable:GetID(),
|
controllableId = FollowControllable:GetID(),
|
||||||
pos = PointVec3,
|
pos = Vec3,
|
||||||
lastWptIndexFlag = LastWaypointIndexFlag,
|
lastWptIndexFlag = LastWaypointIndexFlag,
|
||||||
lastWptIndex = LastWaypointIndex,
|
lastWptIndex = LastWaypointIndex,
|
||||||
},
|
},
|
||||||
@ -834,13 +834,13 @@ end
|
|||||||
-- The unit / controllable will also protect that controllable from threats of specified types.
|
-- The unit / controllable will also protect that controllable from threats of specified types.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param Controllable#CONTROLLABLE EscortControllable The controllable to be escorted.
|
-- @param Controllable#CONTROLLABLE EscortControllable The controllable to be escorted.
|
||||||
-- @param DCSTypes#Vec3 PointVec3 Position of the unit / lead unit of the controllable relative lead unit of another controllable in frame reference oriented by course of lead unit of another controllable. If another controllable is on land the unit / controllable will orbit around.
|
-- @param DCSTypes#Vec3 Vec3 Position of the unit / lead unit of the controllable relative lead unit of another controllable in frame reference oriented by course of lead unit of another controllable. If another controllable is on land the unit / controllable will orbit around.
|
||||||
-- @param #number LastWaypointIndex Detach waypoint of another controllable. Once reached the unit / controllable Follow task is finished.
|
-- @param #number LastWaypointIndex Detach waypoint of another controllable. Once reached the unit / controllable Follow task is finished.
|
||||||
-- @param #number EngagementDistanceMax Maximal distance from escorted controllable to threat. If the threat is already engaged by escort escort will disengage if the distance becomes greater than 1.5 * engagementDistMax.
|
-- @param #number EngagementDistanceMax Maximal distance from escorted controllable to threat. If the threat is already engaged by escort escort will disengage if the distance becomes greater than 1.5 * engagementDistMax.
|
||||||
-- @param DCSTypes#AttributeNameArray TargetTypes Array of AttributeName that is contains threat categories allowed to engage.
|
-- @param DCSTypes#AttributeNameArray TargetTypes Array of AttributeName that is contains threat categories allowed to engage.
|
||||||
-- @return DCSTask#Task The DCS task structure.
|
-- @return DCSTask#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskEscort( FollowControllable, PointVec3, LastWaypointIndex, EngagementDistance, TargetTypes )
|
function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, EngagementDistance, TargetTypes )
|
||||||
self:F2( { self.ControllableName, FollowControllable, PointVec3, LastWaypointIndex, EngagementDistance, TargetTypes } )
|
self:F2( { self.ControllableName, FollowControllable, Vec3, LastWaypointIndex, EngagementDistance, TargetTypes } )
|
||||||
|
|
||||||
-- Escort = {
|
-- Escort = {
|
||||||
-- id = 'Escort',
|
-- id = 'Escort',
|
||||||
@ -863,7 +863,7 @@ function CONTROLLABLE:TaskEscort( FollowControllable, PointVec3, LastWaypointInd
|
|||||||
DCSTask = { id = 'Follow',
|
DCSTask = { id = 'Follow',
|
||||||
params = {
|
params = {
|
||||||
controllableId = FollowControllable:GetID(),
|
controllableId = FollowControllable:GetID(),
|
||||||
pos = PointVec3,
|
pos = Vec3,
|
||||||
lastWptIndexFlag = LastWaypointIndexFlag,
|
lastWptIndexFlag = LastWaypointIndexFlag,
|
||||||
lastWptIndex = LastWaypointIndex,
|
lastWptIndex = LastWaypointIndex,
|
||||||
engagementDistMax = EngagementDistance,
|
engagementDistMax = EngagementDistance,
|
||||||
@ -880,11 +880,11 @@ end
|
|||||||
|
|
||||||
--- (GROUND) Fire at a VEC2 point until ammunition is finished.
|
--- (GROUND) Fire at a VEC2 point until ammunition is finished.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param DCSTypes#Vec2 PointVec2 The point to fire at.
|
-- @param DCSTypes#Vec2 Vec2 The point to fire at.
|
||||||
-- @param DCSTypes#Distance Radius The radius of the zone to deploy the fire at.
|
-- @param DCSTypes#Distance Radius The radius of the zone to deploy the fire at.
|
||||||
-- @return DCSTask#Task The DCS task structure.
|
-- @return DCSTask#Task The DCS task structure.
|
||||||
function CONTROLLABLE:TaskFireAtPoint( PointVec2, Radius )
|
function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius )
|
||||||
self:F2( { self.ControllableName, PointVec2, Radius } )
|
self:F2( { self.ControllableName, Vec2, Radius } )
|
||||||
|
|
||||||
-- FireAtPoint = {
|
-- FireAtPoint = {
|
||||||
-- id = 'FireAtPoint',
|
-- id = 'FireAtPoint',
|
||||||
@ -897,7 +897,7 @@ function CONTROLLABLE:TaskFireAtPoint( PointVec2, Radius )
|
|||||||
local DCSTask
|
local DCSTask
|
||||||
DCSTask = { id = 'FireAtPoint',
|
DCSTask = { id = 'FireAtPoint',
|
||||||
params = {
|
params = {
|
||||||
point = PointVec2,
|
point = Vec2,
|
||||||
radius = Radius,
|
radius = Radius,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1004,13 +1004,13 @@ end
|
|||||||
|
|
||||||
--- (AIR) Engaging a targets of defined types at circle-shaped zone.
|
--- (AIR) Engaging a targets of defined types at circle-shaped zone.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param DCSTypes#Vec2 PointVec2 2D-coordinates of the zone.
|
-- @param DCSTypes#Vec2 Vec2 2D-coordinates of the zone.
|
||||||
-- @param DCSTypes#Distance Radius Radius of the zone.
|
-- @param DCSTypes#Distance Radius Radius of the zone.
|
||||||
-- @param DCSTypes#AttributeNameArray TargetTypes Array of target categories allowed to engage.
|
-- @param DCSTypes#AttributeNameArray TargetTypes Array of target categories allowed to engage.
|
||||||
-- @param #number Priority All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
|
-- @param #number Priority All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
|
||||||
-- @return DCSTask#Task The DCS task structure.
|
-- @return DCSTask#Task The DCS task structure.
|
||||||
function CONTROLLABLE:EnRouteTaskEngageTargets( PointVec2, Radius, TargetTypes, Priority )
|
function CONTROLLABLE:EnRouteTaskEngageTargets( Vec2, Radius, TargetTypes, Priority )
|
||||||
self:F2( { self.ControllableName, PointVec2, Radius, TargetTypes, Priority } )
|
self:F2( { self.ControllableName, Vec2, Radius, TargetTypes, Priority } )
|
||||||
|
|
||||||
-- EngageTargetsInZone = {
|
-- EngageTargetsInZone = {
|
||||||
-- id = 'EngageTargetsInZone',
|
-- id = 'EngageTargetsInZone',
|
||||||
@ -1025,7 +1025,7 @@ function CONTROLLABLE:EnRouteTaskEngageTargets( PointVec2, Radius, TargetTypes,
|
|||||||
local DCSTask
|
local DCSTask
|
||||||
DCSTask = { id = 'EngageTargetsInZone',
|
DCSTask = { id = 'EngageTargetsInZone',
|
||||||
params = {
|
params = {
|
||||||
point = PointVec2,
|
point = Vec2,
|
||||||
zoneRadius = Radius,
|
zoneRadius = Radius,
|
||||||
targetTypes = TargetTypes,
|
targetTypes = TargetTypes,
|
||||||
priority = Priority
|
priority = Priority
|
||||||
@ -1428,12 +1428,12 @@ end
|
|||||||
function CONTROLLABLE:TaskRouteToVec3( Point, Speed )
|
function CONTROLLABLE:TaskRouteToVec3( Point, Speed )
|
||||||
self:F2( { Point, Speed } )
|
self:F2( { Point, Speed } )
|
||||||
|
|
||||||
local ControllablePoint = self:GetUnit( 1 ):GetPointVec3()
|
local ControllableVec3 = self:GetUnit( 1 ):GetVec3()
|
||||||
|
|
||||||
local PointFrom = {}
|
local PointFrom = {}
|
||||||
PointFrom.x = ControllablePoint.x
|
PointFrom.x = ControllableVec3.x
|
||||||
PointFrom.y = ControllablePoint.z
|
PointFrom.y = ControllableVec3.z
|
||||||
PointFrom.alt = ControllablePoint.y
|
PointFrom.alt = ControllableVec3.y
|
||||||
PointFrom.alt_type = "BARO"
|
PointFrom.alt_type = "BARO"
|
||||||
PointFrom.type = "Turning Point"
|
PointFrom.type = "Turning Point"
|
||||||
PointFrom.action = "Turning Point"
|
PointFrom.action = "Turning Point"
|
||||||
|
|||||||
@ -347,11 +347,11 @@ function DETECTION_BASE:_DetectionScheduler( SchedulerName )
|
|||||||
local DetectionDetectedObjectName = DetectionObject:getName()
|
local DetectionDetectedObjectName = DetectionObject:getName()
|
||||||
|
|
||||||
local DetectionDetectedObjectPositionVec3 = DetectionObject:getPoint()
|
local DetectionDetectedObjectPositionVec3 = DetectionObject:getPoint()
|
||||||
local DetectionGroupPositionVec3 = DetectionGroup:GetPointVec3()
|
local DetectionGroupVec3 = DetectionGroup:GetVec3()
|
||||||
|
|
||||||
local Distance = ( ( DetectionDetectedObjectPositionVec3.x - DetectionGroupPositionVec3.x )^2 +
|
local Distance = ( ( DetectionDetectedObjectPositionVec3.x - DetectionGroupVec3.x )^2 +
|
||||||
( DetectionDetectedObjectPositionVec3.y - DetectionGroupPositionVec3.y )^2 +
|
( DetectionDetectedObjectPositionVec3.y - DetectionGroupVec3.y )^2 +
|
||||||
( DetectionDetectedObjectPositionVec3.z - DetectionGroupPositionVec3.z )^2
|
( DetectionDetectedObjectPositionVec3.z - DetectionGroupVec3.z )^2
|
||||||
) ^ 0.5 / 1000
|
) ^ 0.5 / 1000
|
||||||
|
|
||||||
self:T2( { DetectionGroupName, DetectionDetectedObjectName, Distance } )
|
self:T2( { DetectionGroupName, DetectionDetectedObjectName, Distance } )
|
||||||
@ -531,7 +531,7 @@ function DETECTION_AREAS:ReportFriendliesNearBy( ReportGroupData )
|
|||||||
local SphereSearch = {
|
local SphereSearch = {
|
||||||
id = world.VolumeType.SPHERE,
|
id = world.VolumeType.SPHERE,
|
||||||
params = {
|
params = {
|
||||||
point = DetectedZoneUnit:GetPointVec3(),
|
point = DetectedZoneUnit:GetVec3(),
|
||||||
radius = 6000,
|
radius = 6000,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,9 +613,9 @@ function DETECTION_AREAS:NearestFAC( DetectedArea )
|
|||||||
for FACUnit, FACUnitData in pairs( FACGroupData:GetUnits() ) do
|
for FACUnit, FACUnitData in pairs( FACGroupData:GetUnits() ) do
|
||||||
local FACUnit = FACUnitData -- Unit#UNIT
|
local FACUnit = FACUnitData -- Unit#UNIT
|
||||||
if FACUnit:IsActive() then
|
if FACUnit:IsActive() then
|
||||||
local Vec3 = FACUnit:GetPointVec3()
|
local Vec3 = FACUnit:GetVec3()
|
||||||
local PointVec3 = POINT_VEC3:NewFromVec3( Vec3 )
|
local PointVec3 = POINT_VEC3:NewFromVec3( Vec3 )
|
||||||
local Distance = PointVec3:Get2DDistance(POINT_VEC3:NewFromVec3( FACUnit:GetPointVec3() ) )
|
local Distance = PointVec3:Get2DDistance(POINT_VEC3:NewFromVec3( FACUnit:GetVec3() ) )
|
||||||
if Distance < MinDistance then
|
if Distance < MinDistance then
|
||||||
MinDistance = Distance
|
MinDistance = Distance
|
||||||
NearestFAC = FACUnit
|
NearestFAC = FACUnit
|
||||||
|
|||||||
@ -460,7 +460,7 @@ do -- DETECTION_DISPATCHER
|
|||||||
|
|
||||||
local ThreatLevel = Detection:GetTreatLevelA2G( DetectedArea )
|
local ThreatLevel = Detection:GetTreatLevelA2G( DetectedArea )
|
||||||
|
|
||||||
local DetectedAreaVec3 = DetectedZone:GetPointVec3()
|
local DetectedAreaVec3 = DetectedZone:GetVec3()
|
||||||
local DetectedAreaPointVec3 = POINT_VEC3:New( DetectedAreaVec3.x, DetectedAreaVec3.y, DetectedAreaVec3.z )
|
local DetectedAreaPointVec3 = POINT_VEC3:New( DetectedAreaVec3.x, DetectedAreaVec3.y, DetectedAreaVec3.z )
|
||||||
local DetectedAreaPointLL = DetectedAreaPointVec3:ToStringLL( 3, true )
|
local DetectedAreaPointLL = DetectedAreaPointVec3:ToStringLL( 3, true )
|
||||||
AreaMsg[#AreaMsg+1] = string.format( " - Area #%d - %s - Threat Level [%s] (%2d)",
|
AreaMsg[#AreaMsg+1] = string.format( " - Area #%d - %s - Threat Level [%s] (%2d)",
|
||||||
|
|||||||
@ -665,13 +665,13 @@ function ESCORT._HoldPosition( MenuParam )
|
|||||||
self.FollowScheduler:Stop()
|
self.FollowScheduler:Stop()
|
||||||
|
|
||||||
local PointFrom = {}
|
local PointFrom = {}
|
||||||
local GroupPoint = EscortGroup:GetUnit(1):GetPointVec3()
|
local GroupVec3 = EscortGroup:GetUnit(1):GetVec3()
|
||||||
PointFrom = {}
|
PointFrom = {}
|
||||||
PointFrom.x = GroupPoint.x
|
PointFrom.x = GroupVec3.x
|
||||||
PointFrom.y = GroupPoint.z
|
PointFrom.y = GroupVec3.z
|
||||||
PointFrom.speed = 250
|
PointFrom.speed = 250
|
||||||
PointFrom.type = AI.Task.WaypointType.TURNING_POINT
|
PointFrom.type = AI.Task.WaypointType.TURNING_POINT
|
||||||
PointFrom.alt = GroupPoint.y
|
PointFrom.alt = GroupVec3.y
|
||||||
PointFrom.alt_type = AI.Task.AltitudeType.BARO
|
PointFrom.alt_type = AI.Task.AltitudeType.BARO
|
||||||
|
|
||||||
local OrbitPoint = OrbitUnit:GetVec2()
|
local OrbitPoint = OrbitUnit:GetVec2()
|
||||||
@ -997,16 +997,16 @@ function ESCORT:_FollowScheduler()
|
|||||||
self:T( {ClientUnit.UnitName, GroupUnit.UnitName } )
|
self:T( {ClientUnit.UnitName, GroupUnit.UnitName } )
|
||||||
|
|
||||||
if self.CT1 == 0 and self.GT1 == 0 then
|
if self.CT1 == 0 and self.GT1 == 0 then
|
||||||
self.CV1 = ClientUnit:GetPointVec3()
|
self.CV1 = ClientUnit:GetVec3()
|
||||||
self:T( { "self.CV1", self.CV1 } )
|
self:T( { "self.CV1", self.CV1 } )
|
||||||
self.CT1 = timer.getTime()
|
self.CT1 = timer.getTime()
|
||||||
self.GV1 = GroupUnit:GetPointVec3()
|
self.GV1 = GroupUnit:GetVec3()
|
||||||
self.GT1 = timer.getTime()
|
self.GT1 = timer.getTime()
|
||||||
else
|
else
|
||||||
local CT1 = self.CT1
|
local CT1 = self.CT1
|
||||||
local CT2 = timer.getTime()
|
local CT2 = timer.getTime()
|
||||||
local CV1 = self.CV1
|
local CV1 = self.CV1
|
||||||
local CV2 = ClientUnit:GetPointVec3()
|
local CV2 = ClientUnit:GetVec3()
|
||||||
self.CT1 = CT2
|
self.CT1 = CT2
|
||||||
self.CV1 = CV2
|
self.CV1 = CV2
|
||||||
|
|
||||||
@ -1020,7 +1020,7 @@ function ESCORT:_FollowScheduler()
|
|||||||
local GT1 = self.GT1
|
local GT1 = self.GT1
|
||||||
local GT2 = timer.getTime()
|
local GT2 = timer.getTime()
|
||||||
local GV1 = self.GV1
|
local GV1 = self.GV1
|
||||||
local GV2 = GroupUnit:GetPointVec3()
|
local GV2 = GroupUnit:GetVec3()
|
||||||
self.GT1 = GT2
|
self.GT1 = GT2
|
||||||
self.GV1 = GV2
|
self.GV1 = GV2
|
||||||
|
|
||||||
@ -1132,11 +1132,11 @@ function ESCORT:_ReportTargetsScheduler()
|
|||||||
-- EscortTargetLastVelocity } )
|
-- EscortTargetLastVelocity } )
|
||||||
|
|
||||||
|
|
||||||
local EscortTargetUnitPositionVec3 = EscortTargetUnit:GetPointVec3()
|
local EscortTargetUnitVec3 = EscortTargetUnit:GetVec3()
|
||||||
local EscortPositionVec3 = self.EscortGroup:GetPointVec3()
|
local EscortVec3 = self.EscortGroup:GetVec3()
|
||||||
local Distance = ( ( EscortTargetUnitPositionVec3.x - EscortPositionVec3.x )^2 +
|
local Distance = ( ( EscortTargetUnitVec3.x - EscortVec3.x )^2 +
|
||||||
( EscortTargetUnitPositionVec3.y - EscortPositionVec3.y )^2 +
|
( EscortTargetUnitVec3.y - EscortVec3.y )^2 +
|
||||||
( EscortTargetUnitPositionVec3.z - EscortPositionVec3.z )^2
|
( EscortTargetUnitVec3.z - EscortVec3.z )^2
|
||||||
) ^ 0.5 / 1000
|
) ^ 0.5 / 1000
|
||||||
|
|
||||||
self:T( { self.EscortGroup:GetName(), EscortTargetUnit:GetName(), Distance, EscortTarget } )
|
self:T( { self.EscortGroup:GetName(), EscortTargetUnit:GetName(), Distance, EscortTarget } )
|
||||||
@ -1191,11 +1191,11 @@ function ESCORT:_ReportTargetsScheduler()
|
|||||||
EscortTargetMessage = EscortTargetMessage .. "Unknown target at "
|
EscortTargetMessage = EscortTargetMessage .. "Unknown target at "
|
||||||
end
|
end
|
||||||
|
|
||||||
local EscortTargetUnitPositionVec3 = ClientEscortTargetData.AttackUnit:GetPointVec3()
|
local EscortTargetUnitVec3 = ClientEscortTargetData.AttackUnit:GetVec3()
|
||||||
local EscortPositionVec3 = self.EscortGroup:GetPointVec3()
|
local EscortVec3 = self.EscortGroup:GetVec3()
|
||||||
local Distance = ( ( EscortTargetUnitPositionVec3.x - EscortPositionVec3.x )^2 +
|
local Distance = ( ( EscortTargetUnitVec3.x - EscortVec3.x )^2 +
|
||||||
( EscortTargetUnitPositionVec3.y - EscortPositionVec3.y )^2 +
|
( EscortTargetUnitVec3.y - EscortVec3.y )^2 +
|
||||||
( EscortTargetUnitPositionVec3.z - EscortPositionVec3.z )^2
|
( EscortTargetUnitVec3.z - EscortVec3.z )^2
|
||||||
) ^ 0.5 / 1000
|
) ^ 0.5 / 1000
|
||||||
|
|
||||||
self:T( { self.EscortGroup:GetName(), ClientEscortTargetData.AttackUnit:GetName(), Distance, ClientEscortTargetData.AttackUnit } )
|
self:T( { self.EscortGroup:GetName(), ClientEscortTargetData.AttackUnit:GetName(), Distance, ClientEscortTargetData.AttackUnit } )
|
||||||
@ -1259,9 +1259,9 @@ function ESCORT:_ReportTargetsScheduler()
|
|||||||
|
|
||||||
local TaskPoints = self:RegisterRoute()
|
local TaskPoints = self:RegisterRoute()
|
||||||
for WayPointID, WayPoint in pairs( TaskPoints ) do
|
for WayPointID, WayPoint in pairs( TaskPoints ) do
|
||||||
local EscortPositionVec3 = self.EscortGroup:GetPointVec3()
|
local EscortVec3 = self.EscortGroup:GetVec3()
|
||||||
local Distance = ( ( WayPoint.x - EscortPositionVec3.x )^2 +
|
local Distance = ( ( WayPoint.x - EscortVec3.x )^2 +
|
||||||
( WayPoint.y - EscortPositionVec3.z )^2
|
( WayPoint.y - EscortVec3.z )^2
|
||||||
) ^ 0.5 / 1000
|
) ^ 0.5 / 1000
|
||||||
MENU_CLIENT_COMMAND:New( self.EscortClient, "Waypoint " .. WayPointID .. " at " .. string.format( "%.2f", Distance ).. "km", self.EscortMenuResumeMission, ESCORT._ResumeMission, { ParamSelf = self, ParamWayPoint = WayPointID } )
|
MENU_CLIENT_COMMAND:New( self.EscortClient, "Waypoint " .. WayPointID .. " at " .. string.format( "%.2f", Distance ).. "km", self.EscortMenuResumeMission, ESCORT._ResumeMission, { ParamSelf = self, ParamWayPoint = WayPointID } )
|
||||||
end
|
end
|
||||||
|
|||||||
@ -485,14 +485,14 @@ function GROUP:GetVec2()
|
|||||||
return GroupPointVec2
|
return GroupPointVec2
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the current point (Vec3 vector) of the first DCS Unit in the DCS Group.
|
--- Returns the current Vec3 vector of the first DCS Unit in the GROUP.
|
||||||
-- @return DCSTypes#Vec3 Current Vec3 point of the first DCS Unit of the DCS Group.
|
-- @return DCSTypes#Vec3 Current Vec3 of the first DCS Unit of the GROUP.
|
||||||
function GROUP:GetPointVec3()
|
function GROUP:GetVec3()
|
||||||
self:F2( self.GroupName )
|
self:F2( self.GroupName )
|
||||||
|
|
||||||
local GroupPointVec3 = self:GetUnit(1):GetPointVec3()
|
local GroupVec3 = self:GetUnit(1):GetVec3()
|
||||||
self:T3( GroupPointVec3 )
|
self:T3( GroupVec3 )
|
||||||
return GroupPointVec3
|
return GroupVec3
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -508,7 +508,8 @@ function GROUP:IsCompletelyInZone( Zone )
|
|||||||
|
|
||||||
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
||||||
local Unit = UnitData -- Unit#UNIT
|
local Unit = UnitData -- Unit#UNIT
|
||||||
if Zone:IsPointVec3InZone( Unit:GetPointVec3() ) then
|
-- TODO: Rename IsPointVec3InZone to IsVec3InZone
|
||||||
|
if Zone:IsPointVec3InZone( Unit:GetVec3() ) then
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -526,7 +527,7 @@ function GROUP:IsPartlyInZone( Zone )
|
|||||||
|
|
||||||
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
||||||
local Unit = UnitData -- Unit#UNIT
|
local Unit = UnitData -- Unit#UNIT
|
||||||
if Zone:IsPointVec3InZone( Unit:GetPointVec3() ) then
|
if Zone:IsPointVec3InZone( Unit:GetVec3() ) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -543,7 +544,7 @@ function GROUP:IsNotInZone( Zone )
|
|||||||
|
|
||||||
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
||||||
local Unit = UnitData -- Unit#UNIT
|
local Unit = UnitData -- Unit#UNIT
|
||||||
if Zone:IsPointVec3InZone( Unit:GetPointVec3() ) then
|
if Zone:IsPointVec3InZone( Unit:GetVec3() ) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -731,7 +732,7 @@ end
|
|||||||
-- @param #table Template The template of the Group retrieved with GROUP:GetTemplate()
|
-- @param #table Template The template of the Group retrieved with GROUP:GetTemplate()
|
||||||
function GROUP:Respawn( Template )
|
function GROUP:Respawn( Template )
|
||||||
|
|
||||||
local Vec3 = self:GetPointVec3()
|
local Vec3 = self:GetVec3()
|
||||||
Template.x = Vec3.x
|
Template.x = Vec3.x
|
||||||
Template.y = Vec3.z
|
Template.y = Vec3.z
|
||||||
--Template.x = nil
|
--Template.x = nil
|
||||||
@ -742,7 +743,7 @@ function GROUP:Respawn( Template )
|
|||||||
local GroupUnit = UnitData -- Unit#UNIT
|
local GroupUnit = UnitData -- Unit#UNIT
|
||||||
self:E( GroupUnit:GetName() )
|
self:E( GroupUnit:GetName() )
|
||||||
if GroupUnit:IsAlive() then
|
if GroupUnit:IsAlive() then
|
||||||
local GroupUnitVec3 = GroupUnit:GetPointVec3()
|
local GroupUnitVec3 = GroupUnit:GetVec3()
|
||||||
local GroupUnitHeading = GroupUnit:GetHeading()
|
local GroupUnitHeading = GroupUnit:GetHeading()
|
||||||
Template.units[UnitID].alt = GroupUnitVec3.y
|
Template.units[UnitID].alt = GroupUnitVec3.y
|
||||||
Template.units[UnitID].x = GroupUnitVec3.x
|
Template.units[UnitID].x = GroupUnitVec3.x
|
||||||
|
|||||||
@ -512,11 +512,11 @@ function MISSILETRAINER:_AddRange( Client, TrainerWeapon )
|
|||||||
if self.DetailsRangeOnOff then
|
if self.DetailsRangeOnOff then
|
||||||
|
|
||||||
local PositionMissile = TrainerWeapon:getPoint()
|
local PositionMissile = TrainerWeapon:getPoint()
|
||||||
local PositionTarget = Client:GetPointVec3()
|
local TargetVec3 = Client:GetVec3()
|
||||||
|
|
||||||
local Range = ( ( PositionMissile.x - PositionTarget.x )^2 +
|
local Range = ( ( PositionMissile.x - TargetVec3.x )^2 +
|
||||||
( PositionMissile.y - PositionTarget.y )^2 +
|
( PositionMissile.y - TargetVec3.y )^2 +
|
||||||
( PositionMissile.z - PositionTarget.z )^2
|
( PositionMissile.z - TargetVec3.z )^2
|
||||||
) ^ 0.5 / 1000
|
) ^ 0.5 / 1000
|
||||||
|
|
||||||
RangeText = string.format( ", at %4.2fkm", Range )
|
RangeText = string.format( ", at %4.2fkm", Range )
|
||||||
@ -532,11 +532,11 @@ function MISSILETRAINER:_AddBearing( Client, TrainerWeapon )
|
|||||||
if self.DetailsBearingOnOff then
|
if self.DetailsBearingOnOff then
|
||||||
|
|
||||||
local PositionMissile = TrainerWeapon:getPoint()
|
local PositionMissile = TrainerWeapon:getPoint()
|
||||||
local PositionTarget = Client:GetPointVec3()
|
local TargetVec3 = Client:GetVec3()
|
||||||
|
|
||||||
self:T2( { PositionTarget, PositionMissile })
|
self:T2( { TargetVec3, PositionMissile })
|
||||||
|
|
||||||
local DirectionVector = { x = PositionMissile.x - PositionTarget.x, y = PositionMissile.y - PositionTarget.y, z = PositionMissile.z - PositionTarget.z }
|
local DirectionVector = { x = PositionMissile.x - TargetVec3.x, y = PositionMissile.y - TargetVec3.y, z = PositionMissile.z - TargetVec3.z }
|
||||||
local DirectionRadians = math.atan2( DirectionVector.z, DirectionVector.x )
|
local DirectionRadians = math.atan2( DirectionVector.z, DirectionVector.x )
|
||||||
--DirectionRadians = DirectionRadians + routines.getNorthCorrection( PositionTarget )
|
--DirectionRadians = DirectionRadians + routines.getNorthCorrection( PositionTarget )
|
||||||
if DirectionRadians < 0 then
|
if DirectionRadians < 0 then
|
||||||
@ -580,11 +580,11 @@ function MISSILETRAINER:_TrackMissiles()
|
|||||||
|
|
||||||
if Client and Client:IsAlive() and TrainerSourceUnit and TrainerSourceUnit:IsAlive() and TrainerWeapon and TrainerWeapon:isExist() and TrainerTargetUnit and TrainerTargetUnit:IsAlive() then
|
if Client and Client:IsAlive() and TrainerSourceUnit and TrainerSourceUnit:IsAlive() and TrainerWeapon and TrainerWeapon:isExist() and TrainerTargetUnit and TrainerTargetUnit:IsAlive() then
|
||||||
local PositionMissile = TrainerWeapon:getPosition().p
|
local PositionMissile = TrainerWeapon:getPosition().p
|
||||||
local PositionTarget = Client:GetPointVec3()
|
local TargetVec3 = Client:GetVec3()
|
||||||
|
|
||||||
local Distance = ( ( PositionMissile.x - PositionTarget.x )^2 +
|
local Distance = ( ( PositionMissile.x - TargetVec3.x )^2 +
|
||||||
( PositionMissile.y - PositionTarget.y )^2 +
|
( PositionMissile.y - TargetVec3.y )^2 +
|
||||||
( PositionMissile.z - PositionTarget.z )^2
|
( PositionMissile.z - TargetVec3.z )^2
|
||||||
) ^ 0.5 / 1000
|
) ^ 0.5 / 1000
|
||||||
|
|
||||||
if Distance <= self.Distance then
|
if Distance <= self.Distance then
|
||||||
|
|||||||
@ -31,7 +31,9 @@
|
|||||||
--- The POINT_VEC3 class
|
--- The POINT_VEC3 class
|
||||||
-- @type POINT_VEC3
|
-- @type POINT_VEC3
|
||||||
-- @extends Base#BASE
|
-- @extends Base#BASE
|
||||||
-- @field DCSTypes#Vec3 PointVec3
|
-- @field #number x The x coordinate in 3D space.
|
||||||
|
-- @field #number y The y coordinate in 3D space.
|
||||||
|
-- @field #number z The z coordiante in 3D space.
|
||||||
-- @field #POINT_VEC3.SmokeColor SmokeColor
|
-- @field #POINT_VEC3.SmokeColor SmokeColor
|
||||||
-- @field #POINT_VEC3.FlareColor FlareColor
|
-- @field #POINT_VEC3.FlareColor FlareColor
|
||||||
-- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
|
-- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
|
||||||
@ -113,8 +115,9 @@ POINT_VEC3 = {
|
|||||||
function POINT_VEC3:New( x, y, z )
|
function POINT_VEC3:New( x, y, z )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() )
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
self.PointVec3 = { x = x, y = y, z = z }
|
self.x = x
|
||||||
self:F2( self.PointVec3 )
|
self.y = y
|
||||||
|
self.z = z
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -132,14 +135,14 @@ end
|
|||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @return DCSTypes#Vec3 The Vec3 coodinate.
|
-- @return DCSTypes#Vec3 The Vec3 coodinate.
|
||||||
function POINT_VEC3:GetVec3()
|
function POINT_VEC3:GetVec3()
|
||||||
return self.PointVec3
|
return { x = self.x, y = self.y, z = self.z }
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return the coordinates of the POINT_VEC3 in Vec2 format.
|
--- Return the coordinates of the POINT_VEC3 in Vec2 format.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @return DCSTypes#Vec2 The Vec2 coodinate.
|
-- @return DCSTypes#Vec2 The Vec2 coodinate.
|
||||||
function POINT_VEC3:GetVec2()
|
function POINT_VEC3:GetVec2()
|
||||||
return { x = self.PointVec3.x, y = self.PointVec3.z }
|
return { x = self.x, y = self.z }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -147,24 +150,39 @@ end
|
|||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @return #number The x coodinate.
|
-- @return #number The x coodinate.
|
||||||
function POINT_VEC3:GetX()
|
function POINT_VEC3:GetX()
|
||||||
self:F2(self.PointVec3.x)
|
return self.x
|
||||||
return self.PointVec3.x
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return the y coordinate of the POINT_VEC3.
|
--- Return the y coordinate of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @return #number The y coodinate.
|
-- @return #number The y coodinate.
|
||||||
function POINT_VEC3:GetY()
|
function POINT_VEC3:GetY()
|
||||||
self:F2(self.PointVec3.y)
|
return self.y
|
||||||
return self.PointVec3.y
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return the z coordinate of the POINT_VEC3.
|
--- Return the z coordinate of the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @return #number The z coodinate.
|
-- @return #number The z coodinate.
|
||||||
function POINT_VEC3:GetZ()
|
function POINT_VEC3:GetZ()
|
||||||
self:F2(self.PointVec3.z)
|
return self.z
|
||||||
return self.PointVec3.z
|
end
|
||||||
|
|
||||||
|
--- Set the x coordinate of the POINT_VEC3.
|
||||||
|
-- @param #number x The x coordinate.
|
||||||
|
function POINT_VEC3:SetX( x )
|
||||||
|
self.x = x
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the y coordinate of the POINT_VEC3.
|
||||||
|
-- @param #number y The y coordinate.
|
||||||
|
function POINT_VEC3:SetY( y )
|
||||||
|
self.y = y
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the z coordinate of the POINT_VEC3.
|
||||||
|
-- @param #number z The z coordinate.
|
||||||
|
function POINT_VEC3:SetZ( 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 Vec3 point within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
||||||
@ -173,7 +191,7 @@ end
|
|||||||
-- @param DCSTypes#Distance InnerRadius
|
-- @param DCSTypes#Distance InnerRadius
|
||||||
-- @return DCSTypes#Vec2 Vec2
|
-- @return DCSTypes#Vec2 Vec2
|
||||||
function POINT_VEC3:GetRandomVec2InRadius( OuterRadius, InnerRadius )
|
function POINT_VEC3:GetRandomVec2InRadius( OuterRadius, InnerRadius )
|
||||||
self:F2( { self.PointVec3, OuterRadius, InnerRadius } )
|
self:F2( { OuterRadius, InnerRadius } )
|
||||||
|
|
||||||
local Theta = 2 * math.pi * math.random()
|
local Theta = 2 * math.pi * math.random()
|
||||||
local Radials = math.random() + math.random()
|
local Radials = math.random() + math.random()
|
||||||
@ -215,7 +233,7 @@ 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
|
||||||
-- @param #POINT_VEC3 TargetPointVec3 The target PointVec3.
|
-- @param #POINT_VEC3 TargetPointVec3 The target POINT_VEC3.
|
||||||
-- @return DCSTypes#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
-- @return DCSTypes#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
||||||
function POINT_VEC3:GetDirectionVec3( TargetPointVec3 )
|
function POINT_VEC3:GetDirectionVec3( TargetPointVec3 )
|
||||||
return { x = TargetPointVec3:GetX() - self:GetX(), y = TargetPointVec3:GetY() - self:GetY(), z = TargetPointVec3:GetZ() - self:GetZ() }
|
return { x = TargetPointVec3:GetX() - self:GetX(), y = TargetPointVec3:GetY() - self:GetY(), z = TargetPointVec3:GetZ() - self:GetZ() }
|
||||||
@ -247,7 +265,7 @@ end
|
|||||||
|
|
||||||
--- Return the 2D distance in meters between the target POINT_VEC3 and the POINT_VEC3.
|
--- Return the 2D distance in meters between the target POINT_VEC3 and the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param #POINT_VEC3 TargetPointVec3 The target PointVec3.
|
-- @param #POINT_VEC3 TargetPointVec3 The target POINT_VEC3.
|
||||||
-- @return DCSTypes#Distance Distance The distance in meters.
|
-- @return DCSTypes#Distance Distance The distance in meters.
|
||||||
function POINT_VEC3:Get2DDistance( TargetPointVec3 )
|
function POINT_VEC3:Get2DDistance( TargetPointVec3 )
|
||||||
local TargetVec3 = TargetPointVec3:GetVec3()
|
local TargetVec3 = TargetPointVec3:GetVec3()
|
||||||
@ -257,7 +275,7 @@ end
|
|||||||
|
|
||||||
--- Return the 3D distance in meters between the target POINT_VEC3 and the POINT_VEC3.
|
--- Return the 3D distance in meters between the target POINT_VEC3 and the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param #POINT_VEC3 TargetPointVec3 The target PointVec3.
|
-- @param #POINT_VEC3 TargetPointVec3 The target POINT_VEC3.
|
||||||
-- @return DCSTypes#Distance Distance The distance in meters.
|
-- @return DCSTypes#Distance Distance The distance in meters.
|
||||||
function POINT_VEC3:Get3DDistance( TargetPointVec3 )
|
function POINT_VEC3:Get3DDistance( TargetPointVec3 )
|
||||||
local TargetVec3 = TargetPointVec3:GetVec3()
|
local TargetVec3 = TargetPointVec3:GetVec3()
|
||||||
@ -265,6 +283,22 @@ function POINT_VEC3:Get3DDistance( TargetPointVec3 )
|
|||||||
return ( ( TargetVec3.x - SourceVec3.x ) ^ 2 + ( TargetVec3.y - SourceVec3.y ) ^ 2 + ( TargetVec3.z - SourceVec3.z ) ^ 2 ) ^ 0.5
|
return ( ( TargetVec3.x - SourceVec3.x ) ^ 2 + ( TargetVec3.y - SourceVec3.y ) ^ 2 + ( TargetVec3.z - SourceVec3.z ) ^ 2 ) ^ 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add a Distance in meters from the POINT_VEC3 orthogonal plane, with the given angle, and calculate the new POINT_VEC3.
|
||||||
|
-- @param #POINT_VEC3 self
|
||||||
|
-- @param DCSTypes#Distance Distance The Distance to be added in meters.
|
||||||
|
-- @param DCSTypes#Angle Angle The Angle in degrees.
|
||||||
|
-- @return #POINT_VEC3 The new calculated POINT_VEC3.
|
||||||
|
function POINT_VEC3:Translate( Distance, Angle )
|
||||||
|
local SX = self:GetX()
|
||||||
|
local SY = self:GetY()
|
||||||
|
local Radians = Angle / 180 * math.pi
|
||||||
|
local TX = Distance * math.cos( Radians ) + SX
|
||||||
|
local TY = Distance * math.sin( Radians ) + SY
|
||||||
|
|
||||||
|
local SourceVec3 = self:GetVec3()
|
||||||
|
return ( ( TargetVec3.x - SourceVec3.x ) ^ 2 + ( TargetVec3.y - SourceVec3.y ) ^ 2 + ( TargetVec3.z - SourceVec3.z ) ^ 2 ) ^ 0.5
|
||||||
|
end
|
||||||
|
|
||||||
--- Provides a Bearing / Range string
|
--- Provides a Bearing / Range string
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param #number AngleRadians The angle in randians
|
-- @param #number AngleRadians The angle in randians
|
||||||
@ -294,7 +328,7 @@ end
|
|||||||
function POINT_VEC3:ToStringLL( acc, DMS )
|
function POINT_VEC3:ToStringLL( acc, DMS )
|
||||||
|
|
||||||
acc = acc or 3
|
acc = acc or 3
|
||||||
local lat, lon = coord.LOtoLL( self.PointVec3 )
|
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
||||||
return UTILS.tostringLL(lat, lon, acc, DMS)
|
return UTILS.tostringLL(lat, lon, acc, DMS)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -311,7 +345,7 @@ end
|
|||||||
|
|
||||||
--- Return a BR string from a POINT_VEC3 to the POINT_VEC3.
|
--- Return a BR string from a POINT_VEC3 to the POINT_VEC3.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param #POINT_VEC3 TargetPointVec3 The target PointVec3.
|
-- @param #POINT_VEC3 TargetPointVec3 The target POINT_VEC3.
|
||||||
-- @return #string The BR text.
|
-- @return #string The BR text.
|
||||||
function POINT_VEC3:GetBRText( TargetPointVec3 )
|
function POINT_VEC3:GetBRText( TargetPointVec3 )
|
||||||
local DirectionVec3 = self:GetDirectionVec3( TargetPointVec3 )
|
local DirectionVec3 = self:GetDirectionVec3( TargetPointVec3 )
|
||||||
@ -349,9 +383,9 @@ function POINT_VEC3:RoutePointAir( AltType, Type, Action, Speed, SpeedLocked )
|
|||||||
self:F2( { AltType, Type, Action, Speed, SpeedLocked } )
|
self:F2( { AltType, Type, Action, Speed, SpeedLocked } )
|
||||||
|
|
||||||
local RoutePoint = {}
|
local RoutePoint = {}
|
||||||
RoutePoint.x = self.PointVec3.x
|
RoutePoint.x = self:GetX()
|
||||||
RoutePoint.y = self.PointVec3.z
|
RoutePoint.y = self:GetZ()
|
||||||
RoutePoint.alt = self.PointVec3.y
|
RoutePoint.alt = self:GetY()
|
||||||
RoutePoint.alt_type = AltType
|
RoutePoint.alt_type = AltType
|
||||||
|
|
||||||
RoutePoint.type = Type
|
RoutePoint.type = Type
|
||||||
@ -390,8 +424,8 @@ function POINT_VEC3:RoutePointGround( Speed, Formation )
|
|||||||
self:F2( { Formation, Speed } )
|
self:F2( { Formation, Speed } )
|
||||||
|
|
||||||
local RoutePoint = {}
|
local RoutePoint = {}
|
||||||
RoutePoint.x = self.PointVec3.x
|
RoutePoint.x = self:GetX()
|
||||||
RoutePoint.y = self.PointVec3.z
|
RoutePoint.y = self:GetZ()
|
||||||
|
|
||||||
RoutePoint.action = Formation or ""
|
RoutePoint.action = Formation or ""
|
||||||
|
|
||||||
@ -425,8 +459,8 @@ end
|
|||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param Point#POINT_VEC3.SmokeColor SmokeColor
|
-- @param Point#POINT_VEC3.SmokeColor SmokeColor
|
||||||
function POINT_VEC3:Smoke( SmokeColor )
|
function POINT_VEC3:Smoke( SmokeColor )
|
||||||
self:F2( { SmokeColor, self.PointVec3 } )
|
self:F2( { SmokeColor } )
|
||||||
trigger.action.smoke( self.PointVec3, SmokeColor )
|
trigger.action.smoke( self:GetVec3(), SmokeColor )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the POINT_VEC3 Green.
|
--- Smoke the POINT_VEC3 Green.
|
||||||
@ -469,8 +503,8 @@ end
|
|||||||
-- @param Point#POINT_VEC3.FlareColor
|
-- @param Point#POINT_VEC3.FlareColor
|
||||||
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||||
function POINT_VEC3:Flare( FlareColor, Azimuth )
|
function POINT_VEC3:Flare( FlareColor, Azimuth )
|
||||||
self:F2( { FlareColor, self.PointVec3 } )
|
self:F2( { FlareColor } )
|
||||||
trigger.action.signalFlare( self.PointVec3, FlareColor, Azimuth and Azimuth or 0 )
|
trigger.action.signalFlare( self:GetVec3(), FlareColor, Azimuth and Azimuth or 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Flare the POINT_VEC3 White.
|
--- Flare the POINT_VEC3 White.
|
||||||
@ -507,8 +541,9 @@ end
|
|||||||
|
|
||||||
--- The POINT_VEC2 class
|
--- The POINT_VEC2 class
|
||||||
-- @type POINT_VEC2
|
-- @type POINT_VEC2
|
||||||
-- @field DCSTypes#Vec2 PointVec2
|
|
||||||
-- @extends Point#POINT_VEC3
|
-- @extends Point#POINT_VEC3
|
||||||
|
-- @field #number x The x coordinate in 2D space.
|
||||||
|
-- @field #number y the y coordinate in 2D space.
|
||||||
POINT_VEC2 = {
|
POINT_VEC2 = {
|
||||||
ClassName = "POINT_VEC2",
|
ClassName = "POINT_VEC2",
|
||||||
}
|
}
|
||||||
@ -527,10 +562,7 @@ function POINT_VEC2:New( x, y, LandHeightAdd )
|
|||||||
end
|
end
|
||||||
|
|
||||||
local self = BASE:Inherit( self, POINT_VEC3:New( x, LandHeight, y ) )
|
local self = BASE:Inherit( self, POINT_VEC3:New( x, LandHeight, y ) )
|
||||||
self:F2( { x, y, LandHeightAdd } )
|
|
||||||
|
|
||||||
self.PointVec2 = { x = x, y = y }
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -550,9 +582,6 @@ function POINT_VEC2:NewFromVec2( Vec2, LandHeightAdd )
|
|||||||
local self = BASE:Inherit( self, POINT_VEC3:New( Vec2.x, LandHeight, Vec2.y ) )
|
local self = BASE:Inherit( self, POINT_VEC3:New( Vec2.x, LandHeight, Vec2.y ) )
|
||||||
self:F2( { Vec2.x, Vec2.y, LandHeightAdd } )
|
self:F2( { Vec2.x, Vec2.y, LandHeightAdd } )
|
||||||
|
|
||||||
self.PointVec2 = Vec2
|
|
||||||
self:F2( self.PointVec3 )
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -570,20 +599,52 @@ function POINT_VEC2:NewFromVec3( Vec3 )
|
|||||||
local self = BASE:Inherit( self, POINT_VEC3:New( Vec2.x, LandHeight, Vec2.y ) )
|
local self = BASE:Inherit( self, POINT_VEC3:New( Vec2.x, LandHeight, Vec2.y ) )
|
||||||
self:F2( { Vec2.x, LandHeight, Vec2.y } )
|
self:F2( { Vec2.x, LandHeight, Vec2.y } )
|
||||||
|
|
||||||
self.PointVec2 = Vec2
|
|
||||||
self:F2( self.PointVec3 )
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Calculate the distance from a reference @{Point#POINT_VEC2}.
|
--- Return the x coordinate of the POINT_VEC2.
|
||||||
-- @param #POINT_VEC2 self
|
-- @param #POINT_VEC2 self
|
||||||
-- @param #POINT_VEC2 PointVec2Reference The reference @{Point#POINT_VEC2}.
|
-- @return #number The x coodinate.
|
||||||
-- @return DCSTypes#Distance The distance from the reference @{Point#POINT_VEC2} in meters.
|
function POINT_VEC2:GetX()
|
||||||
|
return self.x
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Return the y coordinate of the POINT_VEC2.
|
||||||
|
-- @param #POINT_VEC2 self
|
||||||
|
-- @return #number The y coodinate.
|
||||||
|
function POINT_VEC2:GetY()
|
||||||
|
return self.z
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Return the altitude of the land at the POINT_VEC2.
|
||||||
|
-- @param #POINT_VEC2 self
|
||||||
|
-- @return #number The land altitude.
|
||||||
|
function POINT_VEC2:GetAlt()
|
||||||
|
return land.getHeight( { x = self.x, y = self.z } )
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the x coordinate of the POINT_VEC2.
|
||||||
|
-- @param #number x The x coordinate.
|
||||||
|
function POINT_VEC2:SetX( x )
|
||||||
|
elf.x = x
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the y coordinate of the POINT_VEC2.
|
||||||
|
-- @param #number y The y coordinate.
|
||||||
|
function POINT_VEC2:SetY( y )
|
||||||
|
self.z = y
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- Calculate the distance from a reference @{#POINT_VEC2}.
|
||||||
|
-- @param #POINT_VEC2 self
|
||||||
|
-- @param #POINT_VEC2 PointVec2Reference The reference @{#POINT_VEC2}.
|
||||||
|
-- @return DCSTypes#Distance The distance from the reference @{#POINT_VEC2} in meters.
|
||||||
function POINT_VEC2:DistanceFromPointVec2( PointVec2Reference )
|
function POINT_VEC2:DistanceFromPointVec2( PointVec2Reference )
|
||||||
self:F2( PointVec2Reference )
|
self:F2( PointVec2Reference )
|
||||||
|
|
||||||
local Distance = ( ( PointVec2Reference.PointVec2.x - self.PointVec2.x ) ^ 2 + ( PointVec2Reference.PointVec2.y - self.PointVec2.y ) ^2 ) ^0.5
|
local Distance = ( ( PointVec2Reference:GetX() - self:GetX() ) ^ 2 + ( PointVec2Reference:GetY() - self:GetY() ) ^2 ) ^0.5
|
||||||
|
|
||||||
self:T2( Distance )
|
self:T2( Distance )
|
||||||
return Distance
|
return Distance
|
||||||
@ -596,7 +657,7 @@ end
|
|||||||
function POINT_VEC2:DistanceFromVec2( Vec2Reference )
|
function POINT_VEC2:DistanceFromVec2( Vec2Reference )
|
||||||
self:F2( Vec2Reference )
|
self:F2( Vec2Reference )
|
||||||
|
|
||||||
local Distance = ( ( Vec2Reference.x - self.PointVec2.x ) ^ 2 + ( Vec2Reference.y - self.PointVec2.y ) ^2 ) ^0.5
|
local Distance = ( ( Vec2Reference.x - self:GetX() ) ^ 2 + ( Vec2Reference.y - self:GetY() ) ^2 ) ^0.5
|
||||||
|
|
||||||
self:T2( Distance )
|
self:T2( Distance )
|
||||||
return Distance
|
return Distance
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
--
|
--
|
||||||
-- 1) @{Positionable#POSITIONABLE} class, extends @{Identifiable#IDENTIFIABLE}
|
-- 1) @{Positionable#POSITIONABLE} class, extends @{Identifiable#IDENTIFIABLE}
|
||||||
-- ===========================================================
|
-- ===========================================================
|
||||||
-- The @{Positionable#POSITIONABLE} class is a wrapper class to handle the DCS Positionable objects:
|
-- The @{Positionable#POSITIONABLE} class is a wrapper class to handle the POSITIONABLE objects:
|
||||||
--
|
--
|
||||||
-- * Support all DCS Positionable APIs.
|
-- * Support all DCS APIs.
|
||||||
-- * Enhance with Positionable specific APIs not in the DCS Positionable API set.
|
-- * Enhance with POSITIONABLE specific APIs not in the DCS API set.
|
||||||
-- * Manage the "state" of the DCS Positionable.
|
-- * Manage the "state" of the POSITIONABLE.
|
||||||
--
|
--
|
||||||
-- 1.1) POSITIONABLE constructor:
|
-- 1.1) POSITIONABLE constructor:
|
||||||
-- ------------------------------
|
-- ------------------------------
|
||||||
@ -41,7 +41,7 @@ POSITIONABLE = {
|
|||||||
|
|
||||||
--- Create a new POSITIONABLE from a DCSPositionable
|
--- Create a new POSITIONABLE from a DCSPositionable
|
||||||
-- @param #POSITIONABLE self
|
-- @param #POSITIONABLE self
|
||||||
-- @param DCSPositionable#Positionable PositionableName The DCS Positionable name
|
-- @param DCSPositionable#Positionable PositionableName The POSITIONABLE name
|
||||||
-- @return #POSITIONABLE self
|
-- @return #POSITIONABLE self
|
||||||
function POSITIONABLE:New( PositionableName )
|
function POSITIONABLE:New( PositionableName )
|
||||||
local self = BASE:Inherit( self, IDENTIFIABLE:New( PositionableName ) )
|
local self = BASE:Inherit( self, IDENTIFIABLE:New( PositionableName ) )
|
||||||
@ -49,10 +49,10 @@ function POSITIONABLE:New( PositionableName )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the @{DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the DCS Positionable within the mission.
|
--- Returns the @{DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return DCSTypes#Position The 3D position vectors of the DCS Positionable.
|
-- @return DCSTypes#Position The 3D position vectors of the POSITIONABLE.
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetPositionVec3()
|
function POSITIONABLE:GetPositionVec3()
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@ -67,10 +67,10 @@ function POSITIONABLE:GetPositionVec3()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the @{DCSTypes#Vec2} vector indicating the point in 2D of the DCS Positionable within the mission.
|
--- Returns the @{DCSTypes#Vec2} vector indicating the point in 2D of the POSITIONABLE within the mission.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return DCSTypes#Vec2 The 2D point vector of the DCS Positionable.
|
-- @return DCSTypes#Vec2 The 2D point vector of the POSITIONABLE.
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetVec2()
|
function POSITIONABLE:GetVec2()
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ end
|
|||||||
--- Returns a POINT_VEC2 object indicating the point in 2D of the POSITIONABLE within the mission.
|
--- Returns a POINT_VEC2 object indicating the point in 2D of the POSITIONABLE within the mission.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return Point#POINT_VEC2 The 2D point vector of the POSITIONABLE.
|
-- @return Point#POINT_VEC2 The 2D point vector of the POSITIONABLE.
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetPointVec2()
|
function POSITIONABLE:GetPointVec2()
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@ -112,52 +112,52 @@ function POSITIONABLE:GetPointVec2()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Returns a random @{DCSTypes#Vec3} vector within a range, indicating the point in 3D of the DCS Positionable within the mission.
|
--- Returns a random @{DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return DCSTypes#Vec3 The 3D point vector of the DCS Positionable.
|
-- @return DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetRandomPointVec3( Radius )
|
function POSITIONABLE:GetRandomVec3( Radius )
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
local DCSPositionable = self:GetDCSObject()
|
local DCSPositionable = self:GetDCSObject()
|
||||||
|
|
||||||
if DCSPositionable then
|
if DCSPositionable then
|
||||||
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
||||||
local PositionableRandomPointVec3 = {}
|
local PositionableRandomVec3 = {}
|
||||||
local angle = math.random() * math.pi*2;
|
local angle = math.random() * math.pi*2;
|
||||||
PositionableRandomPointVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||||
PositionableRandomPointVec3.y = PositionablePointVec3.y
|
PositionableRandomVec3.y = PositionablePointVec3.y
|
||||||
PositionableRandomPointVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius;
|
PositionableRandomVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius;
|
||||||
|
|
||||||
self:T3( PositionableRandomPointVec3 )
|
self:T3( PositionableRandomVec3 )
|
||||||
return PositionableRandomPointVec3
|
return PositionableRandomVec3
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the @{DCSTypes#Vec3} vector indicating the point in 3D of the DCS Positionable within the mission.
|
--- Returns the @{DCSTypes#Vec3} vector indicating the 3D vector of the POSITIONABLE within the mission.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return DCSTypes#Vec3 The 3D point vector of the DCS Positionable.
|
-- @return DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetPointVec3()
|
function POSITIONABLE:GetVec3()
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
local DCSPositionable = self:GetDCSObject()
|
local DCSPositionable = self:GetDCSObject()
|
||||||
|
|
||||||
if DCSPositionable then
|
if DCSPositionable then
|
||||||
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
local PositionableVec3 = DCSPositionable:getPosition().p
|
||||||
self:T3( PositionablePointVec3 )
|
self:T3( PositionableVec3 )
|
||||||
return PositionablePointVec3
|
return PositionableVec3
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the altitude of the DCS Positionable.
|
--- Returns the altitude of the POSITIONABLE.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return DCSTypes#Distance The altitude of the DCS Positionable.
|
-- @return DCSTypes#Distance The altitude of the POSITIONABLE.
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetAltitude()
|
function POSITIONABLE:GetAltitude()
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ end
|
|||||||
--- Returns if the Positionable is located above a runway.
|
--- Returns if the Positionable is located above a runway.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return #boolean true if Positionable is above a runway.
|
-- @return #boolean true if Positionable is above a runway.
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:IsAboveRunway()
|
function POSITIONABLE:IsAboveRunway()
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@ -182,8 +182,8 @@ function POSITIONABLE:IsAboveRunway()
|
|||||||
|
|
||||||
if DCSPositionable then
|
if DCSPositionable then
|
||||||
|
|
||||||
local PointVec2 = self:GetVec2()
|
local Vec2 = self:GetVec2()
|
||||||
local SurfaceType = land.getSurfaceType( PointVec2 )
|
local SurfaceType = land.getSurfaceType( Vec2 )
|
||||||
local IsAboveRunway = SurfaceType == land.SurfaceType.RUNWAY
|
local IsAboveRunway = SurfaceType == land.SurfaceType.RUNWAY
|
||||||
|
|
||||||
self:T2( IsAboveRunway )
|
self:T2( IsAboveRunway )
|
||||||
@ -195,9 +195,9 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Returns the DCS Positionable heading.
|
--- Returns the POSITIONABLE heading in degrees.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return #number The DCS Positionable heading
|
-- @return #number The POSTIONABLE heading
|
||||||
function POSITIONABLE:GetHeading()
|
function POSITIONABLE:GetHeading()
|
||||||
local DCSPositionable = self:GetDCSObject()
|
local DCSPositionable = self:GetDCSObject()
|
||||||
|
|
||||||
@ -218,10 +218,10 @@ function POSITIONABLE:GetHeading()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Returns true if the DCS Positionable is in the air.
|
--- Returns true if the POSITIONABLE is in the air.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return #boolean true if in the air.
|
-- @return #boolean true if in the air.
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:InAir()
|
function POSITIONABLE:InAir()
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@ -236,10 +236,10 @@ function POSITIONABLE:InAir()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the DCS Positionable velocity vector.
|
--- Returns the POSITIONABLE velocity vector.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return DCSTypes#Vec3 The velocity vector
|
-- @return DCSTypes#Vec3 The velocity vector
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetVelocity()
|
function POSITIONABLE:GetVelocity()
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@ -254,10 +254,10 @@ function POSITIONABLE:GetVelocity()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the @{Unit#UNIT} velocity in km/h.
|
--- Returns the POSITIONABLE velocity in km/h.
|
||||||
-- @param Positionable#POSITIONABLE self
|
-- @param Positionable#POSITIONABLE self
|
||||||
-- @return #number The velocity in km/h
|
-- @return #number The velocity in km/h
|
||||||
-- @return #nil The DCS Positionable is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetVelocityKMH()
|
function POSITIONABLE:GetVelocityKMH()
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
|
|||||||
@ -162,9 +162,9 @@ function PROCESS_JTAC:OnJTACMenuSpot( Fsm, Event, From, To, TargetUnit )
|
|||||||
TaskJTAC.Spots[TargetUnitName] = TaskJTAC.Spots[TargetUnitName] or {}
|
TaskJTAC.Spots[TargetUnitName] = TaskJTAC.Spots[TargetUnitName] or {}
|
||||||
|
|
||||||
local DCSFACObject = self.FACUnit:GetDCSObject()
|
local DCSFACObject = self.FACUnit:GetDCSObject()
|
||||||
local TargetVec3 = TargetUnit:GetPointVec3()
|
local TargetVec3 = TargetUnit:GetVec3()
|
||||||
|
|
||||||
TaskJTAC.Spots[TargetUnitName] = Spot.createInfraRed( self.FACUnit:GetDCSObject(), { x = 0, y = 1, z = 0 }, TargetUnit:GetPointVec3(), math.random( 1000, 9999 ) )
|
TaskJTAC.Spots[TargetUnitName] = Spot.createInfraRed( self.FACUnit:GetDCSObject(), { x = 0, y = 1, z = 0 }, TargetUnit:GetVec3(), math.random( 1000, 9999 ) )
|
||||||
|
|
||||||
local SpotData = TaskJTAC.Spots[TargetUnitName]
|
local SpotData = TaskJTAC.Spots[TargetUnitName]
|
||||||
self.FACUnit:MessageToGroup( "Lasing " .. TargetUnit:GetTypeName() .. " with laser code " .. SpotData:getCode(), 15, self.ProcessGroup )
|
self.FACUnit:MessageToGroup( "Lasing " .. TargetUnit:GetTypeName() .. " with laser code " .. SpotData:getCode(), 15, self.ProcessGroup )
|
||||||
|
|||||||
@ -651,7 +651,7 @@ function SPAWN:SpawnFromUnit( HostUnit, OuterRadius, InnerRadius, SpawnIndex )
|
|||||||
self:F( { self.SpawnTemplatePrefix, HostUnit, OuterRadius, InnerRadius, SpawnIndex } )
|
self:F( { self.SpawnTemplatePrefix, HostUnit, OuterRadius, InnerRadius, SpawnIndex } )
|
||||||
|
|
||||||
if HostUnit and HostUnit:IsAlive() then -- and HostUnit:getUnit(1):inAir() == false then
|
if HostUnit and HostUnit:IsAlive() then -- and HostUnit:getUnit(1):inAir() == false then
|
||||||
return self:SpawnFromVec3( HostUnit:GetPointVec3(), OuterRadius, InnerRadius, SpawnIndex )
|
return self:SpawnFromVec3( HostUnit:GetVec3(), OuterRadius, InnerRadius, SpawnIndex )
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -670,7 +670,7 @@ function SPAWN:SpawnFromStatic( HostStatic, OuterRadius, InnerRadius, SpawnIndex
|
|||||||
self:F( { self.SpawnTemplatePrefix, HostStatic, OuterRadius, InnerRadius, SpawnIndex } )
|
self:F( { self.SpawnTemplatePrefix, HostStatic, OuterRadius, InnerRadius, SpawnIndex } )
|
||||||
|
|
||||||
if HostStatic and HostStatic:IsAlive() then
|
if HostStatic and HostStatic:IsAlive() then
|
||||||
return self:SpawnFromVec3( HostStatic:GetPointVec3(), OuterRadius, InnerRadius, SpawnIndex )
|
return self:SpawnFromVec3( HostStatic:GetVec3(), OuterRadius, InnerRadius, SpawnIndex )
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
-- 1.4) Location Position, Point
|
-- 1.4) Location Position, Point
|
||||||
-- -----------------------------
|
-- -----------------------------
|
||||||
-- The UNIT class provides methods to obtain the current point or position of the DCS Unit.
|
-- The UNIT class provides methods to obtain the current point or position of the DCS Unit.
|
||||||
-- The @{#UNIT.GetPointVec2}(), @{#UNIT.GetPointVec3}() will obtain the current **location** of the DCS Unit in a Vec2 (2D) or a **point** in a Vec3 (3D) vector respectively.
|
-- The @{#UNIT.GetPointVec2}(), @{#UNIT.GetVec3}() will obtain the current **location** of the DCS Unit in a Vec2 (2D) or a **point** in a Vec3 (3D) vector respectively.
|
||||||
-- If you want to obtain the complete **3D position** including ori<72>ntation and direction vectors, consult the @{#UNIT.GetPositionVec3}() method respectively.
|
-- If you want to obtain the complete **3D position** including ori<72>ntation and direction vectors, consult the @{#UNIT.GetPositionVec3}() method respectively.
|
||||||
--
|
--
|
||||||
-- 1.5) Test if alive
|
-- 1.5) Test if alive
|
||||||
@ -505,7 +505,7 @@ function UNIT:IsInZone( Zone )
|
|||||||
self:F2( { self.UnitName, Zone } )
|
self:F2( { self.UnitName, Zone } )
|
||||||
|
|
||||||
if self:IsAlive() then
|
if self:IsAlive() then
|
||||||
local IsInZone = Zone:IsPointVec3InZone( self:GetPointVec3() )
|
local IsInZone = Zone:IsPointVec3InZone( self:GetVec3() )
|
||||||
|
|
||||||
self:T( { IsInZone } )
|
self:T( { IsInZone } )
|
||||||
return IsInZone
|
return IsInZone
|
||||||
@ -522,7 +522,7 @@ function UNIT:IsNotInZone( Zone )
|
|||||||
self:F2( { self.UnitName, Zone } )
|
self:F2( { self.UnitName, Zone } )
|
||||||
|
|
||||||
if self:IsAlive() then
|
if self:IsAlive() then
|
||||||
local IsInZone = not Zone:IsPointVec3InZone( self:GetPointVec3() )
|
local IsInZone = not Zone:IsPointVec3InZone( self:GetVec3() )
|
||||||
|
|
||||||
self:T( { IsInZone } )
|
self:T( { IsInZone } )
|
||||||
return IsInZone
|
return IsInZone
|
||||||
@ -544,10 +544,10 @@ function UNIT:OtherUnitInRadius( AwaitUnit, Radius )
|
|||||||
local DCSUnit = self:GetDCSObject()
|
local DCSUnit = self:GetDCSObject()
|
||||||
|
|
||||||
if DCSUnit then
|
if DCSUnit then
|
||||||
local UnitPos = self:GetPointVec3()
|
local UnitVec3 = self:GetVec3()
|
||||||
local AwaitUnitPos = AwaitUnit:GetPointVec3()
|
local AwaitUnitVec3 = AwaitUnit:GetVec3()
|
||||||
|
|
||||||
if (((UnitPos.x - AwaitUnitPos.x)^2 + (UnitPos.z - AwaitUnitPos.z)^2)^0.5 <= Radius) then
|
if (((UnitVec3.x - AwaitUnitVec3.x)^2 + (UnitVec3.z - AwaitUnitVec3.z)^2)^0.5 <= Radius) then
|
||||||
self:T3( "true" )
|
self:T3( "true" )
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@ -565,35 +565,35 @@ end
|
|||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:Flare( FlareColor )
|
function UNIT:Flare( FlareColor )
|
||||||
self:F2()
|
self:F2()
|
||||||
trigger.action.signalFlare( self:GetPointVec3(), FlareColor , 0 )
|
trigger.action.signalFlare( self:GetVec3(), FlareColor , 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Signal a white flare at the position of the UNIT.
|
--- Signal a white flare at the position of the UNIT.
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:FlareWhite()
|
function UNIT:FlareWhite()
|
||||||
self:F2()
|
self:F2()
|
||||||
trigger.action.signalFlare( self:GetPointVec3(), trigger.flareColor.White , 0 )
|
trigger.action.signalFlare( self:GetVec3(), trigger.flareColor.White , 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Signal a yellow flare at the position of the UNIT.
|
--- Signal a yellow flare at the position of the UNIT.
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:FlareYellow()
|
function UNIT:FlareYellow()
|
||||||
self:F2()
|
self:F2()
|
||||||
trigger.action.signalFlare( self:GetPointVec3(), trigger.flareColor.Yellow , 0 )
|
trigger.action.signalFlare( self:GetVec3(), trigger.flareColor.Yellow , 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Signal a green flare at the position of the UNIT.
|
--- Signal a green flare at the position of the UNIT.
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:FlareGreen()
|
function UNIT:FlareGreen()
|
||||||
self:F2()
|
self:F2()
|
||||||
trigger.action.signalFlare( self:GetPointVec3(), trigger.flareColor.Green , 0 )
|
trigger.action.signalFlare( self:GetVec3(), trigger.flareColor.Green , 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Signal a red flare at the position of the UNIT.
|
--- Signal a red flare at the position of the UNIT.
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:FlareRed()
|
function UNIT:FlareRed()
|
||||||
self:F2()
|
self:F2()
|
||||||
local Vec3 = self:GetPointVec3()
|
local Vec3 = self:GetVec3()
|
||||||
if Vec3 then
|
if Vec3 then
|
||||||
trigger.action.signalFlare( Vec3, trigger.flareColor.Red, 0 )
|
trigger.action.signalFlare( Vec3, trigger.flareColor.Red, 0 )
|
||||||
end
|
end
|
||||||
@ -604,9 +604,9 @@ end
|
|||||||
function UNIT:Smoke( SmokeColor, Range )
|
function UNIT:Smoke( SmokeColor, Range )
|
||||||
self:F2()
|
self:F2()
|
||||||
if Range then
|
if Range then
|
||||||
trigger.action.smoke( self:GetRandomPointVec3( Range ), SmokeColor )
|
trigger.action.smoke( self:GetRandomVec3( Range ), SmokeColor )
|
||||||
else
|
else
|
||||||
trigger.action.smoke( self:GetPointVec3(), SmokeColor )
|
trigger.action.smoke( self:GetVec3(), SmokeColor )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -615,35 +615,35 @@ end
|
|||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:SmokeGreen()
|
function UNIT:SmokeGreen()
|
||||||
self:F2()
|
self:F2()
|
||||||
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.Green )
|
trigger.action.smoke( self:GetVec3(), trigger.smokeColor.Green )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the UNIT Red.
|
--- Smoke the UNIT Red.
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:SmokeRed()
|
function UNIT:SmokeRed()
|
||||||
self:F2()
|
self:F2()
|
||||||
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.Red )
|
trigger.action.smoke( self:GetVec3(), trigger.smokeColor.Red )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the UNIT White.
|
--- Smoke the UNIT White.
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:SmokeWhite()
|
function UNIT:SmokeWhite()
|
||||||
self:F2()
|
self:F2()
|
||||||
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.White )
|
trigger.action.smoke( self:GetVec3(), trigger.smokeColor.White )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the UNIT Orange.
|
--- Smoke the UNIT Orange.
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:SmokeOrange()
|
function UNIT:SmokeOrange()
|
||||||
self:F2()
|
self:F2()
|
||||||
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.Orange )
|
trigger.action.smoke( self:GetVec3(), trigger.smokeColor.Orange )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the UNIT Blue.
|
--- Smoke the UNIT Blue.
|
||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:SmokeBlue()
|
function UNIT:SmokeBlue()
|
||||||
self:F2()
|
self:F2()
|
||||||
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.Blue )
|
trigger.action.smoke( self:GetVec3(), trigger.smokeColor.Blue )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Is methods
|
-- Is methods
|
||||||
|
|||||||
@ -111,12 +111,12 @@ end
|
|||||||
|
|
||||||
--- Returns if a point is within the zone.
|
--- Returns if a point is within the zone.
|
||||||
-- @param #ZONE_BASE self
|
-- @param #ZONE_BASE self
|
||||||
-- @param DCSTypes#Vec3 PointVec3 The point to test.
|
-- @param DCSTypes#Vec3 Vec3 The point to test.
|
||||||
-- @return #boolean true if the point is within the zone.
|
-- @return #boolean true if the point is within the zone.
|
||||||
function ZONE_BASE:IsPointVec3InZone( PointVec3 )
|
function ZONE_BASE:IsPointVec3InZone( Vec3 )
|
||||||
self:F2( PointVec3 )
|
self:F2( Vec3 )
|
||||||
|
|
||||||
local InZone = self:IsPointVec2InZone( { x = PointVec3.x, y = PointVec3.z } )
|
local InZone = self:IsPointVec2InZone( { x = Vec3.x, y = Vec3.z } )
|
||||||
|
|
||||||
return InZone
|
return InZone
|
||||||
end
|
end
|
||||||
@ -282,11 +282,11 @@ function ZONE_RADIUS:SetPointVec2( Vec2 )
|
|||||||
return self.Vec2
|
return self.Vec2
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the point of the zone.
|
--- Returns the @{DCSTypes#Vec3} of the ZONE_RADIUS.
|
||||||
-- @param #ZONE_RADIUS self
|
-- @param #ZONE_RADIUS self
|
||||||
-- @param DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
|
-- @param DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
|
||||||
-- @return DCSTypes#Vec3 The point of the zone.
|
-- @return DCSTypes#Vec3 The point of the zone.
|
||||||
function ZONE_RADIUS:GetPointVec3( Height )
|
function ZONE_RADIUS:GetVec3( Height )
|
||||||
self:F2( { self.ZoneName, Height } )
|
self:F2( { self.ZoneName, Height } )
|
||||||
|
|
||||||
Height = Height or 0
|
Height = Height or 0
|
||||||
@ -320,7 +320,7 @@ end
|
|||||||
|
|
||||||
--- Returns if a point is within the zone.
|
--- Returns if a point is within the zone.
|
||||||
-- @param #ZONE_RADIUS self
|
-- @param #ZONE_RADIUS self
|
||||||
-- @param DCSTypes#Vec3 PointVec3 The point to test.
|
-- @param DCSTypes#Vec3 Vec3 The point to test.
|
||||||
-- @return #boolean true if the point is within the zone.
|
-- @return #boolean true if the point is within the zone.
|
||||||
function ZONE_RADIUS:IsPointVec3InZone( Vec3 )
|
function ZONE_RADIUS:IsPointVec3InZone( Vec3 )
|
||||||
self:F2( Vec3 )
|
self:F2( Vec3 )
|
||||||
@ -445,22 +445,22 @@ function ZONE_UNIT:GetRandomVec2()
|
|||||||
return Point
|
return Point
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the point of the zone.
|
--- Returns the @{DCSTypes#Vec3} of the ZONE_UNIT.
|
||||||
-- @param #ZONE_RADIUS self
|
-- @param #ZONE_UNIT self
|
||||||
-- @param DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
|
-- @param DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
|
||||||
-- @return DCSTypes#Vec3 The point of the zone.
|
-- @return DCSTypes#Vec3 The point of the zone.
|
||||||
function ZONE_UNIT:GetPointVec3( Height )
|
function ZONE_UNIT:GetVec3( Height )
|
||||||
self:F2( self.ZoneName )
|
self:F2( self.ZoneName )
|
||||||
|
|
||||||
Height = Height or 0
|
Height = Height or 0
|
||||||
|
|
||||||
local Vec2 = self:GetVec2()
|
local Vec2 = self:GetVec2()
|
||||||
|
|
||||||
local PointVec3 = { x = Vec2.x, y = land.getHeight( self:GetVec2() ) + Height, z = Vec2.y }
|
local Vec3 = { x = Vec2.x, y = land.getHeight( self:GetVec2() ) + Height, z = Vec2.y }
|
||||||
|
|
||||||
self:T2( { PointVec3 } )
|
self:T2( { Vec3 } )
|
||||||
|
|
||||||
return PointVec3
|
return Vec3
|
||||||
end
|
end
|
||||||
|
|
||||||
--- The ZONE_GROUP class defined by a zone around a @{Group}, taking the average center point of all the units within the Group, with a radius.
|
--- The ZONE_GROUP class defined by a zone around a @{Group}, taking the average center point of all the units within the Group, with a radius.
|
||||||
|
|||||||
@ -1,3 +1,9 @@
|
|||||||
|
2016-08-06
|
||||||
|
- Made PointVec3 and Vec3, PointVec2 and Vec2 terminology used in the code consistent.
|
||||||
|
-- Replaced method PointVec3() to Vec3() where the code manages a Vec3. Replaced all references to the method.
|
||||||
|
-- Replaced method PointVec2() to Vec2() where the code manages a Vec2. Replaced all references to the method.
|
||||||
|
-- Replaced method RandomPointVec3() to RandomVec3() where the code manages a Vec3. Replaced all references to the method.
|
||||||
|
|
||||||
2016-08-03
|
2016-08-03
|
||||||
- Fixed error at SPAWN:RandomizeTemplate()
|
- Fixed error at SPAWN:RandomizeTemplate()
|
||||||
-- Units started in wrong x, y position (at the template, instead of at the master template of the SPAWN).
|
-- Units started in wrong x, y position (at the template, instead of at the master template of the SPAWN).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user