Interface IMyPlayer
Namespace: VRage.Game.ModAPI
Assembly: VRage.Game.dll
Syntax
public interface IMyPlayer
Properties
BuildColorSlots
Gets or sets all the player's build color slots
Declaration
List<Vector3> BuildColorSlots { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<Vector3> |
Remarks
Not synced.
Character
Gets the Character entity for the player.
Declaration
IMyCharacter Character { get; }
Property Value
Type | Description |
---|---|
IMyCharacter |
Client
Gets network client for this player. Used for sending network messages between players and server
Declaration
IMyNetworkClient Client { get; }
Property Value
Type | Description |
---|---|
IMyNetworkClient |
Controller
Gets the EntityController for the player.
Declaration
IMyEntityController Controller { get; }
Property Value
Type | Description |
---|---|
IMyEntityController |
DefaultBuildColorSlots
Gets the list of the default build colors.
Declaration
ListReader<Vector3> DefaultBuildColorSlots { get; }
Property Value
Type | Description |
---|---|
ListReader<Vector3> |
DisplayName
Visible player name
Declaration
string DisplayName { get; }
Property Value
Type | Description |
---|---|
System.String |
Grids
List of grids where the player owns at least one block.
Declaration
HashSet<long> Grids { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.HashSet<System.Int64> |
Remarks
Not synced.
Identity
Gets the identity for the player
Declaration
IMyIdentity Identity { get; }
Property Value
Type | Description |
---|---|
IMyIdentity |
IdentityId
Unique id for the current player identity.
Declaration
long IdentityId { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Remarks
This will change when the player dies with permadeath enabled.
IsAdmin
Gets if the player is an admin on the server.
Declaration
bool IsAdmin { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsBot
Gets if the player is a bot (non-human)
Declaration
bool IsBot { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsPromoted
Gets if the player is promoted to Space Master.
Declaration
bool IsPromoted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
PlayerID
Declaration
long PlayerID { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
PromoteLevel
Gets the player's promote level
Declaration
MyPromoteLevel PromoteLevel { get; }
Property Value
Type | Description |
---|---|
MyPromoteLevel |
RespawnShip
Gets the entity id for the player's respawn ship(s).
Declaration
ListReader<long> RespawnShip { get; }
Property Value
Type | Description |
---|---|
ListReader<System.Int64> |
SelectedBuildColor
Gets or sets the build color for the selected slot.
Declaration
Vector3 SelectedBuildColor { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Remarks
Not synced.
SelectedBuildColorSlot
Gets or sets the selected slot for the build color.
Declaration
int SelectedBuildColorSlot { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Not synced.
SteamUserId
Gets the Steam user id for the player.
Declaration
ulong SteamUserId { get; }
Property Value
Type | Description |
---|---|
System.UInt64 |
Methods
AddGrid(Int64)
Adds a grid to the player's Grids list.
Declaration
void AddGrid(long gridEntityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | gridEntityId |
ChangeOrSwitchToColor(Vector3)
Switches to slot containing color, if present. Otherwise sets active slot to color.
Declaration
void ChangeOrSwitchToColor(Vector3 color)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | color | New current painting color |
Remarks
Not synced.
GetBalanceShortString()
Gets balance of an account associated with player. Format is 'BALANCE CURRENCYSHORTNAME'.
Declaration
string GetBalanceShortString()
Returns
Type | Description |
---|---|
System.String | Current balance of the account in form of formatted string. If Banking System does not exist method returns null. |
GetPosition()
Gets the position of controlled entity. Grid/Character
Declaration
Vector3D GetPosition()
Returns
Type | Description |
---|---|
Vector3D | World coordinates of controlled entity |
GetRelationTo(Int64)
Gets the relationship between this player and another.
Declaration
MyRelationsBetweenPlayerAndBlock GetRelationTo(long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | playerId | Player to test relationship against |
Returns
Type | Description |
---|---|
MyRelationsBetweenPlayerAndBlock | Relations |
RemoveGrid(Int64)
Removes a grid from the player's Grids list.
Declaration
void RemoveGrid(long gridEntityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | gridEntityId |
RequestChangeBalance(Int64)
Changes the balance of the account of this player by given amount. Sends a message to server with the request.
Declaration
void RequestChangeBalance(long amount)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | amount | Amount by which to change te balance. |
SetDefaultColors()
Sets build colors back to defaults.
Declaration
void SetDefaultColors()
SpawnAt(MatrixD, Vector3, IMyEntity)
Spawns the player at a specific place. Must be called on server.
Declaration
void SpawnAt(MatrixD worldMatrix, Vector3 velocity, IMyEntity spawnedBy)
Parameters
Type | Name | Description |
---|---|---|
MatrixD | worldMatrix | Spawn position |
Vector3 | velocity | Velocity to provide to player |
IMyEntity | spawnedBy | Entity triggering respawn (can be null) |
SpawnAt(MatrixD, Vector3, IMyEntity, Boolean, String, Nullable<Color>)
Spawns the player at a specific place. Must be called on server.
Declaration
void SpawnAt(MatrixD worldMatrix, Vector3 velocity, IMyEntity spawnedBy, bool findFreePlace = true, string modelName = null, Nullable<Color> color = null)
Parameters
Type | Name | Description |
---|---|---|
MatrixD | worldMatrix | Spawn position |
Vector3 | velocity | Velocity to provide to player |
IMyEntity | spawnedBy | Entity triggering respawn (can be null) |
System.Boolean | findFreePlace | Find a safe place to spawn near the position |
System.String | modelName | Model of character. Use null for using player's default color |
System.Nullable<Color> | color | Character color. Use null for using player's default color |
SpawnIntoCharacter(IMyCharacter)
Spawns the player as a new character (changes the model).
Declaration
void SpawnIntoCharacter(IMyCharacter character)
Parameters
Type | Name | Description |
---|---|---|
IMyCharacter | character | New character to use |
TryGetBalanceInfo(out Int64)
Gets balance of an account associated with player.
Declaration
bool TryGetBalanceInfo(out long balance)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | balance | Returns current balance of the account. (If called on client, can return delayed value, as changes to balance have to be synchronized first) |
Returns
Type | Description |
---|---|
System.Boolean | True if account was found. Otherwise false. |
Events
IdentityChanged
Event triggered when the player's identity changed (eg. died w/permadeath on)
Declaration
event Action<IMyPlayer, IMyIdentity> IdentityChanged
Event Type
Type | Description |
---|---|
System.Action<IMyPlayer, IMyIdentity> |