Space Engineers
Classes | Public Member Functions | Public Attributes | Properties | List of all members
Sandbox.Game.MyGridExplosion Class Reference

This class is responsible for calculating damage from explosions It works by recursively raycasting from the point it needs to calculate to the explosion center. It does two types of raycast, 3D DDA raycasts for traversing grids (ships, stations) and Havok raycasts for traversing space between grids. For each block, it builds a stack of blocks that are between it and the explosion center and then calculates the damage for all blocks in this stack. It early exits if it encounters a block that was already calculated. More...

Classes

struct  MyRaycastDamageInfo
 

Public Member Functions

 MyGridExplosion ()
 
void Init (BoundingSphereD explosion, float explosionDamage)
 
void ComputeDamagedBlocks ()
 Computes damage for all blocks assigned in constructor More...
 
MyRaycastDamageInfo ComputeDamageForEntity (Vector3D worldPosition)
 Used to calculate damage for entities that are not grids Can be called even if ComputeDamagedBlocks was not called before, but it doesn't do any caching More...
 

Public Attributes

bool GridWasHit
 
readonly HashSet< MyCubeGridAffectedCubeGrids = new HashSet<MyCubeGrid>()
 
readonly HashSet< MySlimBlockAffectedCubeBlocks = new HashSet<MySlimBlock>()
 

Properties

Dictionary< MySlimBlock, float > DamagedBlocks [get]
 
Dictionary< MySlimBlock, MyRaycastDamageInfoDamageRemaining [get]
 
float Damage [get]
 
BoundingSphereD Sphere [get]
 

Detailed Description

This class is responsible for calculating damage from explosions It works by recursively raycasting from the point it needs to calculate to the explosion center. It does two types of raycast, 3D DDA raycasts for traversing grids (ships, stations) and Havok raycasts for traversing space between grids. For each block, it builds a stack of blocks that are between it and the explosion center and then calculates the damage for all blocks in this stack. It early exits if it encounters a block that was already calculated.

Definition at line 24 of file MyGridExplosion.cs.

Constructor & Destructor Documentation

Sandbox.Game.MyGridExplosion.MyGridExplosion ( )
inline

Definition at line 80 of file MyGridExplosion.cs.

Member Function Documentation

void Sandbox.Game.MyGridExplosion.ComputeDamagedBlocks ( )
inline

Computes damage for all blocks assigned in constructor

Definition at line 100 of file MyGridExplosion.cs.

MyRaycastDamageInfo Sandbox.Game.MyGridExplosion.ComputeDamageForEntity ( Vector3D  worldPosition)
inline

Used to calculate damage for entities that are not grids Can be called even if ComputeDamagedBlocks was not called before, but it doesn't do any caching

Parameters
worldPositionWorld position from where the cast starts (usually the entity position)
Returns

Definition at line 145 of file MyGridExplosion.cs.

void Sandbox.Game.MyGridExplosion.Init ( BoundingSphereD  explosion,
float  explosionDamage 
)
inline

Definition at line 85 of file MyGridExplosion.cs.

Member Data Documentation

readonly HashSet<MySlimBlock> Sandbox.Game.MyGridExplosion.AffectedCubeBlocks = new HashSet<MySlimBlock>()

Definition at line 41 of file MyGridExplosion.cs.

readonly HashSet<MyCubeGrid> Sandbox.Game.MyGridExplosion.AffectedCubeGrids = new HashSet<MyCubeGrid>()

Definition at line 40 of file MyGridExplosion.cs.

bool Sandbox.Game.MyGridExplosion.GridWasHit

Definition at line 39 of file MyGridExplosion.cs.

Property Documentation

float Sandbox.Game.MyGridExplosion.Damage
get

Definition at line 65 of file MyGridExplosion.cs.

Dictionary<MySlimBlock, float> Sandbox.Game.MyGridExplosion.DamagedBlocks
get

Definition at line 45 of file MyGridExplosion.cs.

Dictionary<MySlimBlock, MyRaycastDamageInfo> Sandbox.Game.MyGridExplosion.DamageRemaining
get

Definition at line 53 of file MyGridExplosion.cs.

BoundingSphereD Sandbox.Game.MyGridExplosion.Sphere
get

Definition at line 73 of file MyGridExplosion.cs.


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