mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2026-08-31 11:56:37 +00:00
Added DCSEx.world.getFirstPlayer function
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
-- DCSEx.world.getClosestPointOnRoadsVec2(vec2)
|
-- DCSEx.world.getClosestPointOnRoadsVec2(vec2)
|
||||||
-- DCSEx.world.getCoordinatesAsString(point, hideElevation)
|
-- DCSEx.world.getCoordinatesAsString(point, hideElevation)
|
||||||
-- DCSEx.world.getCurrentMarkerID()
|
-- DCSEx.world.getCurrentMarkerID()
|
||||||
|
-- DCSEx.world.getFirstPlayer(side)
|
||||||
-- DCSEx.world.getGroupByID(groupID)
|
-- DCSEx.world.getGroupByID(groupID)
|
||||||
-- DCSEx.world.getGroupCenter(group)
|
-- DCSEx.world.getGroupCenter(group)
|
||||||
-- DCSEx.world.getMarkerByText(text, coalition)
|
-- DCSEx.world.getMarkerByText(text, coalition)
|
||||||
@@ -232,6 +233,24 @@ do
|
|||||||
return nextMarkerId - 1
|
return nextMarkerId - 1
|
||||||
end
|
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
|
-- Searches and return a group by its ID
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user