mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Progress
This commit is contained in:
parent
f4fd7d43f3
commit
a79bc11834
@ -237,6 +237,9 @@ do -- AI_DESIGNATE
|
||||
|
||||
self:SetLaserCodes( 1688 )
|
||||
|
||||
self.LaserCodesUsed = {}
|
||||
|
||||
|
||||
self.Detection:__Start( 2 )
|
||||
|
||||
|
||||
@ -253,6 +256,8 @@ do -- AI_DESIGNATE
|
||||
|
||||
self.LaserCodes = ( type( LaserCodes ) == "table" ) and LaserCodes or { LaserCodes }
|
||||
self:E(self.LaserCodes)
|
||||
|
||||
self.LaserCodesUsed = {}
|
||||
|
||||
return self
|
||||
end
|
||||
@ -330,39 +335,35 @@ do -- AI_DESIGNATE
|
||||
DesignateMenu
|
||||
)
|
||||
|
||||
if self.Spots[Index] then
|
||||
|
||||
MENU_GROUP_COMMAND:New(
|
||||
AttackGroup,
|
||||
"Switch laser Off",
|
||||
DetectedMenu,
|
||||
self.MenuLaseOff,
|
||||
self,
|
||||
AttackGroup,
|
||||
Index
|
||||
)
|
||||
else
|
||||
MENU_GROUP_COMMAND:New(
|
||||
AttackGroup,
|
||||
"Lase target 60 secs",
|
||||
DetectedMenu,
|
||||
self.MenuLaseOn,
|
||||
self,
|
||||
AttackGroup,
|
||||
Index,
|
||||
60
|
||||
)
|
||||
MENU_GROUP_COMMAND:New(
|
||||
AttackGroup,
|
||||
"Lase target 120 secs",
|
||||
DetectedMenu,
|
||||
self.MenuLaseOn,
|
||||
self,
|
||||
AttackGroup,
|
||||
Index,
|
||||
120
|
||||
)
|
||||
end
|
||||
MENU_GROUP_COMMAND:New(
|
||||
AttackGroup,
|
||||
"Lase target 60 secs",
|
||||
DetectedMenu,
|
||||
self.MenuLaseOn,
|
||||
self,
|
||||
AttackGroup,
|
||||
Index,
|
||||
60
|
||||
)
|
||||
MENU_GROUP_COMMAND:New(
|
||||
AttackGroup,
|
||||
"Lase target 120 secs",
|
||||
DetectedMenu,
|
||||
self.MenuLaseOn,
|
||||
self,
|
||||
AttackGroup,
|
||||
Index,
|
||||
120
|
||||
)
|
||||
MENU_GROUP_COMMAND:New(
|
||||
AttackGroup,
|
||||
"Switch laser Off",
|
||||
DetectedMenu,
|
||||
self.MenuLaseOff,
|
||||
self,
|
||||
AttackGroup,
|
||||
Index
|
||||
)
|
||||
|
||||
MENU_GROUP_COMMAND:New(
|
||||
AttackGroup,
|
||||
@ -425,32 +426,37 @@ do -- AI_DESIGNATE
|
||||
function AI_DESIGNATE:onafterLasing( From, Event, To, AttackGroup, Index, Duration )
|
||||
|
||||
local TargetSetUnit = self.Detection:GetDetectedSet( Index )
|
||||
|
||||
|
||||
local Targets = false
|
||||
|
||||
TargetSetUnit:ForEachUnit(
|
||||
--- @param Wrapper.Unit#UNIT SmokeUnit
|
||||
function( SmokeUnit )
|
||||
function( TargetUnit )
|
||||
self:E("In procedure")
|
||||
--if math.random( 1, ( 100 * TargetSetUnit:Count() ) / 100 ) <= 100 then
|
||||
if SmokeUnit:IsAlive() then
|
||||
local NearestRecceGroup = self.RecceSet:FindNearestGroupFromPointVec2( SmokeUnit:GetPointVec2() )
|
||||
if NearestRecceGroup then
|
||||
for UnitID, UnitData in pairs( NearestRecceGroup:GetUnits() or {} ) do
|
||||
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
||||
Targets = true
|
||||
if RecceUnit:IsLasing() == false then
|
||||
self.Spots[Index] = self.Spots[Index] or {}
|
||||
local Spots = self.Spots[Index]
|
||||
local LaserCode = self.LaserCodes[math.random(1, #self.LaserCodes)]
|
||||
local Spot = RecceUnit:LaseUnit( SmokeUnit, LaserCode, Duration )
|
||||
Spots[RecceUnit] = Spot
|
||||
RecceUnit:MessageToGroup( "Lasing " .. SmokeUnit:GetTypeName() .. " for " .. Duration .. " seconds. Laser Code: " .. Spot.LaserCode, 15, AttackGroup )
|
||||
break
|
||||
else
|
||||
if TargetUnit:IsAlive() then
|
||||
local Spot = self.Spots[TargetUnit]
|
||||
if (not Spot) or ( Spot and Spot:IsLasing() == false ) then
|
||||
local NearestRecceGroup = self.RecceSet:FindNearestGroupFromPointVec2( TargetUnit:GetPointVec2() )
|
||||
if NearestRecceGroup then
|
||||
for UnitID, UnitData in pairs( NearestRecceGroup:GetUnits() or {} ) do
|
||||
local RecceUnit = UnitData -- Wrapper.Unit#UNIT
|
||||
Targets = true
|
||||
if RecceUnit:IsLasing() == false then
|
||||
local LaserCode = self.LaserCodes[math.random(1, #self.LaserCodes)]
|
||||
local Spot = RecceUnit:LaseUnit( TargetUnit, LaserCode, Duration )
|
||||
self.Spots[TargetUnit] = Spot
|
||||
RecceUnit:MessageToGroup( "Lasing " .. TargetUnit:GetTypeName() .. " for " .. Duration .. " seconds. Laser Code: " .. Spot.LaserCode, 15, AttackGroup )
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local RecceUnit = Spot.Recce
|
||||
RecceUnit:MessageToGroup( "Lasing " .. TargetUnit:GetTypeName() .. " for " .. Duration .. " seconds. Laser Code: " .. Spot.LaserCode, 15, AttackGroup )
|
||||
end
|
||||
else
|
||||
self.Spots[TargetUnit] = nil
|
||||
end
|
||||
--end
|
||||
end
|
||||
@ -473,7 +479,7 @@ do -- AI_DESIGNATE
|
||||
|
||||
local TargetSetUnit = self.Detection:GetDetectedSet( Index )
|
||||
|
||||
local Spots = self.Spots[Index]
|
||||
local Spots = self.Spots
|
||||
|
||||
for SpotID, SpotData in pairs( Spots ) do
|
||||
local Spot = SpotData -- Core.Spot#SPOT
|
||||
@ -482,7 +488,7 @@ do -- AI_DESIGNATE
|
||||
end
|
||||
|
||||
Spots = nil
|
||||
self.Spots[Index] = nil
|
||||
self.Spots = {}
|
||||
|
||||
self:SetDesignateMenu()
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user