Barotrauma Server Doc
Barotrauma.MapEntity Class Referenceabstract
Inheritance diagram for Barotrauma.MapEntity:
Barotrauma.Entity Barotrauma.ISpatialEntity Barotrauma.ISpatialEntity Barotrauma.Gap Barotrauma.Hull Barotrauma.Hull Barotrauma.Item Barotrauma.Item Barotrauma.LinkedSubmarine Barotrauma.Structure Barotrauma.Structure Barotrauma.WayPoint

Public Member Functions

void AddLinked (MapEntity entity)
 
 MapEntity (MapEntityPrefab prefab, Submarine submarine, ushort id)
 
void ResolveLinks (IdRemap childRemap)
 
virtual void Move (Vector2 amount, bool ignoreContacts=true)
 
virtual bool IsMouseOn (Vector2 position)
 
bool HasUpgrade (Identifier identifier)
 
Upgrade GetUpgrade (Identifier identifier)
 
List< Upgrade > GetUpgrades ()
 
void SetUpgrade (Upgrade upgrade, bool createNetworkEvent=false)
 
virtual bool AddUpgrade (Upgrade upgrade, bool createNetworkEvent=false)
 Adds a new upgrade to the item More...
 
abstract MapEntity Clone ()
 
virtual void ShallowRemove ()
 Remove the entity from the entity list without removing links to other entities More...
 
override void Remove ()
 
virtual void Update (float deltaTime, Camera cam)
 
virtual void FlipX (bool relativeToSub)
 Flip the entity horizontally More...
 
virtual void FlipY (bool relativeToSub)
 Flip the entity vertically More...
 
virtual Quad2D GetTransformedQuad ()
 
virtual void OnMapLoaded ()
 
virtual XElement Save (XElement parentElement)
 
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 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)
 

Public Attributes

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
 

Static Public Attributes

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 Member Functions

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)
 

Protected Attributes

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
 

Static Protected Attributes

static readonly HashSet< MapEntityhighlightedEntities = new HashSet<MapEntity>()
 

Properties

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]
 

Detailed Description

Constructor & Destructor Documentation

◆ MapEntity()

Barotrauma.MapEntity.MapEntity ( MapEntityPrefab  prefab,
Submarine  submarine,
ushort  id 
)

Definition at line 274 of file MapEntity.cs.

Member Function Documentation

◆ AddLinked()

void Barotrauma.MapEntity.AddLinked ( MapEntity  entity)

◆ AddUpgrade()

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

Adds a new upgrade to the item

Reimplemented in Barotrauma.Structure.

Definition at line 364 of file MapEntity.cs.

◆ CheckIsHighlighted()

virtual void Barotrauma.MapEntity.CheckIsHighlighted ( )
protectedvirtual

Definition at line 390 of file MapEntity.cs.

◆ ClearHighlightedEntities()

static void Barotrauma.MapEntity.ClearHighlightedEntities ( )
static

Definition at line 403 of file MapEntity.cs.

◆ Clone() [1/2]

abstract MapEntity Barotrauma.MapEntity.Clone ( )
pure virtual

◆ Clone() [2/2]

static List<MapEntity> Barotrauma.MapEntity.Clone ( List< MapEntity entitiesToClone)
static

Definition at line 417 of file MapEntity.cs.

◆ FlipX()

virtual void Barotrauma.MapEntity.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 in Barotrauma.Structure, and Barotrauma.Item.

Definition at line 690 of file MapEntity.cs.

◆ FlipY()

virtual void Barotrauma.MapEntity.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 in Barotrauma.Structure, and Barotrauma.Item.

Definition at line 704 of file MapEntity.cs.

◆ GetLinkedEntities< T >()

HashSet<T> Barotrauma.MapEntity.GetLinkedEntities< T > ( HashSet< T >  list = null,
int?  maxDepth = null,
Func< T, bool >  filter = null 
)

Gets all linked entities of specific type.

Type Constraints
T :MapEntity 

Definition at line 938 of file MapEntity.cs.

◆ GetTransformedQuad()

virtual Quad2D Barotrauma.MapEntity.GetTransformedQuad ( )
virtual

Reimplemented in Barotrauma.Structure, and Barotrauma.Item.

◆ GetUpgrade()

Upgrade Barotrauma.MapEntity.GetUpgrade ( Identifier  identifier)

Definition at line 335 of file MapEntity.cs.

◆ GetUpgrades()

List<Upgrade> Barotrauma.MapEntity.GetUpgrades ( )

Definition at line 340 of file MapEntity.cs.

◆ HasUpgrade()

bool Barotrauma.MapEntity.HasUpgrade ( Identifier  identifier)

Definition at line 330 of file MapEntity.cs.

◆ InitializeLoadedLinks()

static void Barotrauma.MapEntity.InitializeLoadedLinks ( IEnumerable< MapEntity entities)
static

Definition at line 892 of file MapEntity.cs.

◆ InsertToList()

