Show / Hide Table of Contents

Class ExplosionSystem

Inheritance
System.Object
ExplosionSystem
Implements
EntitySystem
Namespace: Content.Server.Explosion.EntitySystems
Assembly: Content.Server.dll
Syntax
public sealed class ExplosionSystem : EntitySystem, EntitySystem

Fields

| Improve this Doc View Source

DefaultExplosionPrototypeId

The "default" explosion prototype.

Declaration
public const string DefaultExplosionPrototypeId = null
Field Value
Type Description
System.String
Remarks

Generally components should specify an explosion prototype via a yaml datafield, so that the yaml-linter can find errors. However some components, like rogue arrows, or some commands like the admin-smite need to have a "default" option specified outside of yaml data-fields. Hence this const string.

| Improve this Doc View Source

DefaultTileSize

"Tile-size" for space when there are no nearby grids to use as a reference.

Declaration
public const ushort DefaultTileSize = null
Field Value
Type Description
System.UInt16

Properties

| Improve this Doc View Source

IncrementalTileBreaking

Declaration
public bool IncrementalTileBreaking { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

MaxArea

Declaration
public int MaxArea { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

MaxIterations

Declaration
public int MaxIterations { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

MaxProcessingTime

Declaration
public float MaxProcessingTime { get; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

SingleTickAreaLimit

Declaration
public int SingleTickAreaLimit { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

SleepNodeSys

Declaration
public bool SleepNodeSys { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

ThrowLimit

Declaration
public int ThrowLimit { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

TilesPerTick

Declaration
public int TilesPerTick { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

DamageFloorTile(TileRef, Single, Int32, Boolean, List<(Vector2i GridIndices, Tile Tile)>, ExplosionPrototype)

Tries to damage floor tiles. Not to be confused with the function that damages entities intersecting the grid tile.

Declaration
public void DamageFloorTile(TileRef tileRef, float effectiveIntensity, int maxTileBreak, bool canCreateVacuum, List<(Vector2i GridIndices, Tile Tile)> damagedTiles, ExplosionPrototype type)
Parameters
Type Name Description
Robust.Shared.Map.TileRef tileRef
System.Single effectiveIntensity
System.Int32 maxTileBreak
System.Boolean canCreateVacuum
List<System.ValueTuple<Vector2i, Robust.Shared.Map.Tile>> damagedTiles
ExplosionPrototype type
| Improve this Doc View Source

GenerateExplosionPreview(SpawnExplosionEuiMsg.PreviewRequest)

Declaration
public ExplosionVisualsState GenerateExplosionPreview(SpawnExplosionEuiMsg.PreviewRequest request)
Parameters
Type Name Description
SpawnExplosionEuiMsg.PreviewRequest request
Returns
Type Description
ExplosionVisualsState
| Improve this Doc View Source

GetExplosionTolerance(EntityUid, EntityQuery<DamageableComponent>, EntityQuery<DestructibleComponent>)

Return a dictionary that specifies how intense a given explosion type needs to be in order to destroy an entity.

Declaration
public float[] GetExplosionTolerance(EntityUid uid, EntityQuery<DamageableComponent> damageQuery, EntityQuery<DestructibleComponent> destructibleQuery)
Parameters
Type Name Description
EntityUid uid
EntityQuery<DamageableComponent> damageQuery
EntityQuery<DestructibleComponent> destructibleQuery
Returns
Type Description
System.Single[]
| Improve this Doc View Source

GetLocalGrids(MapCoordinates, Single, Single, Single)

Look for grids in an area and returns them. Also selects a special grid that will be used to determine the orientation of an explosion in space.

Declaration
public (List<EntityUid>, EntityUid? , float) GetLocalGrids(MapCoordinates epicenter, float totalIntensity, float slope, float maxIntensity)
Parameters
Type Name Description
Robust.Shared.Map.MapCoordinates epicenter
System.Single totalIntensity
System.Single slope
System.Single maxIntensity
Returns
Type Description
System.ValueTuple<List<EntityUid>, System.Nullable<EntityUid>, System.Single>
Remarks

Note that even though an explosion may start ON a grid, the explosion in space may still be orientated to match a separate grid. This is done so that if you have something like a tiny suicide-bomb shuttle exploding near a large station, the explosion will still orient to match the station, not the tiny shuttle.

| Improve this Doc View Source

Initialize()

Declaration
public override void Initialize()
| Improve this Doc View Source

InitVisuals()

Declaration
public void InitVisuals()
| Improve this Doc View Source

IntensityToRadius(Single, Single, Single)

Inverse formula for RadiusToIntensity(Single, Single, Single)

Declaration
public float IntensityToRadius(float totalIntensity, float slope, float maxIntensity)
Parameters
Type Name Description
System.Single totalIntensity
System.Single slope
System.Single maxIntensity
Returns
Type Description
System.Single
| Improve this Doc View Source

IsBlockingTurf(EntityUid, EntityQuery<PhysicsComponent>)

Determines whether an entity is blocking a tile or not. (whether it can prevent the tile from being uprooted by an explosion).

Declaration
public bool IsBlockingTurf(EntityUid uid, EntityQuery<PhysicsComponent> physicsQuery)
Parameters
Type Name Description
EntityUid uid
EntityQuery<Robust.Shared.Physics.Components.PhysicsComponent> physicsQuery
Returns
Type Description
System.Boolean
Remarks

Used for a variation of that makes use of the fact that we have already done an entity lookup on a tile, and don't need to do so again.

| Improve this Doc View Source

QueueExplosion(EntityUid, String, Single, Single, Single, Single, Int32, Boolean, Nullable<EntityUid>, Boolean)

Queue an explosions, centered on some entity.

Declaration
public void QueueExplosion(EntityUid uid, string typeId, float totalIntensity, float slope, float maxTileIntensity, float tileBreakScale = 1F, int maxTileBreak = null, bool canCreateVacuum = true, EntityUid? user = null, bool addLog = true)
Parameters
Type Name Description
EntityUid uid
System.String typeId
System.Single totalIntensity
System.Single slope
System.Single maxTileIntensity
System.Single tileBreakScale
System.Int32 maxTileBreak
System.Boolean canCreateVacuum
System.Nullable<EntityUid> user
System.Boolean addLog
| Improve this Doc View Source

QueueExplosion(MapCoordinates, String, Single, Single, Single, Single, Int32, Boolean, Boolean)

Queue an explosion, with a specified epicenter and set of starting tiles.

Declaration
public void QueueExplosion(MapCoordinates epicenter, string typeId, float totalIntensity, float slope, float maxTileIntensity, float tileBreakScale = 1F, int maxTileBreak = null, bool canCreateVacuum = true, bool addLog = true)
Parameters
Type Name Description
Robust.Shared.Map.MapCoordinates epicenter
System.String typeId
System.Single totalIntensity
System.Single slope
System.Single maxTileIntensity
System.Single tileBreakScale
System.Int32 maxTileBreak
System.Boolean canCreateVacuum
System.Boolean addLog
| Improve this Doc View Source

RadiusToIntensity(Single, Single, Single)

Find the strength needed to generate an explosion of a given radius. More useful for radii larger then 4, when the explosion becomes less "blocky".

Declaration
public float RadiusToIntensity(float radius, float slope, float maxIntensity = null)
Parameters
Type Name Description
System.Single radius
System.Single slope
System.Single maxIntensity
Returns
Type Description
System.Single
Remarks

This assumes the explosion is in a vacuum / unobstructed. Given that explosions are not perfectly circular, here radius actually means the sqrt(Area/pi), where the area is the total number of tiles covered by the explosion. Until you get to radius 30+, this is functionally equivalent to the actual radius.

| Improve this Doc View Source

Shutdown()

Declaration
public override void Shutdown()
| Improve this Doc View Source

TransformGridEdges(MapCoordinates, Nullable<EntityUid>, List<EntityUid>, Single)

Take our map of grid edges, where each is defined in their own grid's reference frame, and map those edges all onto one grids reference frame.

Declaration
public (Dictionary<Vector2i, BlockedSpaceTile>, ushort) TransformGridEdges(MapCoordinates epicentre, EntityUid? referenceGrid, List<EntityUid> localGrids, float maxDistance)
Parameters
Type Name Description
Robust.Shared.Map.MapCoordinates epicentre
System.Nullable<EntityUid> referenceGrid
List<EntityUid> localGrids
System.Single maxDistance
Returns
Type Description
System.ValueTuple<Dictionary<Vector2i, BlockedSpaceTile>, System.UInt16>
| Improve this Doc View Source

TriggerExplosive(EntityUid, ExplosiveComponent, Boolean, Nullable<Single>, Nullable<Single>, Nullable<EntityUid>)

Given an entity with an explosive component, spawn the appropriate explosion.

Declaration
public void TriggerExplosive(EntityUid uid, ExplosiveComponent explosive = null, bool delete = true, float? totalIntensity = null, float? radius = null, EntityUid? user = null)
Parameters
Type Name Description
EntityUid uid
ExplosiveComponent explosive
System.Boolean delete
System.Nullable<System.Single> totalIntensity
System.Nullable<System.Single> radius
System.Nullable<EntityUid> user
Remarks

Also accepts radius or intensity arguments. This is useful for explosives where the intensity is not specified in the yaml / by the component, but determined dynamically (e.g., by the quantity of a solution in a reaction).

| Improve this Doc View Source

Update(Single)

Process the explosion queue.

Declaration
public override void Update(float frameTime)
Parameters
Type Name Description
System.Single frameTime
| Improve this Doc View Source

UpdateAirtightMap(EntityUid, MapGridComponent, Vector2i, Nullable<EntityQuery<AirtightComponent>>)

Update the map of explosion blockers.

Declaration
public void UpdateAirtightMap(EntityUid gridId, MapGridComponent grid, Vector2i tile, EntityQuery<AirtightComponent>? query = null)
Parameters
Type Name Description
EntityUid gridId
Robust.Shared.Map.Components.MapGridComponent grid
Vector2i tile
System.Nullable<EntityQuery<AirtightComponent>> query
Remarks

Gets a list of all airtight entities on a tile. Assembles a AtmosDirection that specifies what directions are blocked, along with the largest explosion tolerance. Note that as we only keep track of the largest tolerance, this means that the explosion map will actually be inaccurate if you have something like a normal and a reinforced windoor on the same tile. But given that this is a pretty rare occurrence, I am fine with this.

| Improve this Doc View Source

UpdateAirtightMap(EntityUid, Vector2i, MapGridComponent, Nullable<EntityQuery<AirtightComponent>>)

Declaration
public void UpdateAirtightMap(EntityUid gridId, Vector2i tile, MapGridComponent grid = null, EntityQuery<AirtightComponent>? query = null)
Parameters
Type Name Description
EntityUid gridId
Vector2i tile
Robust.Shared.Map.Components.MapGridComponent grid
System.Nullable<EntityQuery<AirtightComponent>> query

Implements

EntitySystem
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