Barotrauma Server
Loading...
Searching...
No Matches
Barotrauma.Level Class Reference
Inheritance diagram for Barotrauma.Level:
Barotrauma.Entity Barotrauma.Networking.IServerSerializable Barotrauma.Entity Barotrauma.Networking.IServerSerializable Barotrauma.ISpatialEntity Barotrauma.Networking.INetSerializable Barotrauma.ISpatialEntity Barotrauma.Networking.INetSerializable

Classes

class  AbyssIsland
 
class  Cave
 
struct  ClusterLocation
 
struct  GlobalLevelWallEventData
 
interface  IEventData
 
struct  InterestingPosition
 
struct  PathPoint
 
struct  SingleLevelWallEventData
 
class  Tunnel
 

Public Types

enum  PlacementType { Top , Bottom }
 
enum  EventType { SingleDestructibleWall , GlobalDestructibleWall }
 
enum  PositionType {
  None = 0 , MainPath = 0x1 , SidePath = 0x2 , Cave = 0x4 ,
  Ruin = 0x8 , Wreck = 0x10 , BeaconStation = 0x20 , Abyss = 0x40 ,
  AbyssCave = 0x80 , Outpost = 0x100
}
 
enum  TunnelType { MainPath , SidePath , Cave }
 
enum  LevelGenStage {
  LevelGenParams , Size , GenStart , TunnelGen1 ,
  TunnelGen2 , AbyssGen , CaveGen , VoronoiGen ,
  VoronoiGen2 , VoronoiGen3 , Ruins , Outposts ,
  FloatingIce , LevelBodies , IceSpires , TopAndBottom ,
  PlaceLevelObjects , GenerateItems , Finish
}
 Random integers generated during the level generation. If these values differ between clients/server, it means the levels aren't identical for some reason and there will most likely be major ID mismatches. More...
 

Public Member Functions

bool IsAllowedDifficulty (float minDifficulty, float maxDifficulty)
 Inclusive (matching the min an max values is accepted).
 
bool ShouldSpawnCrewInsideOutpost ()
 
List< VoronoiCellGetTooCloseCells (Vector2 position, float minDistance)
 
List< ItemGenerateMissionResources (ItemPrefab prefab, int requiredAmount, PositionType positionType, IEnumerable< Cave > targetCaves=null)
 
Parameters
rotationUsed by clients to set the rotation for the resources

 
Vector2 GetRandomItemPos (PositionType spawnPosType, float randomSpread, float minDistFromSubs, float offsetFromWall=10.0f, Func< InterestingPosition, bool > filter=null)
 
bool TryGetInterestingPositionAwayFromPoint (bool useSyncedRand, PositionType positionType, float minDistFromSubs, out InterestingPosition position, Vector2 awayPoint, float minDistFromPoint, Func< InterestingPosition, bool > filter=null)
 
bool TryGetInterestingPosition (bool useSyncedRand, PositionType positionType, float minDistFromSubs, out InterestingPosition position, Func< InterestingPosition, bool > filter=null, bool suppressWarning=false)
 
bool TryGetInterestingPosition (bool useSyncedRand, PositionType positionType, float minDistFromSubs, out InterestingPosition position, Vector2 awayPoint, float minDistFromPoint=0f, Func< InterestingPosition, bool > filter=null, bool suppressWarning=false)
 
bool IsPositionInsideWall (Vector2 worldPosition)
 
void Update (float deltaTime, Camera cam)
 
Vector2 GetBottomPosition (float xPosition)
 
List< VoronoiCellGetAllCells ()
 
List< VoronoiCellGetCells (Vector2 worldPos, int searchDepth=2)
 
VoronoiCell GetClosestCell (Vector2 worldPos)
 
bool IsCloseToStart (Vector2 position, float minDist)
 
bool IsCloseToEnd (Vector2 position, float minDist)
 
bool IsCloseToStart (Point position, float minDist)
 
bool IsCloseToEnd (Point position, float minDist)
 
