Show / Hide Table of Contents

Interface IMySession

ModAPI giving access to MySession functions and properties for modders

Namespace: VRage.Game.ModAPI
Assembly: VRage.Game.dll
Syntax
public interface IMySession

Properties

AssemblerEfficiencyMultiplier

Gets game session global assembler efficiency multiplier

Declaration
float AssemblerEfficiencyMultiplier { get; }
Property Value
Type Description
System.Single

AssemblerSpeedMultiplier

Gets game session global assembler speed multiplier

Declaration
float AssemblerSpeedMultiplier { get; }
Property Value
Type Description
System.Single

AutoHealing

Gets if game settings allows auto healing

Declaration
bool AutoHealing { get; }
Property Value
Type Description
System.Boolean

AutoSaveInMinutes

Gets auto save game setting

Declaration
uint AutoSaveInMinutes { get; }
Property Value
Type Description
System.UInt32

BlocksInventorySizeMultiplier

Gets game session global block inventory size multiplier

Declaration
float BlocksInventorySizeMultiplier { get; }
Property Value
Type Description
System.Single

Camera

Gets current camera

Declaration
IMyCamera Camera { get; }
Property Value
Type Description
IMyCamera

CameraController

Gets current camera controller

Declaration
IMyCameraController CameraController { get; }
Property Value
Type Description
IMyCameraController

CameraTargetDistance

Gets or sets the third person camera distance.

Declaration
double CameraTargetDistance { get; set; }
Property Value
Type Description
System.Double

CargoShipsEnabled

Gets if game settings allows auto healing

Declaration
bool CargoShipsEnabled { get; }
Property Value
Type Description
System.Boolean

CharactersInventoryMultiplier

Gets game session global characters inventory size multiplier

Declaration
float CharactersInventoryMultiplier { get; }
Property Value
Type Description
System.Single

ClientCanSave

Declaration
bool ClientCanSave { get; }
Property Value
Type Description
System.Boolean

Config

Obtaining values from config is slow and can allocate memory! Do it only when necessary.

Declaration
IMyConfig Config { get; }
Property Value
Type Description
IMyConfig

ControlledObject

Declaration
IMyControllableEntity ControlledObject { get; }
Property Value
Type Description
IMyControllableEntity

CreativeMode

Gets whether current create game is in creative mode

Declaration
bool CreativeMode { get; }
Property Value
Type Description
System.Boolean

CurrentPath

Gets current game save path

Declaration
string CurrentPath { get; }
Property Value
Type Description
System.String

DamageSystem

Gets ModAPI interface providing control over damage system

Declaration
IMyDamageSystem DamageSystem { get; }
Property Value
Type Description
IMyDamageSystem

Description

Gets or sets current game description (used in MOTD)

Declaration
string Description { get; set; }
Property Value
Type Description
System.String

ElapsedPlayTime

Gets time elapsed since the start of current session

Declaration
TimeSpan ElapsedPlayTime { get; }
Property Value
Type Description
System.TimeSpan

EnableCopyPaste

Get whether current player can copy/paste grids.

Declaration
bool EnableCopyPaste { get; }
Property Value
Type Description
System.Boolean

EnvironmentHostility

Gets current game environment hostility setting

Declaration
MyEnvironmentHostilityEnum EnvironmentHostility { get; }
Property Value
Type Description
MyEnvironmentHostilityEnum

Factions

Gets ModAPI interface providing control over faction

Declaration
IMyFactionCollection Factions { get; }
Property Value
Type Description
IMyFactionCollection

GameDateTime

Gets and sets game date time, that is a sum of 2081 Jan 1 at 0:00:00 and ElapsedPlayTime Note using setter, would change ElapsedPlayTime as well

Declaration
DateTime GameDateTime { get; set; }
Property Value
Type Description
System.DateTime

GameplayFrameCounter

Gets current game amounts of ticks passed from start. Only gets updated when the game is not paused

Declaration
int GameplayFrameCounter { get; }
Property Value
Type Description
System.Int32

GPS

Gets ModAPI interface providing control over gps coordinates

Declaration
IMyGpsCollection GPS { get; }
Property Value
Type Description
IMyGpsCollection

GrinderSpeedMultiplier

Gets game session global grinder speed multiplier

Declaration
float GrinderSpeedMultiplier { get; }
Property Value
Type Description
System.Single

HackSpeedMultiplier

Gets game session global hacking speed multiplier

Declaration
float HackSpeedMultiplier { get; }
Property Value
Type Description
System.Single

HasAdminPrivileges

Declaration
bool HasAdminPrivileges { get; }
Property Value
Type Description
System.Boolean

HasCreativeRights

Checks if the local player is an admin or is promoted to space master (or higher).

