mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixes
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user