void PrepareBeaconStation ()
 
void DisconnectBeaconStationWires (float disconnectWireProbability)
 
void DamageBeaconStationDevices (float breakDeviceProbability)
 
void DamageBeaconStationWalls (float damageWallProbability)
 
bool CheckBeaconActive ()
 
void SpawnCorpses ()
 
void SpawnNPCs ()
 
float GetRealWorldDepth (float worldPositionY)
 Calculate the "real" depth in meters from the surface of Europa (the value you see on the nav terminal)
 
void DebugSetStartLocation (Location newStartLocation)
 
void DebugSetEndLocation (Location newEndLocation)
 
override void Remove ()
 
void ServerEventWrite (IWriteMessage msg, Client c, NetEntityEvent.IData extraData=null)
 
- Public Member Functions inherited from Barotrauma.Entity
 Entity (Submarine submarine, ushort id)
 
void FreeID ()
 Removes the entity from the entity dictionary and frees up the ID it was using.
 

Static Public Member Functions

static Level Generate (LevelData levelData, bool mirror, Location startLocation, Location endLocation, SubmarineInfo startOutpost=null, SubmarineInfo endOutpost=null)
 
- Static Public Member Functions inherited from Barotrauma.Entity
static IReadOnlyCollection< EntityGetEntities ()
 
static int FindFreeIdBlock (int minBlockSize)
 Finds a contiguous block of free IDs of at least the given size.
 
static Entity FindEntityByID (ushort ID)
 Find an entity based on the ID.
 
static void RemoveAll ()
 
static void DumpIds (int count, string filename)
 

Public Attributes

List< AbyssIslandAbyssIslands = new List<AbyssIsland>()
 
List< double > siteCoordsX
 
List< double > siteCoordsY
 
List<(Point point, double distance)> distanceField
 
readonly LevelData LevelData
 
- Public Attributes inherited from Barotrauma.Entity
readonly ushort ID
 Unique, but non-persistent identifier. Stays the same if the entities are created in the exactly same order, but doesn't persist e.g. between the rounds.
 
readonly string CreationStackTrace
 
readonly UInt64 CreationIndex
 

Static Public Attributes

const int MaxEntityDepth = -1000000
 
const float ShaftHeight = 1000.0f
 
const float OutsideBoundsCurrentMargin = 30000.0f
 How far outside the boundaries of the level the water current that pushes subs towards the level starts.
 
const float OutsideBoundsCurrentMarginExponential = 150000.0f
 How far outside the boundaries of the level the strength of the current starts to increase exponentially.
 
const float OutsideBoundsCurrentHardLimit = 200000.0f
 How far outside the boundaries of the level the current stops submarines entirely.
 
const int MaxSubmarineWidth = 16000
 The level generator won't try to adjust the width of the main path above this limit.
 
const float ExitDistance = 6000.0f
 
const int GridCellSize = 2000
 
const float DefaultRealWorldCrushDepth = 3500.0f
 
static ? float ForcedDifficulty
 
- Static Public Attributes inherited from Barotrauma.Entity
const ushort NullEntityID = 0
 
const ushort EntitySpawnerID = ushort.MaxValue
 
const ushort RespawnManagerID = ushort.MaxValue - 1
 
const ushort DummyID = ushort.MaxValue - 2
 
const ushort ReservedIDStart = ushort.MaxValue - 3
 
const ushort MaxEntityCount = ushort.MaxValue - 4
 
static EntitySpawner Spawner
 

Properties

static Level Loaded [get]
 
Rectangle AbyssArea [get]
 
int AbyssStart [get]
 
int AbyssEnd [get]
 
Vector2 StartPosition [get]
 
Vector2 StartExitPosition [get]
 
Point Size [get]
 
Vector2 EndPosition [get]
 
Vector2 EndExitPosition [get]
 
int BottomPos [get]
 
int SeaFloorTopPos [get]
 
