Barotrauma Server Doc
Barotrauma.GameSession Class Reference

Public Types

enum class  InfoFrameTab { Crew , Mission , MyCharacter , Traitor }
 

Public Member Functions

 GameSession (SubmarineInfo submarineInfo, string savePath, GameModePreset gameModePreset, CampaignSettings settings, string? seed=null, MissionType missionType=MissionType.None)
 Start a new GameSession. Will be saved to the specified save path (if playing a game mode that can be saved). More...
 
 GameSession (SubmarineInfo submarineInfo, GameModePreset gameModePreset, string? seed=null, IEnumerable< MissionPrefab >? missionPrefabs=null)
 Start a new GameSession with a specific pre-selected mission. More...
 
 GameSession (SubmarineInfo submarineInfo, List< SubmarineInfo > ownedSubmarines, XDocument doc, string saveFile)
 Load a game session from the specified XML document. The session will be saved to the specified path. More...
 
void LoadPreviousSave ()
 
void SwitchSubmarine (SubmarineInfo newSubmarine, bool transferItems, Client? client=null)
 Switch to another submarine. The sub is loaded when the next round starts. More...
 
bool TryPurchaseSubmarine (SubmarineInfo newSubmarine, Client? client=null)
 
bool IsSubmarineOwned (SubmarineInfo query)
 
bool IsCurrentLocationRadiated ()
 
void StartRound (string levelSeed, float? difficulty=null, LevelGenerationParams? levelGenerationParams=null)
 
void StartRound (LevelData? levelData, bool mirrorLevel=false, SubmarineInfo? startOutpost=null, SubmarineInfo? endOutpost=null)
 
void PlaceSubAtStart (Level? level)
 
void Update (float deltaTime)
 
MissionGetMission (int index)
 
int GetMissionIndex (Mission mission)
 
void EnforceMissionOrder (List< Identifier > missionIdentifiers)
 
void EndRound (string endMessage, CampaignMode.TransitionType transitionType=CampaignMode.TransitionType.None, TraitorManager.TraitorResults? traitorResults=null)
 
void LogEndRoundStats (string eventId, TraitorManager.TraitorResults? traitorResults=null)
 
void KillCharacter (Character character)
 
void ReviveCharacter (Character character)
 
void Save (string filePath)
 

Static Public Member Functions

static Location[] CreateDummyLocations (LevelData levelData, LocationType? forceLocationType=null)
 
static Location[] CreateDummyLocations (string seed, LocationType? forceLocationType=null)
 
static ImmutableHashSet< CharacterGetSessionCrewCharacters (CharacterType type)
 Returns a list of crew characters currently in the game with a given filter. More...
 
static bool IsCompatibleWithEnabledContentPackages (IList< string > contentPackageNames, out LocalizedString errorMsg)
 

Public Attributes

readonly EventManager EventManager
 
GameModeGameMode
 
CrewManagerCrewManager
 
double TimeSpentCleaning
 
CharacterTeamTypeWinningTeam
 
List< SubmarineInfoOwnedSubmarines = new List<SubmarineInfo>()
 

Properties

Version LastSaveVersion = GameMain.Version [get, set]
 
float RoundDuration [get]
 
IEnumerable< MissionMissions [get]
 
IEnumerable< CharacterCasualties [get]
 
bool IsRunning [get]
 
bool RoundEnding [get]
 
LevelLevel [get]
 
LevelDataLevelData [get]
 
bool MirrorLevel [get]
 
Map?? Map [get]
 
CampaignModeCampaign [get]
 
LocationStartLocation [get]
 
LocationEndLocation [get]
 
SubmarineInfo SubmarineInfo [get, set]
 
SubmarineSubmarine [get, set]
 
string? SavePath [get, set]
 
bool TraitorsEnabled [get]
 

Detailed Description

Definition at line 16 of file GameSession.cs.

Member Enumeration Documentation

◆ InfoFrameTab

Enumerator
Crew 
Mission 
MyCharacter 
Traitor 

Definition at line 22 of file GameSession.cs.

Constructor & Destructor Documentation

◆ GameSession() [1/3]

Barotrauma.GameSession.GameSession ( SubmarineInfo  submarineInfo,
string  savePath,
GameModePreset  gameModePreset,
CampaignSettings  settings,
string?  seed = null,
MissionType  missionType = MissionType.None 
)