void Barotrauma.MapEntity.InsertToList ( )
protected

Definition at line 534 of file MapEntity.cs.

◆ IsMouseOn()

virtual bool Barotrauma.MapEntity.IsMouseOn ( Vector2  position)
virtual

Reimplemented in Barotrauma.Structure, Barotrauma.LinkedSubmarine, Barotrauma.Gap, and Barotrauma.Hull.

Definition at line 325 of file MapEntity.cs.

◆ LoadAll()

static List<MapEntity> Barotrauma.MapEntity.LoadAll ( Submarine  submarine,
XElement  parentElement,
string  filePath,
int  idOffset 
)
static

Definition at line 717 of file MapEntity.cs.

◆ MapLoaded()

static void Barotrauma.MapEntity.MapLoaded ( List< MapEntity entities,
bool  updateHulls 
)
static

Definition at line 832 of file MapEntity.cs.

◆ Move()

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

Reimplemented in Barotrauma.Structure, Barotrauma.Hull, Barotrauma.Gap, and Barotrauma.Item.

Definition at line 319 of file MapEntity.cs.

◆ OnMapLoaded()

virtual void Barotrauma.MapEntity.OnMapLoaded ( )
virtual

◆ ParseLinks()

void Barotrauma.MapEntity.ParseLinks ( XElement  element,
IdRemap  idRemap 
)
protected

Definition at line 280 of file MapEntity.cs.

◆ Remove()

override void Barotrauma.MapEntity.Remove ( )
virtual

Reimplemented from Barotrauma.Entity.

Reimplemented in Barotrauma.WayPoint, and Barotrauma.Structure.

Definition at line 578 of file MapEntity.cs.

◆ RemoveLinked()

void Barotrauma.MapEntity.RemoveLinked ( MapEntity  e)

Definition at line 929 of file MapEntity.cs.

◆ ResolveLinks()

void Barotrauma.MapEntity.ResolveLinks ( IdRemap  childRemap)

Definition at line 301 of file MapEntity.cs.

◆ Save()

virtual XElement Barotrauma.MapEntity.Save ( XElement  parentElement)
virtual

◆ SetUpgrade()

void Barotrauma.MapEntity.SetUpgrade ( Upgrade  upgrade,
bool  createNetworkEvent = false 
)

Definition at line 345 of file MapEntity.cs.

◆ ShallowRemove()

virtual void Barotrauma.MapEntity.ShallowRemove ( )
virtual

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

Reimplemented in Barotrauma.WayPoint, Barotrauma.Structure, Barotrauma.Hull, Barotrauma.Gap, and Barotrauma.Item.

Definition at line 569 of file MapEntity.cs.

◆ Update()

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

Reimplemented in Barotrauma.Structure, Barotrauma.Hull, Barotrauma.Gap, and Barotrauma.Item.

Definition at line 684 of file MapEntity.cs.

◆ UpdateAll()

static void Barotrauma.MapEntity.UpdateAll ( float  deltaTime,
Camera  cam 
)
static

Call Update() on every object in Entity.list

Definition at line 606 of file MapEntity.cs.

Member Data Documentation

◆ DisallowedUpgradeSet

readonly HashSet<Identifier> Barotrauma.MapEntity.DisallowedUpgradeSet = new HashSet<Identifier>()

Definition at line 31 of file MapEntity.cs.

◆ flippedX

bool Barotrauma.MapEntity.flippedX
protected

Definition at line 54 of file MapEntity.cs.

◆ highlightedEntities

readonly HashSet<MapEntity> Barotrauma.MapEntity.highlightedEntities = new HashSet<MapEntity>()
staticprotected

Definition at line 63 of file MapEntity.cs.

◆ linkedTo

readonly List<MapEntity> Barotrauma.MapEntity.linkedTo = new List<MapEntity>()

Definition at line 52 of file MapEntity.cs.

◆ linkedToID

List<ushort> Barotrauma.MapEntity.linkedToID
protected

Definition at line 19 of file MapEntity.cs.

◆ MapEntityList

readonly List<MapEntity> Barotrauma.MapEntity.MapEntityList = new List<MapEntity>()
static

Definition at line 15 of file MapEntity.cs.

◆ MapEntityUpdateInterval

int Barotrauma.MapEntity.MapEntityUpdateInterval = 1
static

Definition at line 22 of file MapEntity.cs.

◆ OriginalContainerIndex

int Barotrauma.MapEntity.OriginalContainerIndex = -1

Definition at line 267 of file MapEntity.cs.

◆ OriginalModuleIndex

int Barotrauma.MapEntity.OriginalModuleIndex = -1

The index of the outpost module this entity originally spawned in (-1 if not an outpost item)

Definition at line 265 of file MapEntity.cs.

◆ PoweredUpdateInterval

int Barotrauma.MapEntity.PoweredUpdateInterval = 1
static

Definition at line 23 of file MapEntity.cs.

◆ Prefab

readonly MapEntityPrefab Barotrauma.MapEntity.Prefab

