Barotrauma Server Doc
Barotrauma.Structure Class Reference
Inheritance diagram for Barotrauma.Structure:
Barotrauma.ISerializableEntity Barotrauma.Networking.IServerSerializable Barotrauma.IDamageable Barotrauma.MapEntity Barotrauma.ISerializableEntity Barotrauma.Networking.IServerSerializable Barotrauma.IDamageable Barotrauma.MapEntity

Public Member Functions

override void Move (Vector2 amount, bool ignoreContacts=true)
 
 Structure (Rectangle rectangle, StructurePrefab sp, Submarine submarine, ushort id=Entity.NullEntityID, XElement element=null)
 
override string ToString ()
 
override MapEntity Clone ()
 
override Quad2D GetTransformedQuad ()
 
override bool IsMouseOn (Vector2 position)
 
override void ShallowRemove ()
 Remove the entity from the entity list without removing links to other entities More...
 
override void Remove ()
 
WallSection GetSection (int sectionIndex)
 
bool SectionBodyDisabled (int sectionIndex)
 
bool AllSectionBodiesDisabled ()
 
bool SectionIsLeaking (int sectionIndex)
 Sections that are leaking have a gap placed on them More...
 
bool SectionIsLeakingFromOutside (int sectionIndex)
 
int SectionLength (int sectionIndex)
 
override bool AddUpgrade (Upgrade upgrade, bool createNetworkEvent=false)
 Adds a new upgrade to the item More...
 
void AddDamage (int sectionIndex, float damage, Character attacker=null, bool emitParticles=true)
 
int FindSectionIndex (Vector2 displayPos, bool world=false, bool clamp=false)
 
float SectionDamage (int sectionIndex)
 
Vector2 SectionPosition (int sectionIndex, bool world=false)
 
AttackResult AddDamage (Character attacker, Vector2 worldPosition, Attack attack, Vector2 impulseDirection, float deltaTime, bool playSound=false)
 
void SetDamage (int sectionIndex, float damage, Character attacker=null, bool createNetworkEvent=true, bool isNetworkEvent=true, bool createExplosionEffect=true)
 
void SetCollisionCategory (Category collisionCategory)
 
override void FlipX (bool relativeToSub)
 Flip the entity horizontally More...
 
override void FlipY (bool relativeToSub)
 Flip the entity vertically More...
 
override XElement Save (XElement parentElement)
 
override void OnMapLoaded ()
 
virtual void Reset ()
 
override void Update (float deltaTime, Camera cam)
 
void ServerEventWrite (IWriteMessage msg, Client c, NetEntityEvent.IData extraData=null)
 
- Public Member Functions inherited from Barotrauma.MapEntity
void AddLinked (MapEntity entity)
 
 MapEntity (MapEntityPrefab prefab, Submarine submarine, ushort id)
 
void ResolveLinks (IdRemap childRemap)
 
bool HasUpgrade (Identifier identifier)
 
Upgrade GetUpgrade (Identifier identifier)
 
List< Upgrade > GetUpgrades ()
 
void SetUpgrade (Upgrade upgrade, bool createNetworkEvent=false)
 
void RemoveLinked (MapEntity e)
 
HashSet< T > GetLinkedEntities< T > (HashSet< T > list=null, int? maxDepth=null, Func< T, bool > filter=null)
 Gets all linked entities of specific type. More...
 
- 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. More...
 

Static Public Member Functions

static Structure GetAttachTarget (Vector2 worldPosition)
 Checks if there's a structure items can be attached to at the given position and returns it. More...
 
static Structure Load (ContentXElement element, Submarine submarine, IdRemap idRemap)
 
static StructurePrefab FindPrefab (string name, Identifier identifier)
 
- Static Public Member Functions inherited from Barotrauma.MapEntity
static void ClearHighlightedEntities ()
 
static List< MapEntityClone (List< MapEntity > entitiesToClone)
 
static void UpdateAll (float deltaTime, Camera cam)
 Call Update() on every object in Entity.list More...
 