Start a new GameSession. Will be saved to the specified save path (if playing a game mode that can be saved).

Definition at line 129 of file GameSession.cs.

◆ GameSession() [2/3]

Barotrauma.GameSession.GameSession ( SubmarineInfo  submarineInfo,
GameModePreset  gameModePreset,
string?  seed = null,
IEnumerable< MissionPrefab >?  missionPrefabs = null 
)

Start a new GameSession with a specific pre-selected mission.

Definition at line 141 of file GameSession.cs.

◆ GameSession() [3/3]

Barotrauma.GameSession.GameSession ( SubmarineInfo  submarineInfo,
List< SubmarineInfo ownedSubmarines,
XDocument  doc,
string  saveFile 
)

Load a game session from the specified XML document. The session will be saved to the specified path.

Definition at line 152 of file GameSession.cs.

Member Function Documentation

◆ CreateDummyLocations() [1/2]

static Location [] Barotrauma.GameSession.CreateDummyLocations ( LevelData  levelData,
LocationType forceLocationType = null 
)
static

Definition at line 267 of file GameSession.cs.

◆ CreateDummyLocations() [2/2]

static Location [] Barotrauma.GameSession.CreateDummyLocations ( string  seed,
LocationType forceLocationType = null 
)
static

Definition at line 294 of file GameSession.cs.

◆ EndRound()

void Barotrauma.GameSession.EndRound ( string  endMessage,
CampaignMode.TransitionType  transitionType = CampaignMode.TransitionType.None,
TraitorManager.TraitorResults traitorResults = null 
)

Definition at line 875 of file GameSession.cs.

◆ EnforceMissionOrder()

void Barotrauma.GameSession.EnforceMissionOrder ( List< Identifier missionIdentifiers)

Definition at line 817 of file GameSession.cs.

◆ GetMission()

Mission? Barotrauma.GameSession.GetMission ( int  index)

Definition at line 806 of file GameSession.cs.

◆ GetMissionIndex()

int Barotrauma.GameSession.GetMissionIndex ( Mission  mission)

Definition at line 812 of file GameSession.cs.

◆ GetSessionCrewCharacters()

static ImmutableHashSet<Character> Barotrauma.GameSession.GetSessionCrewCharacters ( CharacterType  type)
static

Returns a list of crew characters currently in the game with a given filter.

Parameters
typeCharacter type filter
Returns

In singleplayer mode the CharacterType.Player returns the currently controlled player.

Definition at line 840 of file GameSession.cs.

◆ IsCompatibleWithEnabledContentPackages()

static bool Barotrauma.GameSession.IsCompatibleWithEnabledContentPackages ( IList< string >  contentPackageNames,
out LocalizedString  errorMsg 
)
static

Definition at line 1113 of file GameSession.cs.

◆ IsCurrentLocationRadiated()

bool Barotrauma.GameSession.IsCurrentLocationRadiated ( )

Definition at line 363 of file GameSession.cs.

◆ IsSubmarineOwned()

bool Barotrauma.GameSession.IsSubmarineOwned ( SubmarineInfo  query)

Definition at line 356 of file GameSession.cs.

◆ KillCharacter()

void Barotrauma.GameSession.KillCharacter ( Character  character)

Definition at line 1094 of file GameSession.cs.

◆ LoadPreviousSave()

void Barotrauma.GameSession.LoadPreviousSave ( )

Definition at line 309 of file GameSession.cs.

◆ LogEndRoundStats()

void Barotrauma.GameSession.LogEndRoundStats ( string  eventId,
TraitorManager.TraitorResults traitorResults = null 
)

Definition at line 1013 of file GameSession.cs.

◆ PlaceSubAtStart()

void Barotrauma.GameSession.PlaceSubAtStart ( Level level)

Definition at line 689 of file GameSession.cs.

◆ ReviveCharacter()

void Barotrauma.GameSession.ReviveCharacter ( Character  character)

Definition at line 1105 of file GameSession.cs.

◆ Save()

void Barotrauma.GameSession.Save ( string  filePath)

Definition at line 1180 of file GameSession.cs.

◆ StartRound() [1/2]