Definition at line 17 of file MapEntity.cs.

◆ rect

Rectangle Barotrauma.MapEntity.rect
protected

Definition at line 61 of file MapEntity.cs.

◆ ShouldBeSaved

bool Barotrauma.MapEntity.ShouldBeSaved = true

Definition at line 58 of file MapEntity.cs.

◆ unresolvedLinkedToID

List<ushort> Barotrauma.MapEntity.unresolvedLinkedToID

Definition at line 20 of file MapEntity.cs.

◆ Upgrades

readonly List<Upgrade> Barotrauma.MapEntity.Upgrades = new List<Upgrade>()
protected

List of upgrades this item has

Definition at line 29 of file MapEntity.cs.

Property Documentation

◆ AllowedLinks

IEnumerable<Identifier> Barotrauma.MapEntity.AllowedLinks
get

Definition at line 135 of file MapEntity.cs.

◆ DisallowedUpgrades

string Barotrauma.MapEntity.DisallowedUpgrades
getset

Definition at line 34 of file MapEntity.cs.

◆ DrawBelowWater

virtual bool Barotrauma.MapEntity.DrawBelowWater
get

Definition at line 114 of file MapEntity.cs.

◆ DrawOverWater

virtual bool Barotrauma.MapEntity.DrawOverWater
get

Definition at line 122 of file MapEntity.cs.

◆ ExternalHighlight

bool Barotrauma.MapEntity.ExternalHighlight
getset

Definition at line 69 of file MapEntity.cs.

◆ FlippedX

bool Barotrauma.MapEntity.FlippedX
get

Definition at line 55 of file MapEntity.cs.

◆ FlippedY

bool Barotrauma.MapEntity.FlippedY
get

Definition at line 56 of file MapEntity.cs.

◆ HiddenInGame

bool Barotrauma.MapEntity.HiddenInGame
getset

Definition at line 197 of file MapEntity.cs.

◆ HighlightedEntities

IEnumerable<MapEntity> Barotrauma.MapEntity.HighlightedEntities
staticget

Definition at line 65 of file MapEntity.cs.

◆ IsHighlighted

bool Barotrauma.MapEntity.IsHighlighted
getset

Definition at line 85 of file MapEntity.cs.

◆ Layer

string Barotrauma.MapEntity.Layer
getset

Definition at line 260 of file MapEntity.cs.

◆ Linkable

virtual bool Barotrauma.MapEntity.Linkable
get

Definition at line 130 of file MapEntity.cs.

◆ Name

virtual string Barotrauma.MapEntity.Name
get

Definition at line 269 of file MapEntity.cs.

◆ Position

override Vector2 Barotrauma.MapEntity.Position
get

Definition at line 203 of file MapEntity.cs.

◆ Rect

virtual Rectangle Barotrauma.MapEntity.Rect
getset

Definition at line 98 of file MapEntity.cs.

◆ RectHeight

int Barotrauma.MapEntity.RectHeight
getset

Definition at line 159 of file MapEntity.cs.

◆ RectWidth

int Barotrauma.MapEntity.RectWidth
getset

Definition at line 148 of file MapEntity.cs.

◆ RemoveIfLinkedOutpostDoorInUse

bool Barotrauma.MapEntity.RemoveIfLinkedOutpostDoorInUse = true
getprotected set

Definition at line 253 of file MapEntity.cs.

◆ ResizeHorizontal

bool Barotrauma.MapEntity.ResizeHorizontal
get

Definition at line 137 of file MapEntity.cs.

◆ ResizeVertical

bool Barotrauma.MapEntity.ResizeVertical
get

Definition at line 141 of file MapEntity.cs.

◆ Scale

virtual float Barotrauma.MapEntity.Scale = 1
getset

Definition at line 194 of file MapEntity.cs.

◆ SightRange

float Barotrauma.MapEntity.SightRange
getset

Definition at line 238 of file MapEntity.cs.

◆ SimPosition

override Vector2 Barotrauma.MapEntity.SimPosition
get

Definition at line 216 of file MapEntity.cs.

◆ SoundRange

float Barotrauma.MapEntity.SoundRange
getset

Definition at line 224 of file MapEntity.cs.

◆ Sprite

virtual Sprite Barotrauma.MapEntity.Sprite
get

Definition at line 109 of file MapEntity.cs.

◆ SpriteDepth

float? Barotrauma.MapEntity.SpriteDepth
getset

Definition at line 175 of file MapEntity.cs.

◆ SpriteDepthOverrideIsSet

bool Barotrauma.MapEntity.SpriteDepthOverrideIsSet
get

Definition at line 171 of file MapEntity.cs.

◆ SpriteOverrideDepth

float Barotrauma.MapEntity.SpriteOverrideDepth
get

Definition at line 172 of file MapEntity.cs.

◆ WorldRect

Rectangle? Barotrauma.MapEntity.WorldRect
get

Definition at line 104 of file MapEntity.cs.