Declaration
bool HasCreativeRights { get; }
Property Value
Type Description
System.Boolean

InventoryMultiplier

Not used

Declaration
float InventoryMultiplier { get; }
Property Value
Type Description
System.Single

IsCameraAwaitingEntity

Not used

Declaration
bool IsCameraAwaitingEntity { get; set; }
Property Value
Type Description
System.Boolean

IsCameraControlledObject

Gets if the current camera is the current controlled object (not spectator)

Declaration
bool IsCameraControlledObject { get; }
Property Value
Type Description
System.Boolean

IsCameraUserControlledSpectator

Gets if the current camera is the user controlled spectator

Declaration
bool IsCameraUserControlledSpectator { get; }
Property Value
Type Description
System.Boolean

IsServer

Gets whether this game instance is server. (Not if game is multiplayer)

Declaration
bool IsServer { get; }
Property Value
Type Description
System.Boolean

LocalHumanPlayer

Gets player that playing on this game window. Always null, when called on dedicated server instance, and not null in any other cases

Declaration
IMyPlayer LocalHumanPlayer { get; }
Property Value
Type Description
IMyPlayer

MaxBackupSaves

Gets maximum backups allowed in game settings

Declaration
short MaxBackupSaves { get; }
Property Value
Type Description
System.Int16

MaxFloatingObjects

Gets maximum floating objects allowed in game settings

Declaration
short MaxFloatingObjects { get; }
Property Value
Type Description
System.Int16

MaxPlayers

Gets maximum players allowed in game settings

Declaration
short MaxPlayers { get; }
Property Value
Type Description
System.Int16

Mods

Gets or sets mods added to current game

Declaration
List<MyObjectBuilder_Checkpoint.ModItem> Mods { get; set; }
Property Value
Type Description
System.Collections.Generic.List<MyObjectBuilder_Checkpoint.ModItem>
Remarks

Setting mods won't add them to current game, but will save them in game save

MultiplayerAlive

Gets or sets whether there is connection with server. When it is false, a warning would appear.

Declaration
bool MultiplayerAlive { get; set; }
Property Value
Type Description
System.Boolean

MultiplayerDirect

Declaration
bool MultiplayerDirect { get; set; }
Property Value
Type Description
System.Boolean

MultiplayerLastMsg

Gets or sets time in seconds, from last message from server

Declaration
double MultiplayerLastMsg { get; set; }
Property Value
Type Description
System.Double

Name

Gets or sets name of the game

Declaration
string Name { get; set; }
Property Value
Type Description
System.String

NegativeIntegrityTotal

Gets or sets amount of damage applied to blocks

Declaration
float NegativeIntegrityTotal { get; set; }
Property Value
Type Description
System.Single

OnlineMode

Gets current session online mode

Declaration
MyOnlineModeEnum OnlineMode { get; }
Property Value
Type Description
MyOnlineModeEnum

OxygenProviderSystem

Gets ModAPI interface providing control oxygen system

Declaration
IMyOxygenProviderSystem OxygenProviderSystem { get; }
Property Value
Type Description
IMyOxygenProviderSystem

Password

Gets or sets password, that player must enter to join server

Declaration
string Password { get; set; }
Property Value
Type Description
System.String

Player

Declaration
IMyPlayer Player { get; }
Property Value
Type Description
IMyPlayer

PositiveIntegrityTotal

Gets or sets amount of integrity added to blocks

Declaration
float PositiveIntegrityTotal { get; set; }
Property Value
Type Description
System.Single

PromoteLevel

Gets the local player's promote level.

Declaration
MyPromoteLevel PromoteLevel { get; }
Property Value
Type Description
MyPromoteLevel

RefinerySpeedMultiplier

Gets or sets global refinery speed multiplier

Declaration
float RefinerySpeedMultiplier { get; }
Property Value
Type Description
System.Single

SessionSettings

Declaration
MyObjectBuilder_SessionSettings SessionSettings { get; }
Property Value
Type Description
MyObjectBuilder_SessionSettings

ShowPlayerNamesOnHud

Gets whether player names should be drawn on hud

Declaration
bool ShowPlayerNamesOnHud { get; }
Property Value
Type Description
System.Boolean

SurvivalMode

Gets whether current create game is in creative mode

Declaration
bool SurvivalMode { get; }
Property Value
Type Description
System.Boolean

ThrusterDamage

Gets whether thruster damage setting is enable

Declaration
bool ThrusterDamage { get; }
Property Value
Type Description
System.Boolean

ThumbPath

Gets current game path to thumbnail

Declaration
string ThumbPath { get; }
Property Value
Type Description
System.String

TimeOnBigShip

Gets time spent on controlling large grid