float CrushDepth [get]
 The crush depth of a non-upgraded submarine in in-game coordinates. Note that this can be above the top of the level!
 
float RealWorldCrushDepth [get]
 The crush depth of a non-upgraded submarine in "real world units" (meters from the surface of Europa). Note that this can be above the top of the level!
 
LevelWall SeaFloor [get]
 
List< RuinRuins [get]
 
List< SubmarineWrecks [get]
 
Submarine BeaconStation [get]
 
List< LevelWallExtraWalls [get]
 
List< LevelWallUnsyncedExtraWalls [get]
 
List< TunnelTunnels = new List<Tunnel>() [get]
 
List< CaveCaves = new List<Cave>() [get]
 
List< InterestingPositionPositionsOfInterest [get]
 
Submarine StartOutpost [get]
 
Submarine EndOutpost [get]
 
IReadOnlyDictionary< LevelGenStage, int > EqualityCheckValues [get]
 
List< EntityEntitiesBeforeGenerate = new List<Entity>() [get]
 
int EntityCountBeforeGenerate [get]
 
int EntityCountAfterGenerate [get]
 
Body TopBarrier [get]
 
Body BottomBarrier [get]
 
LevelObjectManager LevelObjectManager [get]
 
bool Generating [get]
 
Location StartLocation [get]
 
Location EndLocation [get]
 
bool Mirrored [get]
 
string Seed [get]
 
float Difficulty [get]
 
LevelData.LevelType Type [get]
 
bool IsEndBiome [get]
 
static bool IsLoadedOutpost [get]
 Is there a loaded level set and is it an outpost?
 
static bool IsLoadedFriendlyOutpost [get]
 Is there a loaded level set, and is it a friendly outpost (FriendlyNPC or Team1). Does not take reputation into account.
 
LevelGenerationParams GenerationParams [get]
 
Color BackgroundTextureColor [get]
 
Color BackgroundColor [get]
 
Color WallColor [get]
 
List< PathPointPathPoints = new List<PathPoint>() [get]
 
List< ClusterLocationAbyssResources = new List<ClusterLocation>() [get]
 
- Properties inherited from Barotrauma.Entity
static int EntityCount [get]
 
bool Removed [get]
 
bool IdFreed [get]
 
virtual Vector2 SimPosition [get]
 
virtual Vector2 Position [get]
 
virtual Vector2 WorldPosition [get]
 
virtual Vector2 DrawPosition [get]
 
Submarine Submarine [get, set]
 
AITarget AiTarget [get]
 
bool InDetectable [get, set]
 Indetectable characters can't be spotted by AIs and aren't visible on the sonar or health scanner.
 
double SpawnTime [get]
 
string ErrorLine [get]
 
- Properties inherited from Barotrauma.ISpatialEntity

Additional Inherited Members

- Protected Member Functions inherited from Barotrauma.Entity
virtual ushort DetermineID (ushort id, Submarine submarine)
 
- Protected Attributes inherited from Barotrauma.Entity
AITarget aiTarget
 

Member Enumeration Documentation

◆ EventType

Enumerator
SingleDestructibleWall 
GlobalDestructibleWall 

◆ LevelGenStage

Random integers generated during the level generation. If these values differ between clients/server, it means the levels aren't identical for some reason and there will most likely be major ID mismatches.

Enumerator
LevelGenParams 
Size 
GenStart 
TunnelGen1 
TunnelGen2 
AbyssGen 
CaveGen 
VoronoiGen 
VoronoiGen2 
VoronoiGen3 
Ruins 
Outposts 
FloatingIce 
LevelBodies 
IceSpires 
TopAndBottom 
PlaceLevelObjects 
GenerateItems 
Finish 

◆ PlacementType

Enumerator
Top 
Bottom 

◆ PositionType

Enumerator
None 
MainPath 
SidePath 
Cave 
Ruin 
Wreck 
BeaconStation 
Abyss 
AbyssCave 
Outpost 

◆ TunnelType

