mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Publish to master
This commit is contained in:
@@ -200,8 +200,13 @@ do -- AI_DESIGNATE
|
||||
if SmokeUnit:IsAlive() then
|
||||
local NearestRecceGroup = self.RecceSet:FindNearestGroupFromPointVec2(SmokeUnit:GetPointVec2())
|
||||
if NearestRecceGroup then
|
||||
local NearestRecceUnit = NearestRecceGroup:GetUnit(1)
|
||||
self.Spots[Index] = NearestRecceUnit:LaseUnitOn( SmokeUnit, nil, Duration )
|
||||
for UnitID, UnitData in pairs( NearestRecceGroup:GetUnits() or {} ) do
|
||||
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
||||
if RecceUnit:IsLasing() == false then
|
||||
self.Spots[Index] = RecceUnit:LaseUnit( SmokeUnit, nil, Duration )
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--end
|
||||
|
||||
@@ -67,6 +67,7 @@ do
|
||||
-- @param Core.Point#POINT_VEC3 PointVec3
|
||||
-- @param #number LaserCode
|
||||
-- @param #number Duration
|
||||
-- @return #SPOT
|
||||
function SPOT:onafterLaseOn( From, Event, To, PointVec3, LaserCode, Duration )
|
||||
|
||||
local function StopLase( self )
|
||||
@@ -86,6 +87,7 @@ do
|
||||
-- @param From
|
||||
-- @param Event
|
||||
-- @param To
|
||||
-- @return #SPOT
|
||||
function SPOT:onafterLaseOff( From, Event, To )
|
||||
|
||||
self.Spot:destroy()
|
||||
@@ -94,5 +96,23 @@ do
|
||||
self.LaseScheduler:Stop(self.ScheduleID)
|
||||
end
|
||||
self.ScheduleID = nil
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Check if the SPOT is lasing
|
||||
-- @param #SPOT self
|
||||
-- @return #boolean true if it is lasing
|
||||
function SPOT:IsLasing()
|
||||
self:F2()
|
||||
|
||||
local Lasing = false
|
||||
|
||||
if self.Spot then
|
||||
Lasing = true
|
||||
end
|
||||
|
||||
return Lasing
|
||||
end
|
||||
|
||||
end
|
||||
@@ -457,23 +457,19 @@ end
|
||||
-- @param #number LaserCode
|
||||
-- @param #number Duration
|
||||
-- @return Spot
|
||||
function POSITIONABLE:LaseUnitOn( Target, LaserCode, Duration )
|
||||
function POSITIONABLE:LaseUnit( Target, LaserCode, Duration )
|
||||
self:F2()
|
||||
|
||||
LaserCode = LaserCode or math.random( 1000, 9999 )
|
||||
|
||||
local TargetUnitName = Target:GetName()
|
||||
|
||||
self.Spots = self.Spots or {}
|
||||
self.Spots[TargetUnitName] = self.Spots[TargetUnitName] or {}
|
||||
|
||||
local RecceDcsUnit = self:GetDCSObject()
|
||||
local TargetVec3 = Target:GetVec3()
|
||||
|
||||
self:E("bulding spot")
|
||||
self.Spots[TargetUnitName] = SPOT:New( self ):LaseOn( Target:GetPointVec3(), LaserCode, Duration)
|
||||
self.Spot = SPOT:New( self )
|
||||
self.Spot:LaseOn( Target:GetPointVec3(), LaserCode, Duration)
|
||||
|
||||
return self.Spots[TargetUnitName]
|
||||
return self.Spot
|
||||
|
||||
end
|
||||
|
||||
@@ -481,16 +477,30 @@ end
|
||||
-- @param #POSITIONABLE self
|
||||
-- @param #POSITIONABLE Target
|
||||
-- @return #POSITIONABLE
|
||||
function POSITIONABLE:LaseUnitOff( Target )
|
||||
function POSITIONABLE:LaseOff( Target )
|
||||
self:F2()
|
||||
|
||||
local TargetUnitName = Target:GetName()
|
||||
|
||||
self.Spots = self.Spots or {}
|
||||
if self.Spots[TargetUnitName] then
|
||||
self.Spots[TargetUnitName]:LaseOff()
|
||||
self.Spots[TargetUnitName] = nil
|
||||
if self.Spot then
|
||||
self.Spot:LaseOff()
|
||||
self.Spot = nil
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Check if the POSITIONABLE is lasing a target
|
||||
-- @param #POSITIONABLE self
|
||||
-- @return #boolean true if it is lasing a target
|
||||
function POSITIONABLE:IsLasing()
|
||||
self:F2()
|
||||
|
||||
local Lasing = false
|
||||
|
||||
if self.Spot then
|
||||
Lasing = self.Spot:IsLasing()
|
||||
end
|
||||
|
||||
return Lasing
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user