mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Finish this feature.
This commit is contained in:
@@ -1430,6 +1430,26 @@ do -- Players
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--- Get the active player count in the group.
|
||||
-- @param #GROUP self
|
||||
-- @return #number The amount of players.
|
||||
function GROUP:GetPlayerCount()
|
||||
|
||||
local PlayerCount = 0
|
||||
|
||||
local Units = self:GetUnits()
|
||||
for UnitID, UnitData in pairs( Units or {} ) do
|
||||
local Unit = UnitData -- Wrapper.Unit#UNIT
|
||||
local PlayerName = Unit:GetPlayerName()
|
||||
if PlayerName and PlayerName ~= "" then
|
||||
PlayerCount = PlayerCount + 1
|
||||
end
|
||||
end
|
||||
|
||||
return PlayerCount
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ function UNIT:GetPlayerName()
|
||||
if DCSUnit then
|
||||
|
||||
local PlayerName = DCSUnit:getPlayerName()
|
||||
-- TODO - Workaround for DCS-BUG-3
|
||||
-- TODO Workaround DCS-BUG-3 - https://github.com/FlightControl-Master/MOOSE/issues/696
|
||||
if PlayerName == nil or PlayerName == "" then
|
||||
local PlayerCategory = DCSUnit:getDesc().category
|
||||
if PlayerCategory == Unit.Category.GROUND_UNIT or PlayerCategory == Unit.Category.SHIP then
|
||||
|
||||
Reference in New Issue
Block a user