Pipebombs and IED rework (#25705)
* inital * 2-9 * add crafting function, rename ied to fire bomb * add firebomb ignition * fikss * change damage values * add note * fix tests i think * ok * good * Review * warning --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -17,11 +17,15 @@ using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
|
||||
public sealed partial class ExplosionSystem
|
||||
{
|
||||
[Dependency] private readonly FlammableSystem _flammableSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Used to limit explosion processing time. See <see cref="MaxProcessingTime"/>.
|
||||
/// </summary>
|
||||
@@ -95,7 +99,7 @@ public sealed partial class ExplosionSystem
|
||||
{
|
||||
// EXPLOSION TODO allow explosion spawning to be interrupted by time limit. In the meantime, ensure that
|
||||
// there is at-least 1ms of time left before creating a new explosion
|
||||
if (MathF.Max(MaxProcessingTime - 1, 0.1f) < Stopwatch.Elapsed.TotalMilliseconds)
|
||||
if (MathF.Max(MaxProcessingTime - 1, 0.1f) < Stopwatch.Elapsed.TotalMilliseconds)
|
||||
break;
|
||||
|
||||
if (!_explosionQueue.TryDequeue(out var spawnNextExplosion))
|
||||
@@ -130,11 +134,11 @@ public sealed partial class ExplosionSystem
|
||||
try
|
||||
{
|
||||
#endif
|
||||
var processed = _activeExplosion.Process(tilesRemaining);
|
||||
tilesRemaining -= processed;
|
||||
var processed = _activeExplosion.Process(tilesRemaining);
|
||||
tilesRemaining -= processed;
|
||||
|
||||
// has the explosion finished processing?
|
||||
if (_activeExplosion.FinishedProcessing)
|
||||
// has the explosion finished processing?
|
||||
if (_activeExplosion.FinishedProcessing)
|
||||
{
|
||||
var comp = EnsureComp<TimedDespawnComponent>(_activeExplosion.VisualEnt);
|
||||
comp.Lifetime = _cfg.GetCVar(CCVars.ExplosionPersistence);
|
||||
@@ -203,7 +207,8 @@ public sealed partial class ExplosionSystem
|
||||
DamageSpecifier damage,
|
||||
MapCoordinates epicenter,
|
||||
HashSet<EntityUid> processed,
|
||||
string id)
|
||||
string id,
|
||||
float? fireStacks)
|
||||
{
|
||||
var size = grid.Comp.TileSize;
|
||||
var gridBox = new Box2(tile * size, (tile + 1) * size);
|
||||
@@ -222,7 +227,7 @@ public sealed partial class ExplosionSystem
|
||||
// process those entities
|
||||
foreach (var (uid, xform) in list)
|
||||
{
|
||||
ProcessEntity(uid, epicenter, damage, throwForce, id, xform);
|
||||
ProcessEntity(uid, epicenter, damage, throwForce, id, xform, fireStacks);
|
||||
}
|
||||
|
||||
// process anchored entities
|
||||
@@ -232,7 +237,7 @@ public sealed partial class ExplosionSystem
|
||||
foreach (var entity in _anchored)
|
||||
{
|
||||
processed.Add(entity);
|
||||
ProcessEntity(entity, epicenter, damage, throwForce, id, null);
|
||||
ProcessEntity(entity, epicenter, damage, throwForce, id, null, fireStacks);
|
||||
}
|
||||
|
||||
// Walls and reinforced walls will break into girders. These girders will also be considered turf-blocking for
|
||||
@@ -268,7 +273,7 @@ public sealed partial class ExplosionSystem
|
||||
{
|
||||
// Here we only throw, no dealing damage. Containers n such might drop their entities after being destroyed, but
|
||||
// they should handle their own damage pass-through, with their own damage reduction calculation.
|
||||
ProcessEntity(uid, epicenter, null, throwForce, id, xform);
|
||||
ProcessEntity(uid, epicenter, null, throwForce, id, xform, null);
|
||||
}
|
||||
|
||||
return !tileBlocked;
|
||||
@@ -303,7 +308,8 @@ public sealed partial class ExplosionSystem
|
||||
DamageSpecifier damage,
|
||||
MapCoordinates epicenter,
|
||||
HashSet<EntityUid> processed,
|
||||
string id)
|
||||
string id,
|
||||
float? fireStacks)
|
||||
{
|
||||
var gridBox = Box2.FromDimensions(tile * DefaultTileSize, new Vector2(DefaultTileSize, DefaultTileSize));
|
||||
var worldBox = spaceMatrix.TransformBox(gridBox);
|
||||
@@ -319,7 +325,7 @@ public sealed partial class ExplosionSystem
|
||||
foreach (var (uid, xform) in state.Item1)
|
||||
{
|
||||
processed.Add(uid);
|
||||
ProcessEntity(uid, epicenter, damage, throwForce, id, xform);
|
||||
ProcessEntity(uid, epicenter, damage, throwForce, id, xform, fireStacks);
|
||||
}
|
||||
|
||||
if (throwForce <= 0)
|
||||
@@ -333,7 +339,7 @@ public sealed partial class ExplosionSystem
|
||||
|
||||
foreach (var (uid, xform) in list)
|
||||
{
|
||||
ProcessEntity(uid, epicenter, null, throwForce, id, xform);
|
||||
ProcessEntity(uid, epicenter, null, throwForce, id, xform, fireStacks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,7 +436,8 @@ public sealed partial class ExplosionSystem
|
||||
DamageSpecifier? originalDamage,
|
||||
float throwForce,
|
||||
string id,
|
||||
TransformComponent? xform)
|
||||
TransformComponent? xform,
|
||||
float? fireStacksOnIgnite)
|
||||
{
|
||||
if (originalDamage != null)
|
||||
{
|
||||
@@ -439,6 +446,17 @@ public sealed partial class ExplosionSystem
|
||||
{
|
||||
// TODO EXPLOSIONS turn explosions into entities, and pass the the entity in as the damage origin.
|
||||
_damageableSystem.TryChangeDamage(entity, damage, ignoreResistances: true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ignite
|
||||
if (fireStacksOnIgnite != null)
|
||||
{
|
||||
if (_flammableQuery.TryGetComponent(uid, out var flammable))
|
||||
{
|
||||
flammable.FireStacks += fireStacksOnIgnite.Value;
|
||||
_flammableSystem.Ignite(uid, uid, flammable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,14 +723,14 @@ sealed class Explosion
|
||||
{
|
||||
_currentIntensity = _tileSetIntensity[CurrentIteration];
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if (_expectedDamage != null)
|
||||
{
|
||||
// Check that explosion processing hasn't somehow accidentally mutated the damage set.
|
||||
DebugTools.Assert(_expectedDamage.Equals(_currentDamage));
|
||||
_expectedDamage = ExplosionType.DamagePerIntensity * _currentIntensity;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_currentDamage = ExplosionType.DamagePerIntensity * _currentIntensity;
|
||||
|
||||
@@ -811,7 +829,8 @@ sealed class Explosion
|
||||
_currentDamage,
|
||||
Epicenter,
|
||||
ProcessedEntities,
|
||||
ExplosionType.ID);
|
||||
ExplosionType.ID,
|
||||
ExplosionType.FireStacks);
|
||||
|
||||
// If the floor is not blocked by some dense object, damage the floor tiles.
|
||||
if (canDamageFloor)
|
||||
@@ -828,7 +847,8 @@ sealed class Explosion
|
||||
_currentDamage,
|
||||
Epicenter,
|
||||
ProcessedEntities,
|
||||
ExplosionType.ID);
|
||||
ExplosionType.ID,
|
||||
ExplosionType.FireStacks);
|
||||
}
|
||||
|
||||
if (!MoveNext())
|
||||
|
||||
Reference in New Issue
Block a user