Interface IMyPlayerCollection
ModAPI interface giving control on players
Namespace: VRage.Game.ModAPI
Assembly: VRage.Game.dll
Syntax
public interface IMyPlayerCollection
Properties
Count
Gets amount of players online
Declaration
long Count { get; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
Methods
ExtendControl(IMyControllableEntity, IMyEntity)
Control extension and reduction is a mechanism that saves the control of other entities than IMyControllableEntities. A typical example is a cockpit inside a cube grid - you control the cockpit, but you want to "extend" the control to the cube grid as well. You can extend the control multiple times, but you always have to extend from the "base" entity, i.e. the cockpit in our example. The same goes for control reduction: always reduce to the "base" entity
Declaration
void ExtendControl(IMyControllableEntity entityWithControl, IMyEntity entityGettingControl)
Parameters
| Type | Name | Description |
|---|---|---|
| IMyControllableEntity | entityWithControl | Entity that already control. Example: cockpit |
| IMyEntity | entityGettingControl | Entity that would get control. Example: grid |
Remarks
GetAllIdentites(List<IMyIdentity>, Func<IMyIdentity, Boolean>)
Get all registered identities: players that at least once visited server, bots, and online players
Declaration
void GetAllIdentites(List<IMyIdentity> identities, Func<IMyIdentity, bool> collect = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<IMyIdentity> | identities | List that would receive results |
| System.Func<IMyIdentity, System.Boolean> | collect | When null, or returns true, list would add identity |
GetPlayerControllingEntity(IMyEntity)
Gets player that controls entity
Declaration
IMyPlayer GetPlayerControllingEntity(IMyEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| IMyEntity | entity | Entity to test |
Returns
| Type | Description |
|---|---|
| IMyPlayer | Player that controls |
GetPlayers(List<IMyPlayer>, Func<IMyPlayer, Boolean>)
Gets list of currently connected players
Declaration
void GetPlayers(List<IMyPlayer> players, Func<IMyPlayer, bool> collect = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<IMyPlayer> | players | List, that would receive connected players |
| System.Func<IMyPlayer, System.Boolean> | collect | When null, or returns true, |
HasExtendedControl(IMyControllableEntity, IMyEntity)
Gets whether player controls both entities
Declaration
bool HasExtendedControl(IMyControllableEntity firstEntity, IMyEntity secondEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| IMyControllableEntity | firstEntity | First entity |
| IMyEntity | secondEntity | Second entity |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if both entities under control of one player |
ReduceControl(IMyControllableEntity, IMyEntity)
Control extension and reduction is a mechanism that saves the control of other entities than IMyControllableEntities. A typical example is a cockpit inside a cube grid - you control the cockpit, but you want to "extend" the control to the cube grid as well. You can extend the control multiple times, but you always have to extend from the "base" entity, i.e. the cockpit in our example. The same goes for control reduction: always reduce to the "base" entity
Declaration
void ReduceControl(IMyControllableEntity entityWhichKeepsControl, IMyEntity entityWhichLoosesControl)
Parameters
| Type | Name | Description |
|---|---|---|
| IMyControllableEntity | entityWhichKeepsControl | Entity that would keep control. Example: cockpit |
| IMyEntity | entityWhichLoosesControl | Entity that would loose control. Example: grid |
Remarks
RemoveControlledEntity(IMyEntity)
Removes control from entity
Declaration
void RemoveControlledEntity(IMyEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| IMyEntity | entity | Entity that should loose control |
RequestChangeBalance(Int64, Int64)
Requests change of the balance (money) for specific identity id
Declaration
void RequestChangeBalance(long identityId, long amount)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | identityId | identity id |
| System.Int64 | amount | amount to be added/subtracted |
SetControlledEntity(UInt64, IMyEntity)
Set entity controlled by player. Functions ExtendControl(IMyControllableEntity, IMyEntity) and TryExtendControl(IMyControllableEntity, IMyEntity) using this function.
Declaration
void SetControlledEntity(ulong steamUserId, IMyEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | steamUserId | Player steam user id |
| IMyEntity | entity | Entity that should gain control |
TryExtendControl(IMyControllableEntity, IMyEntity)
Control extension and reduction is a mechanism that saves the control of other entities than IMyControllableEntities. A typical example is a cockpit inside a cube grid - you control the cockpit, but you want to "extend" the control to the cube grid as well. You can extend the control multiple times, but you always have to extend from the "base" entity, i.e. the cockpit in our example. The same goes for control reduction: always reduce to the "base" entity
Declaration
void TryExtendControl(IMyControllableEntity entityWithControl, IMyEntity entityGettingControl)
Parameters
| Type | Name | Description |
|---|---|---|
| IMyControllableEntity | entityWithControl | Entity that already control. Example: cockpit |
| IMyEntity | entityGettingControl | Entity that would get control. Example: grid |
Remarks
TryGetIdentityId(Int64)
Gets player for identity
Declaration
IMyPlayer TryGetIdentityId(long identity)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | identity | Identity id of player |
Returns
| Type | Description |
|---|---|
| IMyPlayer | Player, or null |
TryGetIdentityId(UInt64)
Gets identity for steamId
Declaration
long TryGetIdentityId(ulong steamId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | steamId | Player steam id |
Returns
| Type | Description |
|---|---|
| System.Int64 | IdentityId, or 0 |
TryGetSteamId(Int64)
Gets steamId for passed identityId
Declaration
ulong TryGetSteamId(long identityId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | identityId |
Returns
| Type | Description |
|---|---|
| System.UInt64 | Steam Id |
TryReduceControl(IMyControllableEntity, IMyEntity)
Control extension and reduction is a mechanism that saves the control of other entities than IMyControllableEntities. A typical example is a cockpit inside a cube grid - you control the cockpit, but you want to "extend" the control to the cube grid as well. You can extend the control multiple times, but you always have to extend from the "base" entity, i.e. the cockpit in our example. The same goes for control reduction: always reduce to the "base" entity
Declaration
bool TryReduceControl(IMyControllableEntity entityWhichKeepsControl, IMyEntity entityWhichLoosesControl)
Parameters
| Type | Name | Description |
|---|---|---|
| IMyControllableEntity | entityWhichKeepsControl | |
| IMyEntity | entityWhichLoosesControl |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if control was reduced |
Remarks
Events
ItemConsumed
Called when consumable item was consumed
Declaration
event Action<IMyCharacter, MyDefinitionId> ItemConsumed
Event Type
| Type | Description |
|---|---|
| System.Action<IMyCharacter, MyDefinitionId> |