static List< MapEntityLoadAll (Submarine submarine, XElement parentElement, string filePath, int idOffset)
 
static void MapLoaded (List< MapEntity > entities, bool updateHulls)
 
static void InitializeLoadedLinks (IEnumerable< MapEntity > entities)
 
- 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 More...
 
static Entity FindEntityByID (ushort ID)
 Find an entity based on the ID More...
 
static void RemoveAll ()
 
static void DumpIds (int count, string filename)
 

Static Public Attributes

const int WallSectionSize = 96
 
static List< StructureWallList = new List<Structure>()
 
- Static Public Attributes inherited from Barotrauma.MapEntity
static readonly List< MapEntityMapEntityList = new List<MapEntity>()
 
static int MapEntityUpdateInterval = 1
 
static int PoweredUpdateInterval = 1
 
- 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
 

Protected Attributes

Color spriteColor
 
float rotationRad = 0f
 
Vector2 textureScale = Vector2.One
 
Vector2 textureOffset = Vector2.Zero
 
- Protected Attributes inherited from Barotrauma.MapEntity
List< ushort > linkedToID
 
readonly List< Upgrade > Upgrades = new List<Upgrade>()
 List of upgrades this item has More...
 
bool flippedX
 
Rectangle rect
 
- Protected Attributes inherited from Barotrauma.Entity
AITarget aiTarget
 

Properties

bool Indestructible [get, set]
 
WallSection[] Sections [get]
 
override Sprite Sprite [get]
 
bool IsPlatform [get]
 
Direction StairDirection [get]
 
override string Name [get]
 
bool HasBody [get]
 
List< Body > Bodies [get]
 
bool CastShadow [get, set]
 
bool IsHorizontal [get]
 
int SectionCount [get]
 
float?? MaxHealth [get, set]
 
float CrushDepth [get, set]
 
float Health [get]
 
override bool DrawBelowWater [get]
 
override bool DrawOverWater [get]
 
bool DrawDamageEffect [get]
 
bool HasDamage [get]
 
new StructurePrefab Prefab [get]
 
ImmutableHashSet< IdentifierTags [get]
 
string SpecialTag [get, set]
 
Color SpriteColor [get, set]
 
bool UseDropShadow [get]
 
Vector2 DropShadowOffset [get]
 
override float?? Scale [get, set]
 
float Rotation [get, set]
 
Vector2 TextureScale [get, set]
 
float ScaleWhenTextureOffsetSet = 1.0f [get]
 
Vector2 TextureOffset [get, set]
 
Rectangle DefaultRect [get, set]
 Unscaled rect More...
 
override Rectangle Rect [get, set]
 
float? BodyWidth [get]
 
float? BodyHeight [get]
 
float BodyRotation [get]
 In radians, takes flipping into account More...
 
Vector2 BodyOffset [get]
 Offset of the physics body from the center of the structure. Takes flipping into account. More...
 
bool NoAITarget [get]
 
Dictionary< Identifier, SerializablePropertySerializableProperties [get]
 
Vector2? DirectionUnit [get]
 
- Properties inherited from Barotrauma.MapEntity
string DisallowedUpgrades [get, set]
 
bool FlippedX [get]
 
bool FlippedY [get]
 
static IEnumerable< MapEntityHighlightedEntities [get]
 
bool ExternalHighlight [get, set]
 
bool IsHighlighted [get, set]
 
virtual Rectangle Rect [get, set]
 
Rectangle? WorldRect [get]
 
virtual Sprite Sprite [get]
 
virtual bool DrawBelowWater [get]
 
virtual bool DrawOverWater [get]
 
virtual bool Linkable [get]
 
IEnumerable< IdentifierAllowedLinks [get]
 
bool ResizeHorizontal [get]
 
bool ResizeVertical [get]
 
int RectWidth [get, set]
 
int RectHeight [get, set]
 
bool SpriteDepthOverrideIsSet [get]
 