Declaration
TimeSpan TimeOnBigShip { get; }
Property Value
Type Description
System.TimeSpan

TimeOnFoot

Gets time spent on foot

Declaration
TimeSpan TimeOnFoot { get; }
Property Value
Type Description
System.TimeSpan

TimeOnJetpack

Gets time spent flying on jetpack

Declaration
TimeSpan TimeOnJetpack { get; }
Property Value
Type Description
System.TimeSpan

TimeOnSmallShip

Gets time spent on controlling small ship

Declaration
TimeSpan TimeOnSmallShip { get; }
Property Value
Type Description
System.TimeSpan

TotalBotLimit

Gets limitation on maximum bot amount

Declaration
int TotalBotLimit { get; }
Property Value
Type Description
System.Int32

Version

Get version of Space Engineers

Declaration
Version Version { get; }
Property Value
Type Description
System.Version

VoxelMaps

Gets ModAPI interface providing control over voxel maps

Declaration
IMyVoxelMaps VoxelMaps { get; }
Property Value
Type Description
IMyVoxelMaps

WeaponsEnabled

Gets whether weapons are enabled in current game

Declaration
bool WeaponsEnabled { get; }
Property Value
Type Description
System.Boolean

WeatherEffects

Gets MySectorWeatherComponent ModAPI interface

Declaration
IMyWeatherEffects WeatherEffects { get; }
Property Value
Type Description
IMyWeatherEffects

WelderSpeedMultiplier

Gets current game welder speed global multiplier

Declaration
float WelderSpeedMultiplier { get; }
Property Value
Type Description
System.Single

WorkshopId

Gets current game scenario workshop id

Declaration
Nullable<ulong> WorkshopId { get; }
Property Value
Type Description
System.Nullable<System.UInt64>

WorldBoundaries

Gets world boundaries. Not letting character leaving them

Declaration
BoundingBoxD WorldBoundaries { get; }
Property Value
Type Description
BoundingBoxD

Methods

BeforeStartComponents()

Triggers BeforeStart for each game session component, resets game timer.

Declaration
void BeforeStartComponents()
Remarks

You should avoid calling this method, as it can crash the game

Draw()

Calls Draw on all game session components

Declaration
void Draw()

GameOver()

Does nothing

Declaration
void GameOver()

GameOver(Nullable<MyStringId>)

Does nothing

Declaration
void GameOver(Nullable<MyStringId> customMessage)
Parameters
Type Name Description
System.Nullable<MyStringId> customMessage

GetCheckpoint(String)

Gets current game save. Game is saved in several files. This function returns object builder for file: Sandbox.sbc

Declaration
MyObjectBuilder_Checkpoint GetCheckpoint(string saveName)
Parameters
Type Name Description
System.String saveName

Name of save

Returns
Type Description
MyObjectBuilder_Checkpoint

One of game save parts

See Also
GetSector()

GetSector()

Gets current game save. Game is saved in several files. This function returns object builder for file: SANDBOX_0_0_0_.sbs

Declaration
MyObjectBuilder_Sector GetSector()
Returns
Type Description
MyObjectBuilder_Sector

One of game save parts

See Also
GetCheckpoint(String)

GetUserPromoteLevel(UInt64)

Gets a remote player's promote level.