void Barotrauma.GameSession.StartRound ( LevelData levelData,
bool  mirrorLevel = false,
SubmarineInfo startOutpost = null,
SubmarineInfo endOutpost = null 
)

Definition at line 406 of file GameSession.cs.

◆ StartRound() [2/2]

void Barotrauma.GameSession.StartRound ( string  levelSeed,
float?  difficulty = null,
LevelGenerationParams levelGenerationParams = null 
)

Definition at line 377 of file GameSession.cs.

◆ SwitchSubmarine()

void Barotrauma.GameSession.SwitchSubmarine ( SubmarineInfo  newSubmarine,
bool  transferItems,
Client client = null 
)

Switch to another submarine. The sub is loaded when the next round starts.

Definition at line 318 of file GameSession.cs.

◆ TryPurchaseSubmarine()

bool Barotrauma.GameSession.TryPurchaseSubmarine ( SubmarineInfo  newSubmarine,
Client client = null 
)

Definition at line 340 of file GameSession.cs.

◆ Update()

void Barotrauma.GameSession.Update ( float  deltaTime)

Definition at line 793 of file GameSession.cs.

Member Data Documentation

◆ CrewManager

CrewManager? Barotrauma.GameSession.CrewManager

Definition at line 32 of file GameSession.cs.

◆ EventManager

readonly EventManager Barotrauma.GameSession.EventManager

Definition at line 26 of file GameSession.cs.

◆ GameMode

GameMode? Barotrauma.GameSession.GameMode

Definition at line 28 of file GameSession.cs.

◆ OwnedSubmarines

List<SubmarineInfo> Barotrauma.GameSession.OwnedSubmarines = new List<SubmarineInfo>()

Definition at line 106 of file GameSession.cs.

◆ TimeSpentCleaning

double Barotrauma.GameSession.TimeSpentCleaning

Definition at line 39 of file GameSession.cs.

◆ WinningTeam

CharacterTeamType? Barotrauma.GameSession.WinningTeam

Definition at line 48 of file GameSession.cs.

Property Documentation

◆ Campaign

CampaignMode? Barotrauma.GameSession.Campaign
get

Definition at line 67 of file GameSession.cs.

◆ Casualties

IEnumerable<Character> Barotrauma.GameSession.Casualties
get

Definition at line 45 of file GameSession.cs.

◆ EndLocation

Location? Barotrauma.GameSession.EndLocation
get

Definition at line 90 of file GameSession.cs.

◆ IsRunning

bool Barotrauma.GameSession.IsRunning
get

Definition at line 50 of file GameSession.cs.

◆ LastSaveVersion

Version Barotrauma.GameSession.LastSaveVersion = GameMain.Version
getset

Definition at line 24 of file GameSession.cs.

◆ Level

Level? Barotrauma.GameSession.Level
get

Definition at line 54 of file GameSession.cs.

◆ LevelData

LevelData? Barotrauma.GameSession.LevelData
get

Definition at line 55 of file GameSession.cs.

◆ Map

Map?? Barotrauma.GameSession.Map
get

Definition at line 59 of file GameSession.cs.

◆ MirrorLevel

bool Barotrauma.GameSession.MirrorLevel
get

Definition at line 57 of file GameSession.cs.

◆ Missions

IEnumerable<Mission> Barotrauma.GameSession.Missions
get

Definition at line 42 of file GameSession.cs.

◆ RoundDuration

float Barotrauma.GameSession.RoundDuration
get

Definition at line 34 of file GameSession.cs.

◆ RoundEnding

bool Barotrauma.GameSession.RoundEnding
get

Definition at line 52 of file GameSession.cs.

◆ SavePath

string? Barotrauma.GameSession.SavePath
getset

Definition at line 110 of file GameSession.cs.

◆ StartLocation

Location? Barotrauma.GameSession.StartLocation
get

Definition at line 76 of file GameSession.cs.

◆ Submarine

Submarine? Barotrauma.GameSession.Submarine
getset

Definition at line 108 of file GameSession.cs.

◆ SubmarineInfo

SubmarineInfo Barotrauma.GameSession.SubmarineInfo
getset

Definition at line 104 of file GameSession.cs.

◆ TraitorsEnabled

bool Barotrauma.GameSession.TraitorsEnabled
get

Definition at line 112 of file GameSession.cs.