Merge pull request #1132 from FlightControl-Master/FF/Develop

AIRBOSS v0.9.9.5
This commit is contained in:
Frank
2019-03-20 22:17:15 +01:00
committed by GitHub
3 changed files with 560 additions and 135 deletions

View File

@@ -952,10 +952,12 @@ function GROUP:GetFuelMin()
local tmp = nil
for UnitID, UnitData in pairs( self:GetUnits() ) do
tmp = UnitData:GetFuel()
if tmp < min then
min = tmp
unit = UnitData
if UnitData and UnitData:IsAlive() then
tmp = UnitData:GetFuel()
if tmp < min then
min = tmp
unit = UnitData
end
end
end

View File

@@ -318,6 +318,30 @@ function UNIT:GetCallsign()
return nil
end
--- Check if an (air) unit is a client or player slot. Information is retrieved from the group template.
-- @param #UNIT self
-- @return #boolean If true, unit is associated with a client or player slot.
function UNIT:IsPlayer()
-- Get group.
local group=self:GetGroup()
-- Units of template group.
local units=group:GetTemplate().units
-- Get numbers.
for _,unit in pairs(units) do
-- Check if unit name matach and skill is Client or Player.
if unit.name==self:GetName() and (unit.skill=="Client" or unit.skill=="Player") then
return true
end
end
return false
end
--- Returns name of the player that control the unit or nil if the unit is controlled by A.I.
-- @param #UNIT self