Merge pull request #1540 from FlightControl-Master/Applevangelist-submarine

Update Controllable.lua
This commit is contained in:
Frank 2021-05-28 22:29:59 +02:00 committed by GitHub
commit 2d7e7d55a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3817,10 +3817,30 @@ function CONTROLLABLE:OptionDisperseOnAttack(Seconds)
local Controller = self:_GetController() local Controller = self:_GetController()
if Controller then if Controller then
if self:IsGround() then if self:IsGround() then
self:SetOption(AI.Option.GROUND.id.DISPERSE_ON_ATTACK, seconds) self:SetOption(AI.Option.Ground.id.DISPERSE_ON_ATTACK, seconds)
end end
end end
return self return self
end end
return nil return nil
end end
--- Returns if the unit is a submarine.
-- @param #POSITIONABLE self
-- @return #boolean Submarines attributes result.
function POSITIONABLE:IsSubmarine()
self:F2()
local DCSUnit = self:GetDCSObject()
if DCSUnit then
local UnitDescriptor = DCSUnit:getDesc()
if UnitDescriptor.attributes["Submarines"] == true then
return true
else
return false
end
end
return nil
end