float SpriteOverrideDepth [get]
 
float? SpriteDepth [get, set]
 
virtual float Scale = 1 [get, set]
 
bool HiddenInGame [get, set]
 
override Vector2 Position [get]
 
override Vector2 SimPosition [get]
 
float SoundRange [get, set]
 
float SightRange [get, set]
 
bool RemoveIfLinkedOutpostDoorInUse = true [get, protected set]
 
string Layer [get, set]
 
virtual string Name [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]
 
double SpawnTime [get]
 
string ErrorLine [get]
 
- Properties inherited from Barotrauma.ISpatialEntity
Vector2 Position [get]
 
Vector2 WorldPosition [get]
 
Vector2 SimPosition [get]
 
Submarine Submarine [get]
 
- Properties inherited from Barotrauma.IDamageable
Vector2 SimPosition [get]
 
Vector2 WorldPosition [get]
 
float Health [get]
 
- Properties inherited from Barotrauma.ISerializableEntity
string Name [get]
 
Dictionary< Identifier, SerializablePropertySerializableProperties [get]
 

Additional Inherited Members

- Public Attributes inherited from Barotrauma.MapEntity
readonly MapEntityPrefab Prefab
 
List< ushort > unresolvedLinkedToID
 
readonly HashSet< IdentifierDisallowedUpgradeSet = new HashSet<Identifier>()
 
readonly List< MapEntitylinkedTo = new List<MapEntity>()
 
bool ShouldBeSaved = true
 
int OriginalModuleIndex = -1
 The index of the outpost module this entity originally spawned in (-1 if not an outpost item) More...
 
int OriginalContainerIndex = -1
 
- 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. More...
 
readonly string CreationStackTrace
 
readonly UInt64 CreationIndex
 
- Protected Member Functions inherited from Barotrauma.MapEntity
void ParseLinks (XElement element, IdRemap idRemap)
 
virtual void CheckIsHighlighted ()
 
void InsertToList ()
 
- Protected Member Functions inherited from Barotrauma.Entity
virtual ushort DetermineID (ushort id, Submarine submarine)
 
- Static Protected Attributes inherited from Barotrauma.MapEntity
static readonly HashSet< MapEntityhighlightedEntities = new HashSet<MapEntity>()
 

Detailed Description

Constructor & Destructor Documentation

◆ Structure()

Barotrauma.Structure.Structure ( Rectangle  rectangle,
StructurePrefab  sp,
Submarine  submarine,
ushort  id = Entity.NullEntityID,
XElement  element = null 
)

Member Function Documentation

◆ AddDamage() [1/2]

AttackResult Barotrauma.Structure.AddDamage ( Character  attacker,
Vector2  worldPosition,
Attack  attack,
Vector2  impulseDirection,
float  deltaTime,
bool  playSound = false 
)

◆ AddDamage() [2/2]

void Barotrauma.Structure.AddDamage ( int  sectionIndex,
float  damage,
Character  attacker = null,
bool  emitParticles = true 
)

◆ AddUpgrade()

override bool Barotrauma.Structure.AddUpgrade ( Upgrade  upgrade,
bool  createNetworkEvent = false 
)
virtual

Adds a new upgrade to the item

Reimplemented from Barotrauma.MapEntity.

Definition at line 942 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ AllSectionBodiesDisabled()

bool Barotrauma.Structure.AllSectionBodiesDisabled ( )

◆ Clone()

override MapEntity Barotrauma.Structure.Clone ( )
virtual

◆ FindPrefab()

static StructurePrefab Barotrauma.Structure.FindPrefab ( string  name,
Identifier  identifier 
)
static

◆ FindSectionIndex()

int Barotrauma.Structure.FindSectionIndex ( Vector2  displayPos,
bool  world = false,
bool  clamp = false 
)

◆ FlipX()

override void Barotrauma.Structure.FlipX ( bool  relativeToSub)
virtual

Flip the entity horizontally