Enumerator
MainPath 
SidePath 
Cave 

Member Function Documentation

◆ CheckBeaconActive()

bool Barotrauma.Level.CheckBeaconActive ( )

◆ DamageBeaconStationDevices()

void Barotrauma.Level.DamageBeaconStationDevices ( float breakDeviceProbability)

◆ DamageBeaconStationWalls()

void Barotrauma.Level.DamageBeaconStationWalls ( float damageWallProbability)

◆ DebugSetEndLocation()

void Barotrauma.Level.DebugSetEndLocation ( Location newEndLocation)

◆ DebugSetStartLocation()

void Barotrauma.Level.DebugSetStartLocation ( Location newStartLocation)

◆ DisconnectBeaconStationWires()

void Barotrauma.Level.DisconnectBeaconStationWires ( float disconnectWireProbability)

◆ Generate()

static Level Barotrauma.Level.Generate ( LevelData levelData,
bool mirror,
Location startLocation,
Location endLocation,
SubmarineInfo startOutpost = null,
SubmarineInfo endOutpost = null )
static

◆ GenerateMissionResources()

List< Item > Barotrauma.Level.GenerateMissionResources ( ItemPrefab prefab,
int requiredAmount,
PositionType positionType,
IEnumerable< Cave > targetCaves = null )

Parameters
rotationUsed by clients to set the rotation for the resources

◆ GetAllCells()

List< VoronoiCell > Barotrauma.Level.GetAllCells ( )

◆ GetBottomPosition()

Vector2 Barotrauma.Level.GetBottomPosition ( float xPosition)

◆ GetCells()

List< VoronoiCell > Barotrauma.Level.GetCells ( Vector2 worldPos,
int searchDepth = 2 )

◆ GetClosestCell()

VoronoiCell Barotrauma.Level.GetClosestCell ( Vector2 worldPos)

◆ GetRandomItemPos()

Vector2 Barotrauma.Level.GetRandomItemPos ( PositionType spawnPosType,
float randomSpread,
float minDistFromSubs,
float offsetFromWall = 10::0f,
Func< InterestingPosition, bool > filter = null )

◆ GetRealWorldDepth()

float Barotrauma.Level.GetRealWorldDepth ( float worldPositionY)

Calculate the "real" depth in meters from the surface of Europa (the value you see on the nav terminal)

◆ GetTooCloseCells()

List< VoronoiCell > Barotrauma.Level.GetTooCloseCells ( Vector2 position,
float minDistance )

◆ IsAllowedDifficulty()

bool Barotrauma.Level.IsAllowedDifficulty ( float minDifficulty,
float maxDifficulty )

Inclusive (matching the min an max values is accepted).

◆ IsCloseToEnd() [1/2]

bool Barotrauma.Level.IsCloseToEnd ( Point position,
float minDist )

◆ IsCloseToEnd() [2/2]

bool Barotrauma.Level.IsCloseToEnd ( Vector2 position,
float minDist )

◆ IsCloseToStart() [1/2]

bool Barotrauma.Level.IsCloseToStart ( Point position,
float minDist )

◆ IsCloseToStart() [2/2]

bool Barotrauma.Level.IsCloseToStart ( Vector2 position,
float minDist )

◆ IsPositionInsideWall()

bool Barotrauma.Level.IsPositionInsideWall ( Vector2 worldPosition)

◆ PrepareBeaconStation()

void Barotrauma.Level.PrepareBeaconStation ( )

◆ Remove()

override void Barotrauma.Level.Remove ( )
virtual

Reimplemented from Barotrauma.Entity.

◆ ServerEventWrite()

void Barotrauma.Level.ServerEventWrite ( IWriteMessage msg,
Client c,
NetEntityEvent.IData extraData = null )

◆ ShouldSpawnCrewInsideOutpost()

bool Barotrauma.Level.ShouldSpawnCrewInsideOutpost ( )

◆ SpawnCorpses()

void Barotrauma.Level.SpawnCorpses ( )

