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
1cc89942d1
commit
8a5a33d191
@ -297,7 +297,7 @@ do -- AI_DESIGNATE
|
|||||||
self.Detection = Detection
|
self.Detection = Detection
|
||||||
self.AttackSet = AttackSet
|
self.AttackSet = AttackSet
|
||||||
self.RecceSet = Detection:GetDetectionSetGroup()
|
self.RecceSet = Detection:GetDetectionSetGroup()
|
||||||
self.Spots = {}
|
self.Recces = {}
|
||||||
self.Designating = {}
|
self.Designating = {}
|
||||||
|
|
||||||
self.LaseDuration = 60
|
self.LaseDuration = 60
|
||||||
@ -553,12 +553,12 @@ do -- AI_DESIGNATE
|
|||||||
|
|
||||||
TargetSetUnit:Flush()
|
TargetSetUnit:Flush()
|
||||||
|
|
||||||
for TargetUnit, SpotData in pairs( self.Spots ) do
|
for TargetUnit, RecceData in pairs( self.Recces ) do
|
||||||
local Spot = SpotData -- Core.Spot#SPOT
|
local Recce = RecceData -- Wrapper.Unit#UNIT
|
||||||
if not Spot:IsLasing() then
|
if not Recce:IsLasing() then
|
||||||
local LaserCode = Spot.LaserCode --(Not deleted when stopping with lasing).
|
local LaserCode = self.LaserCodesUsed[Recce] --(Not deleted when stopping with lasing).
|
||||||
self.LaserCodesUsed[LaserCode] = nil
|
self.LaserCodesUsed[LaserCode] = nil
|
||||||
self.Spots[TargetUnit] = nil
|
self.Recces[TargetUnit] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -567,8 +567,8 @@ do -- AI_DESIGNATE
|
|||||||
function( TargetUnit )
|
function( TargetUnit )
|
||||||
self:E("In procedure")
|
self:E("In procedure")
|
||||||
if TargetUnit:IsAlive() then
|
if TargetUnit:IsAlive() then
|
||||||
local Spot = self.Spots[TargetUnit]
|
local Recce = self.Recces[TargetUnit]
|
||||||
if (not Spot) or ( Spot and Spot:IsLasing() == false ) then
|
if (not Recce) or ( Recce and Recce:IsLasing() == false ) then
|
||||||
for RecceGroupID, RecceGroup in pairs( self.RecceSet:GetSet() ) do
|
for RecceGroupID, RecceGroup in pairs( self.RecceSet:GetSet() ) do
|
||||||
for UnitID, UnitData in pairs( RecceGroup:GetUnits() or {} ) do
|
for UnitID, UnitData in pairs( RecceGroup:GetUnits() or {} ) do
|
||||||
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
||||||
@ -577,37 +577,35 @@ do -- AI_DESIGNATE
|
|||||||
local LaserCodeIndex = math.random( 1, #self.LaserCodes )
|
local LaserCodeIndex = math.random( 1, #self.LaserCodes )
|
||||||
local LaserCode = self.LaserCodes[LaserCodeIndex]
|
local LaserCode = self.LaserCodes[LaserCodeIndex]
|
||||||
if not self.LaserCodesUsed[LaserCode] then
|
if not self.LaserCodesUsed[LaserCode] then
|
||||||
MoreTargets = true
|
|
||||||
self.LaserCodesUsed[LaserCode] = LaserCodeIndex
|
self.LaserCodesUsed[LaserCode] = LaserCodeIndex
|
||||||
local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration )
|
local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration )
|
||||||
function Spot:OnAfterDestroyed( From, Event, To )
|
function Spot:OnAfterDestroyed( From, Event, To )
|
||||||
self:E( "Destroyed Message" )
|
self:E( "Destroyed Message" )
|
||||||
self.Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() .. " destroyed." .. TargetSetUnit:Count() .. " targets left.", 15, self.AttackSet )
|
self.Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() .. " destroyed." .. TargetSetUnit:Count() .. " targets left.", 15, self.AttackSet )
|
||||||
end
|
end
|
||||||
self.Spots[TargetUnit] = Spot
|
self.Recces[TargetUnit] = RecceUnit
|
||||||
RecceUnit:MessageToSetGroup( "Lasing " .. TargetUnit:GetTypeName() .. " for " .. Duration .. "s, code: " .. Spot.LaserCode, 5, self.AttackSet )
|
RecceUnit:MessageToSetGroup( "Lasing " .. TargetUnit:GetTypeName() .. " for " .. Duration .. "s, code: " .. RecceUnit:GetSpot().LaserCode, 5, self.AttackSet )
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- The Recce is lasing, but the Target is not detected or within LOS. So stop lasing and send a report.
|
-- The Recce is lasing, but the Target is not detected or within LOS. So stop lasing and send a report.
|
||||||
if not RecceUnit:IsDetected( TargetUnit ) or not RecceUnit:IsLOS( TargetUnit ) then
|
if not RecceUnit:IsDetected( TargetUnit ) or not RecceUnit:IsLOS( TargetUnit ) then
|
||||||
local Spot = self.Spots[TargetUnit] -- Core.Spot#SPOT
|
local Recce = self.Recces[TargetUnit] -- Wrapper.Unit#UNIT
|
||||||
if Spot then
|
if Recce then
|
||||||
Spot.Recce:LaseOff()
|
Recce:LaseOff()
|
||||||
Spot.Recce:MessageToGroup( "Target " .. TargetUnit:GetTypeName() "out of LOS. Cancelling lase!", 5, self.AttackSet )
|
Recce:MessageToGroup( "Target " .. TargetUnit:GetTypeName() "out of LOS. Cancelling lase!", 5, self.AttackSet )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
MoreTargets = true
|
local RecceUnit = Recce.Recce
|
||||||
local RecceUnit = Spot.Recce
|
RecceUnit:MessageToSetGroup( "Lasing " .. TargetUnit:GetTypeName() .. ", code " .. Recce.LaserCode, 5, self.AttackSet )
|
||||||
RecceUnit:MessageToSetGroup( "Lasing " .. TargetUnit:GetTypeName() .. ", code " .. Spot.LaserCode, 5, self.AttackSet )
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.Spots[TargetUnit] = nil
|
self.Recces[TargetUnit] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@ -631,16 +629,16 @@ do -- AI_DESIGNATE
|
|||||||
|
|
||||||
local TargetSetUnit = self.Detection:GetDetectedSet( Index )
|
local TargetSetUnit = self.Detection:GetDetectedSet( Index )
|
||||||
|
|
||||||
local Spots = self.Spots
|
local Recces = self.Recces
|
||||||
|
|
||||||
for SpotID, SpotData in pairs( Spots ) do
|
for TargetID, RecceData in pairs( Recces ) do
|
||||||
local Spot = SpotData -- Core.Spot#SPOT
|
local Recce = RecceData -- Wrapper.Unit#UNIT
|
||||||
Spot.Recce:MessageToSetGroup( "Stopped lasing " .. Spot.Target:GetTypeName() .. ".", 15, self.AttackSet )
|
Recce:MessageToSetGroup( "Stopped lasing " .. Recce:GetSpot().Target:GetTypeName() .. ".", 15, self.AttackSet )
|
||||||
Spot:LaseOff()
|
Recce:LaseOff()
|
||||||
end
|
end
|
||||||
|
|
||||||
Spots = nil
|
Recces = nil
|
||||||
self.Spots = {}
|
self.Recces = {}
|
||||||
self.LaserCodesUsed = {}
|
self.LaserCodesUsed = {}
|
||||||
|
|
||||||
self:SetDesignateMenu()
|
self:SetDesignateMenu()
|
||||||
|
|||||||
@ -534,3 +534,11 @@ function POSITIONABLE:IsLasing()
|
|||||||
|
|
||||||
return Lasing
|
return Lasing
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- (R2.1) Get the Spot
|
||||||
|
-- @param #POSITIONABLE self
|
||||||
|
-- @return Core.Spot#SPOT The Spot
|
||||||
|
function POSITIONABLE:GetSpot()
|
||||||
|
|
||||||
|
return self.Spot
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user