Parameters
relativeToSubShould the entity be flipped across the y-axis of the sub it's inside

Reimplemented from Barotrauma.MapEntity.

Definition at line 1521 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ FlipY()

override void Barotrauma.Structure.FlipY ( bool  relativeToSub)
virtual

Flip the entity vertically

Parameters
relativeToSubShould the entity be flipped across the x-axis of the sub it's inside

Reimplemented from Barotrauma.MapEntity.

Definition at line 1549 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ GetAttachTarget()

static Structure Barotrauma.Structure.GetAttachTarget ( Vector2  worldPosition)
static

Checks if there's a structure items can be attached to at the given position and returns it.

Definition at line 753 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ GetSection()

WallSection Barotrauma.Structure.GetSection ( int  sectionIndex)

◆ GetTransformedQuad()

override Quad2D Barotrauma.Structure.GetTransformedQuad ( )
virtual

Reimplemented from Barotrauma.MapEntity.

◆ IsMouseOn()

override bool Barotrauma.Structure.IsMouseOn ( Vector2  position)
virtual

Reimplemented from Barotrauma.MapEntity.

Definition at line 768 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ Load()

static Structure Barotrauma.Structure.Load ( ContentXElement  element,
Submarine  submarine,
IdRemap  idRemap 
)
static

◆ Move()

override void Barotrauma.Structure.Move ( Vector2  amount,
bool  ignoreContacts = true 
)
virtual

Reimplemented from Barotrauma.MapEntity.

Definition at line 412 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ OnMapLoaded()

override void Barotrauma.Structure.OnMapLoaded ( )
virtual

Reimplemented from Barotrauma.MapEntity.

Definition at line 1752 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ Remove()

override void Barotrauma.Structure.Remove ( )
virtual

Reimplemented from Barotrauma.MapEntity.

Definition at line 839 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ Reset()

virtual void Barotrauma.Structure.Reset ( )
virtual

◆ Save()

override XElement Barotrauma.Structure.Save ( XElement  parentElement)
virtual

Reimplemented from Barotrauma.MapEntity.

Definition at line 1706 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ SectionBodyDisabled()

bool Barotrauma.Structure.SectionBodyDisabled ( int  sectionIndex)

◆ SectionDamage()

float Barotrauma.Structure.SectionDamage ( int  sectionIndex)

◆ SectionIsLeaking()

bool Barotrauma.Structure.SectionIsLeaking ( int  sectionIndex)

Sections that are leaking have a gap placed on them

Definition at line 923 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ SectionIsLeakingFromOutside()

bool Barotrauma.Structure.SectionIsLeakingFromOutside ( int  sectionIndex)

◆ SectionLength()

int Barotrauma.Structure.SectionLength ( int  sectionIndex)

◆ SectionPosition()

Vector2 Barotrauma.Structure.SectionPosition ( int  sectionIndex,
bool  world = false 
)

◆ ServerEventWrite()

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

◆ SetCollisionCategory()

void Barotrauma.Structure.SetCollisionCategory ( Category  collisionCategory)

◆ SetDamage()

void Barotrauma.Structure.SetDamage ( int  sectionIndex,
float  damage,
Character  attacker = null,
bool  createNetworkEvent = true,
bool  isNetworkEvent = true,
bool  createExplosionEffect = true 
)

◆ ShallowRemove()

override void Barotrauma.Structure.ShallowRemove ( )
virtual

Remove the entity from the entity list without removing links to other entities

Reimplemented from Barotrauma.MapEntity.

Definition at line 803 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ ToString()

override string Barotrauma.Structure.ToString ( )

◆ Update()

override void Barotrauma.Structure.Update ( float  deltaTime,
Camera  cam 
)
virtual

Reimplemented from Barotrauma.MapEntity.

Definition at line 1769 of file BarotraumaShared/SharedSource/Map/Structure.cs.

Member Data Documentation

◆ rotationRad

float Barotrauma.Structure.rotationRad = 0f
protected

