mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 00:32:43 +00:00
Add GetPlayerPosition() and GetPlayerReady() to api
This commit is contained in:
parent
5f92d5d4bf
commit
8c76f4f4d0
@ -37,6 +37,19 @@ public interface IQSBAPI
|
||||
/// <param name="playerID">The ID of the player you want the name of.</param>
|
||||
string GetPlayerName(uint playerID);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the position of a given player.
|
||||
/// This position is in world space, where (0, 0, 0) is roughly where the local player is located.
|
||||
/// </summary>
|
||||
/// <param name="playerID">The ID of the player you want the position of.</param>
|
||||
Vector3 GetPlayerPosition(uint playerID);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if a given player has fully loaded into the game. If the local player is still loading into the game, this will return false.
|
||||
/// </summary>
|
||||
/// <param name="playerID">The ID of the player.</param>
|
||||
bool GetPlayerReady(uint playerID);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the list of IDs of all connected players.
|
||||
///
|
||||
|
@ -25,6 +25,13 @@ public class QSBAPI : IQSBAPI
|
||||
|
||||
public uint GetLocalPlayerID() => QSBPlayerManager.LocalPlayerId;
|
||||
public string GetPlayerName(uint playerId) => QSBPlayerManager.GetPlayer(playerId).Name;
|
||||
public Vector3 GetPlayerPosition(uint playerId) => QSBPlayerManager.GetPlayer(playerId).Body.transform.position;
|
||||
|
||||
public bool GetPlayerReady(uint playerId)
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(playerId);
|
||||
return player.IsReady && player.Body != null;
|
||||
}
|
||||
public uint[] GetPlayerIDs() => QSBPlayerManager.PlayerList.Select(x => x.PlayerId).ToArray();
|
||||
|
||||
public UnityEvent<uint> OnPlayerJoin() => QSBAPIEvents.OnPlayerJoinEvent;
|
||||
|
Loading…
x
Reference in New Issue
Block a user