Merge branch 'master' into develop

This commit is contained in:
Frank
2021-01-03 00:24:42 +01:00
13 changed files with 597 additions and 230 deletions

View File

@@ -13,7 +13,7 @@
--
-- ### Author: **FlightControl**
--
-- ### Contributions:
-- ### Contributions: **funkyfranky**
--
-- ===
--
@@ -22,6 +22,8 @@
--- @type UNIT
-- @field #string ClassName Name of the class.
-- @field #string UnitName Name of the unit.
-- @extends Wrapper.Controllable#CONTROLLABLE
--- For each DCS Unit object alive within a running mission, a UNIT wrapper object (instance) will be created within the _@{DATABASE} object.
@@ -87,6 +89,7 @@
-- @field #UNIT UNIT
UNIT = {
ClassName="UNIT",
UnitName=nil,
}
@@ -103,12 +106,18 @@ UNIT = {
--- Create a new UNIT from DCSUnit.
-- @param #UNIT self
-- @param #string UnitName The name of the DCS unit.
-- @return #UNIT
-- @return #UNIT self
function UNIT:Register( UnitName )
-- Inherit CONTROLLABLE.
local self = BASE:Inherit( self, CONTROLLABLE:New( UnitName ) )
-- Set unit name.
self.UnitName = UnitName
-- Set event prio.
self:SetEventPriority( 3 )
return self
end
@@ -373,6 +382,32 @@ function UNIT:GetPlayerName()
end
--- Checks is the unit is a *Player* or *Client* slot.
-- @param #UNIT self
-- @return #boolean If true, unit is a player or client aircraft
function UNIT:IsClient()
if _DATABASE.CLIENTS[self.UnitName] then
return true
end
return false
end
--- Get the CLIENT of the unit
-- @param #UNIT self
-- @return Wrapper.Client#CLIENT
function UNIT:GetClient()
local client=_DATABASE.CLIENTS[self.UnitName]
if client then
return client
end
return nil
end
--- Returns the unit's number in the group.
-- The number is the same number the unit has in ME.
-- It may not be changed during the mission.