This commit is contained in:
Frank
2020-03-14 18:38:52 +01:00
parent e147a4c604
commit 9f14ed7a5c
4 changed files with 88 additions and 7 deletions
@@ -6704,8 +6704,8 @@ function WAREHOUSE:_CheckRequestValid(request)
-- TODO: maybe only check if spots > 0 for the necessary terminal type? At least for FARPS.
-- Get necessary terminal type.
local termtype_dep=self:_GetTerminal(asset.attribute, self:GetAirbaseCategory())
local termtype_des=self:_GetTerminal(asset.attribute, request.warehouse:GetAirbaseCategory())
local termtype_dep=asset.terminalType or self:_GetTerminal(asset.attribute, self:GetAirbaseCategory())
local termtype_des=asset.terminalType or self:_GetTerminal(asset.attribute, request.warehouse:GetAirbaseCategory())
-- Get number of parking spots.
local np_departure=self.airbase:GetParkingSpotsNumber(termtype_dep)
@@ -7495,7 +7495,7 @@ function WAREHOUSE:_FindParkingForAssets(airbase, assets)
local _asset=asset --#WAREHOUSE.Assetitem
-- Get terminal type of this asset
local terminaltype=self:_GetTerminal(asset.attribute, self:GetAirbaseCategory())
local terminaltype=asset.terminalType or self:_GetTerminal(asset.attribute, self:GetAirbaseCategory())
-- Asset specific parking.
parking[_asset.uid]={}
+5 -1
View File
@@ -879,7 +879,7 @@ function AIRWING:onafterNewAsset(From, Event, To, asset, assignment)
-- Debug text.
local text=string.format("New asset %s with assignment %s and request assignment %s", asset.spawngroupname, tostring(asset.assignment), tostring(assignment))
self:I(self.lid..text)
self:T3(self.lid..text)
-- Get squadron.
local squad=self:GetSquadron(asset.assignment)
@@ -893,6 +893,8 @@ function AIRWING:onafterNewAsset(From, Event, To, asset, assignment)
local text=string.format("Adding asset to squadron %s: assignment=%s, type=%s, attribute=%s", squad.name, assignment, asset.unittype, asset.attribute)
self:I(self.lid..text)
asset.terminalType=AIRBASE.TerminalType.OpenBig
-- Add asset to squadron.
table.insert(squad.assets, asset)
@@ -929,6 +931,8 @@ function AIRWING:onafterAssetSpawned(From, Event, To, group, asset, request)
-- Set RTB on fuel critical.
flightgroup:SetFuelCriticalThreshold(nil, true)
--flightgroup.group:OptionProhibitAfterburner(true)
-- Set asset flightgroup.
asset.flightgroup=flightgroup
+12 -3
View File
@@ -479,10 +479,13 @@ function AUFTRAG:NewBAI(TargetGroupSet)
mission.engageTargetGroupset=TargetGroupSet
mission.engageTargetGroupset:FilterDeads():FilterCrashes()
mission.DCStask=mission:GetDCSMissionTask()
mission.missionTask=ENUMS.MissionTask.GROUNDATTACK
mission.engageWeaponType=2956984318
mission.engageWeaponExpend=AI.Task.WeaponExpend.ALL
mission.DCStask=mission:GetDCSMissionTask()
return mission
end
@@ -498,10 +501,14 @@ function AUFTRAG:NewSTRIKE(TargetCoordinate, Altitude)
mission.engageCoord=TargetCoordinate
mission.engageAltitude=UTILS.FeetToMeters(Altitude or 1000)
mission.DCStask=mission:GetDCSMissionTask()
mission.missionTask=ENUMS.MissionTask.GROUNDATTACK
mission.engageWeaponType=2956984318
mission.engageWeaponExpend=AI.Task.WeaponExpend.ALL
mission.DCStask=mission:GetDCSMissionTask()
return mission
end
@@ -1430,6 +1437,8 @@ function AUFTRAG:GetTargetCoordinate()
return self.engageCoord
elseif self.orbitCoord then
return self.orbitCoord
elseif self.escortGroup then
return self.escortGroup:GetCoordinate()
end
return nil
@@ -3476,8 +3476,76 @@ function CONTROLLABLE:OptionKeepWeaponsOnThreat()
return nil
end
--- Prohibit Afterburner.
-- @param #CONTROLLABLE self
-- @param #boolean Prohibit If true or nil, prohibit. If false, do not prohibit.
-- @return #CONTROLLABLE self
function CONTROLLABLE:OptionProhibitAfterburner(Prohibit)
self:F2( { self.ControllableName } )
if Prohibit==nil then
Prohibit=true
end
if self:IsAir() then
self:SetOption(AI.Option.Air.id.PROHIBIT_AB, Prohibit)
end
return self
end
--- Defines the usage of Electronic Counter Measures by airborne forces. Disables the ability for AI to use their ECM.
-- @param #CONTROLLABLE self
-- @return #CONTROLLABLE self
function CONTROLLABLE:OptionECM_Never()
self:F2( { self.ControllableName } )
if self:IsAir() then
self:SetOption(AI.Option.Air.id.ECM_USING, 0)
end
return self
end
--- Defines the usage of Electronic Counter Measures by airborne forces. If the AI is actively being locked by an enemy radar they will enable their ECM jammer.
-- @param #CONTROLLABLE self
-- @return #CONTROLLABLE self
function CONTROLLABLE:OptionECM_OnlyLockByRadar()
self:F2( { self.ControllableName } )
if self:IsAir() then
self:SetOption(AI.Option.Air.id.ECM_USING, 1)
end
return self
end
--- Defines the usage of Electronic Counter Measures by airborne forces. If the AI is being detected by a radar they will enable their ECM.
-- @param #CONTROLLABLE self
-- @return #CONTROLLABLE self
function CONTROLLABLE:OptionECM_DetectedLockByRadar()
self:F2( { self.ControllableName } )
if self:IsAir() then
self:SetOption(AI.Option.Air.id.ECM_USING, 2)
end
return self
end
--- Defines the usage of Electronic Counter Measures by airborne forces. AI will leave their ECM on all the time.
-- @param #CONTROLLABLE self
-- @return #CONTROLLABLE self
function CONTROLLABLE:OptionECM_AlwaysOn()
self:F2( { self.ControllableName } )
if self:IsAir() then
self:SetOption(AI.Option.Air.id.ECM_USING, 3)
end
return self
end
--- Retrieve the controllable mission and allow to place function hooks within the mission waypoint plan.
-- Use the method @{Wrapper.Controllable#CONTROLLABLE:WayPointFunction} to define the hook functions for specific waypoints.