Fix two explosion bugs (#10909)
* Fix trigger LINQ error. * divide by zero
This commit is contained in:
@@ -158,7 +158,9 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
damagePerIntensity += value * Math.Max(0, ev.DamageCoefficient);
|
damagePerIntensity += value * Math.Max(0, ev.DamageCoefficient);
|
||||||
}
|
}
|
||||||
|
|
||||||
explosionTolerance[index] = (float) ((totalDamageTarget - damageable.TotalDamage) / damagePerIntensity);
|
explosionTolerance[index] = damagePerIntensity > 0
|
||||||
|
? (float) ((totalDamageTarget - damageable.TotalDamage) / damagePerIntensity)
|
||||||
|
: float.MaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return explosionTolerance;
|
return explosionTolerance;
|
||||||
|
|||||||
@@ -126,7 +126,8 @@ namespace Content.Server.Explosion.EntitySystems
|
|||||||
{
|
{
|
||||||
// Check if entity is bomb/mod. grenade/etc
|
// Check if entity is bomb/mod. grenade/etc
|
||||||
if (_container.TryGetContainer(uid, "payload", out IContainer? container) &&
|
if (_container.TryGetContainer(uid, "payload", out IContainer? container) &&
|
||||||
TryComp(container.ContainedEntities.First(), out ChemicalPayloadComponent? chemicalPayloadComponent))
|
container.ContainedEntities.Count > 0 &&
|
||||||
|
TryComp(container.ContainedEntities[0], out ChemicalPayloadComponent? chemicalPayloadComponent))
|
||||||
{
|
{
|
||||||
// If a beaker is missing, the entity won't explode, so no reason to log it
|
// If a beaker is missing, the entity won't explode, so no reason to log it
|
||||||
if (!TryComp(chemicalPayloadComponent?.BeakerSlotA.Item, out SolutionContainerManagerComponent? beakerA) ||
|
if (!TryComp(chemicalPayloadComponent?.BeakerSlotA.Item, out SolutionContainerManagerComponent? beakerA) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user