Fix explosion bug (#11824)

This commit is contained in:
Leon Friedrich
2022-10-11 13:55:53 +13:00
committed by GitHub
parent 8fca213fa6
commit 1e2ed4ae3b
2 changed files with 6 additions and 5 deletions

View File

@@ -186,7 +186,11 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
NewBlockedTiles.Add(tile); NewBlockedTiles.Add(tile);
// At what explosion iteration would this blocker be destroyed? // At what explosion iteration would this blocker be destroyed?
var clearIteration = iteration + (int) MathF.Ceiling(tileData.ExplosionTolerance[_typeIndex] / _intensityStepSize); var required = tileData.ExplosionTolerance[_typeIndex];
if (required > _maxIntensity)
return; // blocker is never destroyed.
var clearIteration = iteration + (int) MathF.Ceiling(required / _intensityStepSize);
if (FreedTileLists.TryGetValue(clearIteration, out var list)) if (FreedTileLists.TryGetValue(clearIteration, out var list))
list.Add(tile); list.Add(tile);
else else
@@ -275,7 +279,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
// This tile has one or more airtight entities anchored to it blocking the explosion from traveling in // This tile has one or more airtight entities anchored to it blocking the explosion from traveling in
// some directions. First, check whether this blocker can even be destroyed by this explosion? // some directions. First, check whether this blocker can even be destroyed by this explosion?
if (sealIntegrity > _maxIntensity || float.IsNaN(sealIntegrity)) if (sealIntegrity > _maxIntensity)
continue; continue;
// At what explosion iteration would this blocker be destroyed? // At what explosion iteration would this blocker be destroyed?

View File

@@ -147,10 +147,7 @@ public sealed partial class ExplosionSystem : EntitySystem
foreach (var (type, value) in explosionType.DamagePerIntensity.DamageDict) foreach (var (type, value) in explosionType.DamagePerIntensity.DamageDict)
{ {
if (!damageable.Damage.DamageDict.ContainsKey(type)) if (!damageable.Damage.DamageDict.ContainsKey(type))
{
explosionTolerance[index] = float.MaxValue;
continue; continue;
}
var ev = new GetExplosionResistanceEvent(explosionType.ID); var ev = new GetExplosionResistanceEvent(explosionType.ID);
RaiseLocalEvent(uid, ev, false); RaiseLocalEvent(uid, ev, false);