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>
{
// 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))
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);
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);
// 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
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
{
// 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;
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);
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)
foreach (var (uid, xform) in list)
{
- ProcessEntity(uid, epicenter, null, throwForce, id, xform);
+ ProcessEntity(uid, epicenter, null, throwForce, id, xform, fireStacks);
}
}
DamageSpecifier? originalDamage,
float throwForce,
string id,
- TransformComponent? xform)
+ TransformComponent? xform,
+ float? fireStacksOnIgnite)
{
if (originalDamage != null)
{
{
// 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);
}
}
{
_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;
_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)
_currentDamage,
Epicenter,
ProcessedEntities,
- ExplosionType.ID);
+ ExplosionType.ID,
+ ExplosionType.FireStacks);
}
if (!MoveNext())
# with that you could make napalm ied instead of welding fuel with no additional complexity
- type: entity
parent: BaseItem
- id: ImprovisedExplosive
- name: improvised explosive device
+ id: FireBomb
+ name: fire bomb
description: A weak, improvised incendiary device.
components:
- type: Sprite
volume: 1
- type: RandomTimerTrigger
min: 0
- max: 60
- - type: Explosive # Weak explosion in a very small radius. Doesn't break underplating.
- explosionType: Default
- totalIntensity: 20
+ max: 15
+ - type: Explosive # Weak explosion in a very small radius. Ignites surrounding entities.
+ explosionType: FireBomb
+ totalIntensity: 25
intensitySlope: 5
maxIntensity: 3
canCreateVacuum: false
acts: ["Destruction"]
- !type:ExplodeBehavior
- type: Construction
- graph: ImprovisedExplosive
- node: ied
+ graph: FireBomb
+ node: firebomb
# has igniter but no fuel or wires
- type: entity
parent: DrinkColaCanEmpty
- id: ImprovisedExplosiveEmpty
- name: improvised explosive device
+ id: FireBombEmpty
+ name: fire bomb
suffix: empty
description: A weak, improvised incendiary device. This one has no fuel.
components:
True: {state: "base"}
False: {state: "base"}
- type: Construction
- graph: ImprovisedExplosive
+ graph: FireBomb
node: empty
- defaultTarget: ied
+ defaultTarget: firebomb
- type: Tag
tags:
- Trash
# no DrinkCan, prevent using it to make another ied
- type: entity
- parent: ImprovisedExplosiveEmpty
- id: ImprovisedExplosiveFuel
+ parent: FireBombEmpty
+ id: FireBombFuel
suffix: fuel
description: A weak, improvised incendiary device. This one is missing wires.
components:
Quantity: 30
- type: Construction
node: fuel
- defaultTarget: ied
+ defaultTarget: firebomb
- type: Tag
tags: []