mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2025-11-25 19:31:01 +00:00
Added DCSEx.world.getFirstPlayer function
This commit is contained in:
parent
25ba1ccd2e
commit
e840bc3b0d
@ -10,6 +10,7 @@
|
||||
-- DCSEx.world.getClosestPointOnRoadsVec2(vec2)
|
||||
-- DCSEx.world.getCoordinatesAsString(point, hideElevation)
|
||||
-- DCSEx.world.getCurrentMarkerID()
|
||||
-- DCSEx.world.getFirstPlayer(side)
|
||||
-- DCSEx.world.getGroupByID(groupID)
|
||||
-- DCSEx.world.getGroupCenter(group)
|
||||
-- DCSEx.world.getMarkerByText(text, coalition)
|
||||
@ -232,6 +233,24 @@ do
|
||||
return nextMarkerId - 1
|
||||
end
|
||||
|
||||
-------------------------------------
|
||||
-- Returns the first player found
|
||||
-------------------------------------
|
||||
-- @param side The coalition the player must belong to, or nil to search for any player
|
||||
-- @return A player unit object, or nil if no player was found
|
||||
-------------------------------------
|
||||
function DCSEx.world.getFirstPlayer(side)
|
||||
local players = {}
|
||||
if side then
|
||||
players = coalition.getPlayers(side)
|
||||
else
|
||||
players = DCSEx.world.getAllPlayers()
|
||||
end
|
||||
|
||||
if not players or #players == 0 then return nil end
|
||||
return players[1]
|
||||
end
|
||||
|
||||
-------------------------------------
|
||||
-- Searches and return a group by its ID
|
||||
-------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user