This commit is contained in:
FlightControl
2017-01-13 19:57:30 +01:00
parent 8439708cca
commit 54c3549bac
16 changed files with 4914 additions and 61150 deletions

View File

@@ -439,15 +439,11 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
EngageRoute[#EngageRoute+1] = ToTargetRoutePoint
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
self.Controllable:WayPointInitialize( EngageRoute )
--- Do a trick, link the NewEngageRoute function of the PATROLGROUP object to the AIControllable in a temporary variable ...
self.Controllable:SetState( self.Controllable, "EngageZone", self )
self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" )
--- NOW ROUTE THE GROUP!
self.Controllable:WayPointExecute( 1, 5 )
Controllable:OptionROEOpenFire()
Controllable:OptionROTPassiveDefense()
local AttackTasks = {}
local DetectedTargets = Controllable:GetDetectedTargets()
for TargetID, Target in pairs( DetectedTargets ) do
@@ -459,16 +455,26 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
local TargetUnitName = TargetUnit:GetName()
if TargetUnit:IsInZone( self.EngageZone ) then
self:E( {"Engaging ", TargetUnit } )
--local EngageTask = Controllable:EnRouteTaskEngageUnit( TargetUnit, 1 )
local EngageTask = Controllable:TaskAttackUnit( TargetUnit )
Controllable:PushTask( EngageTask, 1 )
AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( TargetUnit )
end
end
end
EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
self.Controllable:WayPointInitialize( EngageRoute )
Controllable:OptionROEWeaponFree()
Controllable:OptionROTPassiveDefense()
--- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ...
self.Controllable:SetState( self.Controllable, "EngageZone", self )
self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" )
--- NOW ROUTE THE GROUP!
self.Controllable:WayPointExecute( 1, 5 )
end
end

View File

@@ -492,17 +492,20 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, WeaponType, WeaponExpend, Atta
local DCSTask
DCSTask = { id = 'AttackUnit',
params = {
altitudeEnabled = false,
unitId = AttackUnit:GetID(),
weaponType = WeaponType,
expend = WeaponExpend,
attackQty = AttackQty,
direction = Direction,
attackQtyLimit = AttackQtyLimit,
controllableAttack = ControllableAttack,
attackQtyLimit = AttackQtyLimit or false,
attackQty = AttackQty or 1,
expend = WeaponExpend or "Auto",
altitude = 2000,
directionEnabled = false,
groupAttack = false,
weaponType = WeaponType or 1073741822,
direction = Direction or 0,
},
},
self:T3( { DCSTask } )
self:E( { DCSTask } )
return DCSTask
end