Submarine

Barotrauma Submarine class with some additional functions and fields

Barotrauma source code: Submarine.cs

Not all fields and methods will work, this doc was autogenerated.

Functions

ApplyForce(force)

ApplyForce

Parameters

  • force Microsoft.Xna.Framework.Vector2

AttemptBallastFloraInfection(identifier, deltaTime, probability)

AttemptBallastFloraInfection

Parameters

  • identifier Identifier

  • deltaTime number

  • probability number

CalculateBasePrice()

CalculateBasePrice

Returns

  • number

CalculateDimensions(onlyHulls)

CalculateDimensions

Parameters

  • onlyHulls bool

Returns

  • Microsoft.Xna.Framework.Rectangle

CheckForErrors()

CheckForErrors

CheckFuel()

CheckFuel

Returns

  • bool

ClientEventRead(msg, sendingTime)

ClientEventRead

Parameters

  • msg Networking.IReadMessage

  • sendingTime number

ClientReadPosition(msg, sendingTime)

ClientReadPosition

Parameters

  • msg Networking.IReadMessage

  • sendingTime number

CreateMiniMap(parent, pointsOfInterest, ignoreOutpost)

CreateMiniMap

Parameters

  • parent GUIComponent

  • pointsOfInterest IEnumerable

  • ignoreOutpost bool

CreateTurretAI()

CreateTurretAI

Returns

  • bool

CreateWreckAI()

CreateWreckAI

Returns

  • bool

DisableObstructedWayPoints()

DisableObstructedWayPoints

DisableObstructedWayPoints(otherSub)

DisableObstructedWayPoints

Parameters

DisableWreckAI()

DisableWreckAI

Dispose()

Dispose

EnableFactionSpecificEntities(factionIdentifier)

EnableFactionSpecificEntities

Parameters

  • factionIdentifier Identifier

EnableMaintainPosition()

EnableMaintainPosition

EnableObstructedWaypoints(otherSub)

EnableObstructedWaypoints

Parameters

Equals(obj)

Equals

Parameters

  • obj Object

Returns

  • bool

FindContainerFor(item, onlyPrimary, checkTransferConditions, allowConnectedSubs)

FindContainerFor

Parameters

  • item Item

  • onlyPrimary bool

  • checkTransferConditions bool

  • allowConnectedSubs bool

Returns

  • Item

FindSpawnPos(spawnPos, submarineSize, subDockingPortOffset, verticalMoveDir)

FindSpawnPos

Parameters

  • spawnPos Microsoft.Xna.Framework.Vector2

  • submarineSize optional Microsoft.Xna.Framework.Point

  • subDockingPortOffset number

  • verticalMoveDir number

Returns

  • Microsoft.Xna.Framework.Vector2

FlipX(parents)

FlipX

Parameters

FreeID()

FreeID

GetCargoContainers()

GetCargoContainers

Returns

GetConnectedSubs()

GetConnectedSubs

Returns

  • IEnumerable

GetDockedBorders(allowDifferentTeam)

GetDockedBorders

Parameters

  • allowDifferentTeam bool

Returns

  • Microsoft.Xna.Framework.Rectangle

GetEntities(includingConnectedSubs, list)

GetEntities

Parameters

  • includingConnectedSubs bool

  • list IEnumerable

Returns

  • IEnumerable

GetEntities(includingConnectedSubs, list)

GetEntities

Parameters

  • includingConnectedSubs bool

Returns

GetGaps(alsoFromConnectedSubs)

GetGaps

Parameters

  • alsoFromConnectedSubs bool

Returns

GetHashCode()

GetHashCode

Returns

  • number

GetHulls(alsoFromConnectedSubs)

GetHulls

Parameters

  • alsoFromConnectedSubs bool

Returns

GetItems(alsoFromConnectedSubs)

GetItems

Parameters

  • alsoFromConnectedSubs bool

Returns

GetType()

GetType

Returns

  • Type

GetWalls(alsoFromConnectedSubs)

GetWalls

Parameters

  • alsoFromConnectedSubs bool

Returns

GetWaypoints(alsoFromConnectedSubs)

GetWaypoints

