get player units fixed
This commit is contained in:
@@ -743,8 +743,8 @@ do -- INIT DCS_UTIL
|
|||||||
---@return table units
|
---@return table units
|
||||||
function DCS_UTIL.getAllPlayerUnits()
|
function DCS_UTIL.getAllPlayerUnits()
|
||||||
local units = {}
|
local units = {}
|
||||||
for key, value in pairs({ 0, 1, 2 }) do
|
for i = 0,2 do
|
||||||
local players = coalition.getPlayers(value)
|
local players = coalition.getPlayers(i)
|
||||||
for key, unit in pairs(players) do
|
for key, unit in pairs(players) do
|
||||||
units[#units + 1] = unit
|
units[#units + 1] = unit
|
||||||
end
|
end
|
||||||
@@ -786,29 +786,6 @@ do -- INIT DCS_UTIL
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
---Gets all groups that have players
|
|
||||||
---@return table groups
|
|
||||||
function DCS_UTIL.getAllPlayerGroups()
|
|
||||||
local groupNames = {}
|
|
||||||
local result = {}
|
|
||||||
for key, value in pairs({ 0, 1, 2 }) do
|
|
||||||
local players = coalition.getPlayers(value)
|
|
||||||
for key, unit in pairs(players) do
|
|
||||||
local group = unit:getGroup()
|
|
||||||
if group ~= nil then
|
|
||||||
local name = group:getName()
|
|
||||||
if name ~= nil then
|
|
||||||
if groupNames[name] ~= nil then
|
|
||||||
groupNames[name] = 1
|
|
||||||
table.insert(result, group)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
--- spawns the units as specified in the mission file itself
|
--- spawns the units as specified in the mission file itself
|
||||||
--- location and route can be nil and will then use default route
|
--- location and route can be nil and will then use default route
|
||||||
---@param groupName string
|
---@param groupName string
|
||||||
|
|||||||
Reference in New Issue
Block a user