◆ spriteColor

Color Barotrauma.Structure.spriteColor
protected

◆ textureOffset

Vector2 Barotrauma.Structure.textureOffset = Vector2.Zero
protected

◆ textureScale

Vector2 Barotrauma.Structure.textureScale = Vector2.One
protected

◆ WallList

List<Structure> Barotrauma.Structure.WallList = new List<Structure>()
static

◆ WallSectionSize

const int Barotrauma.Structure.WallSectionSize = 96
static

Property Documentation

◆ Bodies

List<Body> Barotrauma.Structure.Bodies
get

◆ BodyHeight

float? Barotrauma.Structure.BodyHeight
get

◆ BodyOffset

Vector2 Barotrauma.Structure.BodyOffset
get

Offset of the physics body from the center of the structure. Takes flipping into account.

Definition at line 384 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ BodyRotation

float Barotrauma.Structure.BodyRotation
get

In radians, takes flipping into account

Definition at line 362 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ BodyWidth

float? Barotrauma.Structure.BodyWidth
get

◆ CastShadow

bool Barotrauma.Structure.CastShadow
getset

◆ CrushDepth

float Barotrauma.Structure.CrushDepth
getset

◆ DefaultRect

Rectangle Barotrauma.Structure.DefaultRect
getset

Unscaled rect

Definition at line 311 of file BarotraumaShared/SharedSource/Map/Structure.cs.

◆ DirectionUnit

Vector2? Barotrauma.Structure.DirectionUnit
getprotected

◆ DrawBelowWater

override bool Barotrauma.Structure.DrawBelowWater
get

◆ DrawDamageEffect

bool Barotrauma.Structure.DrawDamageEffect
get

◆ DrawOverWater

override bool Barotrauma.Structure.DrawOverWater
get

◆ DropShadowOffset

Vector2 Barotrauma.Structure.DropShadowOffset
get

◆ HasBody

bool Barotrauma.Structure.HasBody
get

◆ HasDamage

bool Barotrauma.Structure.HasDamage
get

◆ Health

float Barotrauma.Structure.Health
get

◆ Indestructible

bool Barotrauma.Structure.Indestructible
getset

◆ IsHorizontal

bool Barotrauma.Structure.IsHorizontal
get

◆ IsPlatform

bool Barotrauma.Structure.IsPlatform
get

◆ MaxHealth

float?? Barotrauma.Structure.MaxHealth
getset

◆ Name

override string Barotrauma.Structure.Name
get

◆ NoAITarget

bool Barotrauma.Structure.NoAITarget
get

◆ Prefab

new StructurePrefab Barotrauma.Structure.Prefab
get

◆ Rect

override Rectangle Barotrauma.Structure.Rect
getset

◆ Rotation

float Barotrauma.Structure.Rotation
getset

◆ Scale

override float?? Barotrauma.Structure.Scale
getset

◆ ScaleWhenTextureOffsetSet

float Barotrauma.Structure.ScaleWhenTextureOffsetSet = 1.0f
get

◆ SectionCount

int Barotrauma.Structure.SectionCount
get

◆ Sections

WallSection [] Barotrauma.Structure.Sections
get

◆ SerializableProperties

Dictionary<Identifier, SerializableProperty> Barotrauma.Structure.SerializableProperties
get

◆ SpecialTag

string Barotrauma.Structure.SpecialTag
getset

◆ Sprite

override Sprite Barotrauma.Structure.Sprite
get

◆ SpriteColor

Color Barotrauma.Structure.SpriteColor
getset

◆ StairDirection

Direction Barotrauma.Structure.StairDirection
get

◆ Tags

ImmutableHashSet<Identifier> Barotrauma.Structure.Tags
get

◆ TextureOffset

Vector2 Barotrauma.Structure.TextureOffset
getset

◆ TextureScale

Vector2 Barotrauma.Structure.TextureScale
getset

◆ UseDropShadow

bool Barotrauma.Structure.UseDropShadow
get