◆ SpawnNPCs()

void Barotrauma.Level.SpawnNPCs ( )

◆ TryGetInterestingPosition() [1/2]

bool Barotrauma.Level.TryGetInterestingPosition ( bool useSyncedRand,
PositionType positionType,
float minDistFromSubs,
out InterestingPosition position,
Func< InterestingPosition, bool > filter = null,
bool suppressWarning = false )

◆ TryGetInterestingPosition() [2/2]

bool Barotrauma.Level.TryGetInterestingPosition ( bool useSyncedRand,
PositionType positionType,
float minDistFromSubs,
out InterestingPosition position,
Vector2 awayPoint,
float minDistFromPoint = 0f,
Func< InterestingPosition, bool > filter = null,
bool suppressWarning = false )

◆ TryGetInterestingPositionAwayFromPoint()

bool Barotrauma.Level.TryGetInterestingPositionAwayFromPoint ( bool useSyncedRand,
PositionType positionType,
float minDistFromSubs,
out InterestingPosition position,
Vector2 awayPoint,
float minDistFromPoint,
Func< InterestingPosition, bool > filter = null )

◆ Update()

void Barotrauma.Level.Update ( float deltaTime,
Camera cam )

Member Data Documentation

◆ AbyssIslands

List<AbyssIsland> Barotrauma.Level.AbyssIslands = new List<AbyssIsland>()

◆ DefaultRealWorldCrushDepth

const float Barotrauma.Level.DefaultRealWorldCrushDepth = 3500.0f
static

◆ distanceField

List<(Point point, double distance)> Barotrauma.Level.distanceField

◆ ExitDistance

const float Barotrauma.Level.ExitDistance = 6000.0f
static

◆ ForcedDifficulty

? float Barotrauma.Level.ForcedDifficulty
static

◆ GridCellSize

const int Barotrauma.Level.GridCellSize = 2000
static

◆ LevelData

readonly LevelData Barotrauma.Level.LevelData

◆ MaxEntityDepth

const int Barotrauma.Level.MaxEntityDepth = -1000000
static

◆ MaxSubmarineWidth

const int Barotrauma.Level.MaxSubmarineWidth = 16000
static

The level generator won't try to adjust the width of the main path above this limit.

◆ OutsideBoundsCurrentHardLimit

const float Barotrauma.Level.OutsideBoundsCurrentHardLimit = 200000.0f
static

How far outside the boundaries of the level the current stops submarines entirely.

◆ OutsideBoundsCurrentMargin

const float Barotrauma.Level.OutsideBoundsCurrentMargin = 30000.0f
static

How far outside the boundaries of the level the water current that pushes subs towards the level starts.

◆ OutsideBoundsCurrentMarginExponential

const float Barotrauma.Level.OutsideBoundsCurrentMarginExponential = 150000.0f
static

How far outside the boundaries of the level the strength of the current starts to increase exponentially.

◆ ShaftHeight

const float Barotrauma.Level.ShaftHeight = 1000.0f
static

◆ siteCoordsX

List<double> Barotrauma.Level.siteCoordsX

◆ siteCoordsY

List<double> Barotrauma.Level.siteCoordsY

Property Documentation

◆ AbyssArea

Rectangle Barotrauma.Level.AbyssArea
get

◆ AbyssEnd

int Barotrauma.Level.AbyssEnd
get

◆ AbyssResources

List<ClusterLocation> Barotrauma.Level.AbyssResources = new List<ClusterLocation>()
get

◆ AbyssStart

int Barotrauma.Level.AbyssStart
get

◆ BackgroundColor

Color Barotrauma.Level.BackgroundColor
get

◆ BackgroundTextureColor

Color Barotrauma.Level.BackgroundTextureColor
get

◆ BeaconStation

Submarine Barotrauma.Level.BeaconStation
get

◆ BottomBarrier

Body Barotrauma.Level.BottomBarrier
get

◆ BottomPos