Parameters

  • alsoFromConnectedSubs bool

Returns

IsConnectedTo(otherSub)

IsConnectedTo

Parameters

Returns

  • bool

IsEntityFoundOnThisSub(entity, includingConnectedSubs, allowDifferentTeam, allowDifferentType)

IsEntityFoundOnThisSub

Parameters

  • entity MapEntity

  • includingConnectedSubs bool

  • allowDifferentTeam bool

  • allowDifferentType bool

Returns

  • bool

LayerExists(layer)

LayerExists

Parameters

  • layer Identifier

Returns

  • bool

MakeWreck()

MakeWreck

NeutralizeBallast()

NeutralizeBallast

RefreshConnectedSubs()

RefreshConnectedSubs

RefreshOutdoorNodes()

RefreshOutdoorNodes

Remove()

Remove

SaveToXElement(element)

SaveToXElement

Parameters

  • element Xml.Linq.XElement

ServerEventWrite(msg, c, extraData)

ServerEventWrite

Parameters

  • msg Networking.IWriteMessage

  • c Networking.Client

  • extraData Networking.IData

ServerWritePosition(tempBuffer, c)

ServerWritePosition

Parameters

  • tempBuffer Networking.ReadWriteMessage

  • c Networking.Client

SetCrushDepth(realWorldCrushDepth)

SetCrushDepth

Parameters

  • realWorldCrushDepth number

SetLayerEnabled(layer, enabled, sendNetworkEvent)

SetLayerEnabled

Parameters

  • layer Identifier

  • enabled bool

  • sendNetworkEvent bool

SetPosition(position, checkd, forceUndockFromStaticSubmarines)

SetPosition

Parameters

  • position Microsoft.Xna.Framework.Vector2

  • forceUndockFromStaticSubmarines bool

SetPrevTransform(position)

SetPrevTransform

Parameters

  • position Microsoft.Xna.Framework.Vector2

Submarine(info, showErrorMessages, loadEntities, linkedRemap)

Submarine

Parameters

  • info SubmarineInfo

  • showErrorMessages bool

  • loadEntities function

  • linkedRemap IdRemap

Submarine.AbsRect(pos, size)

AbsRect

Parameters

  • pos Microsoft.Xna.Framework.Vector2

  • size Microsoft.Xna.Framework.Vector2

Returns

  • Microsoft.Xna.Framework.Rectangle

Submarine.AbsRectF(pos, size)

AbsRectF

Parameters

  • pos Microsoft.Xna.Framework.Vector2

  • size Microsoft.Xna.Framework.Vector2

Returns

  • Microsoft.Xna.Framework.RectangleF

Submarine.CalculateDockOffset(sub, dockedSub)

CalculateDockOffset

Parameters

Returns

  • optional Microsoft.Xna.Framework.Vector2

Submarine.CheckVisibility(rayStart, rayEnd, ignoreLevel, ignoreSubs, ignoreSensors, ignoreDisabledWalls, ignoreBranches, blocksVisibilityPredicate)

CheckVisibility

Parameters

  • rayStart Microsoft.Xna.Framework.Vector2

  • rayEnd Microsoft.Xna.Framework.Vector2

  • ignoreLevel bool

  • ignoreSubs bool

  • ignoreSensors bool

  • ignoreDisabledWalls bool

  • ignoreBranches bool

  • blocksVisibilityPredicate Predicate

Returns

  • FarseerPhysics.Dynamics.Body

Submarine.ConstructLinkedHulls(mainHull, linkedHulls, parent, worldBorders)

ConstructLinkedHulls

Parameters

  • mainHull Hull

  • linkedHulls HashSet

  • parent GUIComponent

  • worldBorders Microsoft.Xna.Framework.Rectangle

Returns

  • Items.Components.MiniMapHullData

Submarine.CullEntities(cam)

CullEntities

Parameters

  • cam Camera

Submarine.Draw(spriteBatch, editing)

Draw

Parameters

  • spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch

  • editing bool

Submarine.DrawBack(spriteBatch, editing, predicate)

DrawBack

Parameters

  • spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch

  • editing bool

  • predicate Predicate

Submarine.DrawDamageable(spriteBatch, damageEffect, editing, predicate)

DrawDamageable

Parameters

  • spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch

  • damageEffect Microsoft.Xna.Framework.Graphics.Effect

  • editing bool

  • predicate Predicate

Submarine.DrawFront(spriteBatch, editing, predicate)

DrawFront

Parameters

  • spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch

  • editing bool

  • predicate Predicate

Submarine.DrawGrid(spriteBatch, gridCells, gridCenter, roundedGridCenter, alpha)

DrawGrid

Parameters

  • spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch

  • gridCells number

  • gridCenter Microsoft.Xna.Framework.Vector2

  • roundedGridCenter Microsoft.Xna.Framework.Vector2

  • alpha number

Submarine.DrawPaintedColors(spriteBatch, editing, predicate)

DrawPaintedColors

Parameters

  • spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch

  • editing bool

  • predicate Predicate

Submarine.FindClosest(worldPosition, ignoreOutposts, ignoreOutsideLevel, ignoreRespawnShuttle, teamType)

FindClosest

Parameters

  • worldPosition Microsoft.Xna.Framework.Vector2

  • ignoreOutposts bool

  • ignoreOutsideLevel bool

  • ignoreRespawnShuttle bool

  • teamType optional CharacterTeamType

Returns

Submarine.FindContaining(worldPosition, inflate)

FindContaining

Parameters

  • worldPosition Microsoft.Xna.Framework.Vector2

  • inflate number

Returns

Submarine.FindContainingInLocalCoordinates(position, inflate)

FindContainingInLocalCoordinates

Parameters

  • position Microsoft.Xna.Framework.Vector2

  • inflate number

Returns

Submarine.ForceRemoveFromVisibleEntities(entity)

ForceRemoveFromVisibleEntities

Parameters

  • entity MapEntity

Submarine.ForceVisibilityRecheck()

ForceVisibilityRecheck

Submarine.GetBorders(submarineElement)

GetBorders

Parameters

  • submarineElement Xml.Linq.XElement

Returns

  • Microsoft.Xna.Framework.Rectangle

Submarine.GetLightCount()

GetLightCount

Returns

  • number

Submarine.GetRelativeSimPosition(targetSimPos, fromSub, toSub)

GetRelativeSimPosition

Parameters

  • targetSimPos Microsoft.Xna.Framework.Vector2

Returns

  • Microsoft.Xna.Framework.Vector2

Submarine.GetRelativeSimPosition(from, to, targetWorldPos)

GetRelativeSimPosition

Parameters

  • from ISpatialEntity

  • to ISpatialEntity

  • targetWorldPos optional Microsoft.Xna.Framework.Vector2

Returns

  • Microsoft.Xna.Framework.Vector2

Submarine.GetRelativeSimPositionFromWorldPosition(targetWorldPos, fromSub, toSub)

GetRelativeSimPositionFromWorldPosition

Parameters

  • targetWorldPos Microsoft.Xna.Framework.Vector2

Returns

  • Microsoft.Xna.Framework.Vector2

Submarine.GetShadowCastingLightCount()

GetShadowCastingLightCount

Returns

  • number

Submarine.GetSubItemSwapPerksFromTeamPerks(teamPerks)

GetSubItemSwapPerksFromTeamPerks

Parameters

  • teamPerks Collections.Immutable.ImmutableArray

Returns

  • Collections.Immutable.ImmutableArray

Submarine.LastPickedBodyDist(body)

LastPickedBodyDist

Parameters

  • body FarseerPhysics.Dynamics.Body

Returns

  • number

Submarine.LayerExistsInAnySub(layer)

LayerExistsInAnySub

Parameters

  • layer Identifier

Returns

  • bool

Submarine.Load(info, unloadPrevious, linkedRemap)

Load

Parameters

  • info SubmarineInfo

  • unloadPrevious bool

  • linkedRemap IdRemap

Returns

Submarine.MouseToWorldGrid(cam, sub, mousePos, round)

MouseToWorldGrid

Parameters

  • cam Camera

  • mousePos optional Microsoft.Xna.Framework.Vector2

  • round bool

Returns

  • Microsoft.Xna.Framework.Vector2

Submarine.PickBodies(rayStart, rayEnd, ignoredBodies, collisionCategory, ignoreSensors, customPredicate, allowInsideFixture)

PickBodies

Parameters

  • rayStart Microsoft.Xna.Framework.Vector2

  • rayEnd Microsoft.Xna.Framework.Vector2

  • ignoredBodies IEnumerable

  • collisionCategory optional FarseerPhysics.Dynamics.Category

  • ignoreSensors bool

  • customPredicate Predicate

  • allowInsideFixture bool

Returns

  • IEnumerable

Submarine.PickBody(rayStart, rayEnd, ignoredBodies, collisionCategory, ignoreSensors, customPredicate, allowInsideFixture)

PickBody

Parameters

  • rayStart Microsoft.Xna.Framework.Vector2

  • rayEnd Microsoft.Xna.Framework.Vector2

  • ignoredBodies IEnumerable

  • collisionCategory optional FarseerPhysics.Dynamics.Category

  • ignoreSensors bool

  • customPredicate Predicate

  • allowInsideFixture bool

Returns

  • FarseerPhysics.Dynamics.Body

Submarine.RectContains(rect, pos, inclusive)

RectContains

Parameters

  • rect Microsoft.Xna.Framework.Rectangle

  • pos Microsoft.Xna.Framework.Vector2

  • inclusive bool

Returns

  • bool

Submarine.RectsOverlap(rect1, rect2, inclusive)

RectsOverlap

Parameters

  • rect1 Microsoft.Xna.Framework.Rectangle

  • rect2 Microsoft.Xna.Framework.Rectangle

  • inclusive bool

Returns

  • bool

Submarine.RectsOverlap(rect1, rect2, inclusive)

RectsOverlap

Parameters

  • rect1 Microsoft.Xna.Framework.RectangleF

  • rect2 Microsoft.Xna.Framework.RectangleF

  • inclusive bool

Returns

  • bool

Submarine.RepositionEntities(moveAmount, entities)

RepositionEntities

Parameters

  • moveAmount Microsoft.Xna.Framework.Vector2

  • entities IEnumerable

Submarine.SetLayerEnabled(layer, enabled, entities)

SetLayerEnabled

Parameters

  • layer Identifier

  • enabled bool

  • entities IEnumerable

Submarine.Unload()

Unload

Submarine.VectorToWorldGrid(position, sub, round)

VectorToWorldGrid

Parameters

  • position Microsoft.Xna.Framework.Vector2

  • round bool

Returns

  • Microsoft.Xna.Framework.Vector2

ToString()

ToString

Returns

Translate(amount)

Translate

Parameters

  • amount Microsoft.Xna.Framework.Vector2

TrySaveAs(filePath, previewImage)

TrySaveAs

Parameters

  • previewImage IO.MemoryStream

Returns

  • bool

Update(deltaTime)

Update

Parameters

  • deltaTime number

UpdateTransform(interpolate)

UpdateTransform

Parameters

  • interpolate bool

Fields

AiTarget

AiTarget, field of type AITarget

  • AiTarget

AtDamageDepth

AtDamageDepth, field of type bool

  • AtDamageDepth

AtEitherExit

AtEitherExit, field of type bool

  • AtEitherExit

AtEndExit

AtEndExit, field of type bool

  • AtEndExit

AtStartExit

AtStartExit, field of type bool

  • AtStartExit

Borders

Borders, field of type Microsoft.Xna.Framework.Rectangle

  • Borders

ConnectedDockingPorts

ConnectedDockingPorts, field of type table

  • ConnectedDockingPorts

CreationIndex

CreationIndex, field of type number

  • CreationIndex

CreationStackTrace

CreationStackTrace, field of type string

  • CreationStackTrace

DockedTo

DockedTo, field of type IEnumerable

  • DockedTo

DrawPosition

DrawPosition, field of type Microsoft.Xna.Framework.Vector2

  • DrawPosition

ErrorLine

ErrorLine, field of type string

  • ErrorLine

ExitPoints

ExitPoints, field of type IReadOnlyList

  • ExitPoints

FlippedX

FlippedX, field of type bool

  • FlippedX

ForcedOutpostModuleWayPoints

ForcedOutpostModuleWayPoints, field of type table

  • ForcedOutpostModuleWayPoints

GodMode

GodMode, field of type bool

  • GodMode

HiddenSubPosition

HiddenSubPosition, field of type Microsoft.Xna.Framework.Vector2

  • HiddenSubPosition

HullVertices

HullVertices, field of type table

  • HullVertices

ID

ID, field of type number

  • ID

IdFreed

IdFreed, field of type bool

  • IdFreed

IdOffset

IdOffset, field of type number

  • IdOffset

ImmuneToBallastFlora

ImmuneToBallastFlora, field of type bool

  • ImmuneToBallastFlora

InDetectable

InDetectable, field of type bool

  • InDetectable

Info

Info, field of type SubmarineInfo

  • Info

IsAboveLevel

IsAboveLevel, field of type bool

  • IsAboveLevel

IsRespawnShuttle

IsRespawnShuttle, field of type bool

  • IsRespawnShuttle

Loading

Loading, field of type bool

  • Loading

PhysicsBody

PhysicsBody, field of type PhysicsBody

  • PhysicsBody

Position

Position, field of type Microsoft.Xna.Framework.Vector2

  • Position

RealWorldCrushDepth

RealWorldCrushDepth, field of type number

  • RealWorldCrushDepth

RealWorldDepth

RealWorldDepth, field of type number

  • RealWorldDepth

Removed

Removed, field of type bool

  • Removed

ShowSonarMarker

ShowSonarMarker, field of type bool

  • ShowSonarMarker

SimPosition

SimPosition, field of type Microsoft.Xna.Framework.Vector2

  • SimPosition

SpawnTime

SpawnTime, field of type number

  • SpawnTime

SubBody

SubBody, field of type SubmarineBody

  • SubBody

Submarine

Submarine, field of type Submarine

  • Submarine

Submarine.DamageEffectColor

Submarine.DamageEffectColor, field of type Microsoft.Xna.Framework.Color

Submarine.DamageEffectCutoff

Submarine.DamageEffectCutoff, field of type number

Submarine.GridSize

Submarine.GridSize, field of type Microsoft.Xna.Framework.Vector2

Submarine.HiddenSubStartPosition

Submarine.HiddenSubStartPosition, field of type Microsoft.Xna.Framework.Vector2

Submarine.LastPickedFixture

Submarine.LastPickedFixture, field of type FarseerPhysics.Dynamics.Fixture

Submarine.LastPickedFraction

Submarine.LastPickedFraction, field of type number

Submarine.LastPickedNormal

Submarine.LastPickedNormal, field of type Microsoft.Xna.Framework.Vector2

Submarine.LastPickedPosition

Submarine.LastPickedPosition, field of type Microsoft.Xna.Framework.Vector2

Submarine.Loaded

Submarine.Loaded, field of type table

Submarine.LockX

Submarine.LockX, field of type bool

Submarine.LockY

Submarine.LockY, field of type bool

Submarine.MainSub

Submarine.MainSub, field of type Submarine

Submarine.MainSubs

Submarine.MainSubs, field of type Submarine[]

Submarine.Unloading

Submarine.Unloading, field of type bool

Submarine.VisibleEntities

Submarine.VisibleEntities, field of type IEnumerable

SubmarineSpecificIDTag

SubmarineSpecificIDTag, field of type number

  • SubmarineSpecificIDTag

TeamID

TeamID, field of type CharacterTeamType

  • TeamID

TurretAI

TurretAI, field of type SubmarineTurretAI

  • TurretAI

Velocity

Velocity, field of type Microsoft.Xna.Framework.Vector2

  • Velocity

VisibleBorders

VisibleBorders, field of type Microsoft.Xna.Framework.Rectangle

  • VisibleBorders

WorldPosition

WorldPosition, field of type Microsoft.Xna.Framework.Vector2

  • WorldPosition

WreckAI

WreckAI, field of type WreckAI

  • WreckAI