Improvements

This commit is contained in:
FlightControl
2017-04-23 13:49:32 +02:00
parent 8a5a33d191
commit 20b4ebfb2b
3 changed files with 51 additions and 19 deletions

View File

@@ -141,6 +141,8 @@ do
self.LaseScheduler = SCHEDULER:New( self )
self:SetEventPriority( 5 )
self.Lasing = false
return self
end
@@ -162,6 +164,8 @@ do
self.Target = Target
self.LaserCode = LaserCode
self.Lasing = true
local RecceDcsUnit = self.Recce:GetDCSObject()
self.SpotIR = Spot.createInfraRed( RecceDcsUnit, { x = 0, y = 2, z = 0 }, Target:GetPointVec3():AddY(1):GetVec3() )
@@ -184,7 +188,7 @@ do
if EventData.IniDCSUnitName == self.Target:GetName() then
self:E( {"Target dead ", self.Target:GetName() } )
self:Destroyed()
self:LaseOff( 0.1 )
self:LaseOff()
end
end
end
@@ -198,7 +202,7 @@ do
if self.Target:IsAlive() then
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/100):AddX(math.random(-100,100)/100):GetVec3() )
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
self:__Lasing( -0.05 )
self:__Lasing( -0.2 )
else
self:E( { "Target is not alive", self.Target:IsAlive() } )
end
@@ -214,6 +218,8 @@ do
self:E( {"Stopped lasing for ", self.Target:GetName() , SpotIR = self.SportIR, SpotLaser = self.SpotLaser } )
self.Lasing = false
self.SpotIR:destroy()
self.SpotLaser:destroy()
@@ -234,15 +240,7 @@ do
-- @param #SPOT self
-- @return #boolean true if it is lasing
function SPOT:IsLasing()
self:F2()
local Lasing = false
if self.SpotIR then
Lasing = true
end
return Lasing
return self.Lasing
end
end