int Barotrauma.Level.BottomPos
get

◆ Caves

List<Cave> Barotrauma.Level.Caves = new List<Cave>()
get

◆ CrushDepth

float Barotrauma.Level.CrushDepth
get

The crush depth of a non-upgraded submarine in in-game coordinates. Note that this can be above the top of the level!

◆ Difficulty

float Barotrauma.Level.Difficulty
get

◆ EndExitPosition

Vector2 Barotrauma.Level.EndExitPosition
get

◆ EndLocation

Location Barotrauma.Level.EndLocation
get

◆ EndOutpost

Submarine Barotrauma.Level.EndOutpost
get

◆ EndPosition

Vector2 Barotrauma.Level.EndPosition
get

◆ EntitiesBeforeGenerate

List<Entity> Barotrauma.Level.EntitiesBeforeGenerate = new List<Entity>()
get

◆ EntityCountAfterGenerate

int Barotrauma.Level.EntityCountAfterGenerate
get

◆ EntityCountBeforeGenerate

int Barotrauma.Level.EntityCountBeforeGenerate
get

◆ EqualityCheckValues

IReadOnlyDictionary<LevelGenStage, int> Barotrauma.Level.EqualityCheckValues
get

◆ ExtraWalls

List<LevelWall> Barotrauma.Level.ExtraWalls
get

◆ Generating

bool Barotrauma.Level.Generating
get

◆ GenerationParams

LevelGenerationParams Barotrauma.Level.GenerationParams
get

◆ IsEndBiome

bool Barotrauma.Level.IsEndBiome
get

◆ IsLoadedFriendlyOutpost

bool Barotrauma.Level.IsLoadedFriendlyOutpost
staticget

Is there a loaded level set, and is it a friendly outpost (FriendlyNPC or Team1). Does not take reputation into account.

◆ IsLoadedOutpost

bool Barotrauma.Level.IsLoadedOutpost
staticget

Is there a loaded level set and is it an outpost?

◆ LevelObjectManager

LevelObjectManager Barotrauma.Level.LevelObjectManager
get

◆ Loaded

Level Barotrauma.Level.Loaded
staticget

◆ Mirrored

bool Barotrauma.Level.Mirrored
get

◆ PathPoints

List<PathPoint> Barotrauma.Level.PathPoints = new List<PathPoint>()
get

◆ PositionsOfInterest

List<InterestingPosition> Barotrauma.Level.PositionsOfInterest
get

◆ RealWorldCrushDepth

float Barotrauma.Level.RealWorldCrushDepth
get

The crush depth of a non-upgraded submarine in "real world units" (meters from the surface of Europa). Note that this can be above the top of the level!

◆ Ruins

List<Ruin> Barotrauma.Level.Ruins
get

◆ SeaFloor

LevelWall Barotrauma.Level.SeaFloor
get

◆ SeaFloorTopPos

int Barotrauma.Level.SeaFloorTopPos
get

◆ Seed

string Barotrauma.Level.Seed
get

◆ Size

Point Barotrauma.Level.Size
get

◆ StartExitPosition

Vector2 Barotrauma.Level.StartExitPosition
get

◆ StartLocation

Location Barotrauma.Level.StartLocation
get

◆ StartOutpost

Submarine Barotrauma.Level.StartOutpost
get

◆ StartPosition

Vector2 Barotrauma.Level.StartPosition
get

◆ TopBarrier

Body Barotrauma.Level.TopBarrier
get

◆ Tunnels

List<Tunnel> Barotrauma.Level.Tunnels = new List<Tunnel>()
get

◆ Type

LevelData.LevelType Barotrauma.Level.Type
get

◆ UnsyncedExtraWalls

List<LevelWall> Barotrauma.Level.UnsyncedExtraWalls
get

◆ WallColor

Color Barotrauma.Level.WallColor
get

◆ Wrecks

List<Submarine> Barotrauma.Level.Wrecks
get

The documentation for this class was generated from the following files: