AI_PATROL:
- Target unit is nil. Issue #1234
DETECTION:
- ReportFriendliesNearBy ForEachPlayer added nil check.
CONTROLLABLE:
- Added IsHelicopter()
- Added OptionRestrictBurner()
AI_A2A_Cap
- AtteckUnit not nil check.
AI_A2A_Dispatcher:
- DefenderGroup not nil and alive check #1228
AI_A2A_GCICAP:
- AttackCoordinate nil check
This commit is contained in:
Frank
2019-11-25 11:50:07 +01:00
parent 60042e14dc
commit 169c5a674c
5 changed files with 160 additions and 88 deletions

View File

@@ -3480,3 +3480,48 @@ function CONTROLLABLE:IsAirPlane()
return nil
end
--- Returns if the Controllable contains Helicopters.
-- @param #CONTROLLABLE self
-- @return #boolean true if Controllable contains Helicopters.
function CONTROLLABLE:IsHelicopter()
self:F2()
local DCSObject = self:GetDCSObject()
if DCSObject then
local Category = DCSObject:getDesc().category
return Category == Unit.Category.HELICOPTER
end
return nil
end
--- Sets Controllable Option for Restriction of Afterburner.
-- @param #CONTROLLABLE self
-- @param #boolean RestrictBurner If true, restrict burner. If false or nil, allow (unrestrict) burner.
function CONTROLLABLE:OptionRestrictBurner(RestrictBurner)
self:F2({self.ControllableName})
local DCSControllable = self:GetDCSObject()
if DCSControllable then
local Controller = self:_GetController()
if Controller then
-- Issue https://github.com/FlightControl-Master/MOOSE/issues/1216
if RestrictBurner == true then
if self:IsAir() then
Controller:setOption(16, true)
end
else
if self:IsAir() then
Controller:setOption(16, false)
end
end
end
end
end