Declaration
MyPromoteLevel GetUserPromoteLevel(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId

Player steamId

Returns
Type Description
MyPromoteLevel

Player access level

GetVoxelMapsArray()

Declaration
Dictionary<string, byte[]> GetVoxelMapsArray()
Returns
Type Description
System.Collections.Generic.Dictionary<System.String, System.Byte[]>

GetWorld()

Gets information what receives client when connecting to server

Declaration
MyObjectBuilder_World GetWorld()
Returns
Type Description
MyObjectBuilder_World

Object builder of world

Remarks

Entities are not streamed to client. Also some information maybe not sent to server

IsPausable()

Get whether game is pauseable (not multiplayer)

Declaration
bool IsPausable()
Returns
Type Description
System.Boolean

True if game is pauseable

IsUserAdmin(UInt64)

Checks if a given player is an admin (or higher).

Declaration
bool IsUserAdmin(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId
Returns
Type Description
System.Boolean

IsUserIgnorePCULimit(UInt64)

Gets whether user can ignore pcu and block limits

Declaration
bool IsUserIgnorePCULimit(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId

Player steamId

Returns
Type Description
System.Boolean

True if player can ignore pcu and block limits

IsUserIgnoreSafeZones(UInt64)

Gets whether user can ignore safezone settings

Declaration
bool IsUserIgnoreSafeZones(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId

Player steamId

Returns
Type Description
System.Boolean

True if player can ignore safezone settings

IsUserInvulnerable(UInt64)

Gets whether user is invulnerable

Declaration
bool IsUserInvulnerable(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId

Player steamId

Returns
Type Description
System.Boolean

True if player is invulnerable

IsUserKeepOriginalOwnershipOnPaste(UInt64)

Gets whether user can keep original BuiltBy of blocks when pasting grid

Declaration
bool IsUserKeepOriginalOwnershipOnPaste(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId

Player steamId

Returns
Type Description
System.Boolean

True if player can keep original BuiltBy of blocks when pasting grid

IsUserPromoted(UInt64)

Declaration
bool IsUserPromoted(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId
Returns
Type Description
System.Boolean

IsUserShowAllPlayers(UInt64)

Gets whether user can see all players

Declaration
bool IsUserShowAllPlayers(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId

Player steamId

Returns
Type Description
System.Boolean

True if player can see all players

IsUserUntargetable(UInt64)

Gets whether user can't be targeted by turrets

Declaration
bool IsUserUntargetable(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId

Player steamId

Returns
Type Description
System.Boolean

True if player can't be targeted by turrets

IsUserUseAllTerminals(UInt64)

Gets whether user can see use all terminals

Declaration
bool IsUserUseAllTerminals(ulong steamId)
Parameters
Type Name Description
System.UInt64 steamId

Player steamId

Returns
Type Description
System.Boolean

True if player can use all terminals

RegisterComponent(MySessionComponentBase, MyUpdateOrder, Int32)

Registers game session component for updates.

Declaration
void RegisterComponent(MySessionComponentBase component, MyUpdateOrder updateOrder, int priority)
Parameters
Type Name Description
MySessionComponentBase component

Game session that should receive updates

MyUpdateOrder updateOrder

Defines which update methods should be called

System.Int32 priority

Ignored

Save(String)

Saves game

Declaration
bool Save(string customSaveName = null)
Parameters
Type Name Description
System.String customSaveName

Name of game save folder

Returns
Type Description
System.Boolean

SetAsNotReady()

Making game "not ready", preventing joining server for EOS server

Declaration
void SetAsNotReady()

SetCameraController(MyCameraControllerEnum, IMyEntity, Nullable<Vector3D>)

Sets mode of camera controller

Declaration
void SetCameraController(MyCameraControllerEnum cameraControllerEnum, IMyEntity cameraEntity = null, Nullable<Vector3D> position = null)
Parameters
Type Name Description
MyCameraControllerEnum cameraControllerEnum

Mode of work

IMyEntity cameraEntity

Entity that camera should follow

System.Nullable<Vector3D> position

Position of camera

SetComponentUpdateOrder(MySessionComponentBase, MyUpdateOrder)

Change the update order of a session component.

There is a proxy for this method in the session component itself.

Declaration
void SetComponentUpdateOrder(MySessionComponentBase component, MyUpdateOrder order)
Parameters
Type Name Description
MySessionComponentBase component

The component to set the update order for

MyUpdateOrder order

The update order

TryGetAdminSettings(UInt64, out MyAdminSettingsEnum)

Gets enabled admins settings

Declaration
bool TryGetAdminSettings(ulong steamId, out MyAdminSettingsEnum adminSettings)
Parameters
Type Name Description
System.UInt64 steamId

Player steam id

MyAdminSettingsEnum adminSettings

Admin settings that is enabled for player

Returns
Type Description
System.Boolean

True when player found

Unload()

Unloads current game session. Calls UnloadDataComponents(), UnloadMultiplayer()

Declaration
void Unload()

UnloadDataComponents()

Unloads data components. Shouldn't be called directly. Use Unload() instead

Declaration
void UnloadDataComponents()

UnloadMultiplayer()

Unloads data components. Shouldn't be called directly. Use Unload() instead

Declaration
void UnloadMultiplayer()

UnregisterComponent(MySessionComponentBase)

Unregisters components from updates and calls.

Declaration
void UnregisterComponent(MySessionComponentBase component)
Parameters
Type Name Description
MySessionComponentBase component

Component that should no longer work

Update(MyTimeSpan)

Updates games. Does 1 simulation tick

Declaration
void Update(MyTimeSpan time)
Parameters
Type Name Description
MyTimeSpan time

Used in counting whether game save is required. Usually it is 16.67ms

UpdateComponents()

Updates games. Does 1 simulation tick, but without any other logic, that is executed in Update(MyTimeSpan)

Declaration
void UpdateComponents()

Events

OnSessionLoading

Called when session started loading

Declaration
event Action OnSessionLoading
Event Type
Type Description
System.Action

OnSessionReady

Called when session is ready

Declaration
event Action OnSessionReady
Event Type
Type Description
System.Action
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