private void Explode(EntityUid uid, BatteryComponent?battery = null) { _adminLogger.Add(LogType.Explosion, LogImpact.High, $"Sabotaged power cell {ToPrettyString(uid)} is exploding"); if (!Resolve(uid, ref battery)) { return; } var radius = MathF.Min(5, MathF.Ceiling(MathF.Sqrt(battery.CurrentCharge) / 30)); _explosionSystem.TriggerExplosive(uid, radius: radius); QueueDel(uid); }
public void CheckStatus(GasTankComponent component) { if (component.Air == null) { return; } var pressure = component.Air.Pressure; if (pressure > component.TankFragmentPressure) { // Give the gas a chance to build up more pressure. for (var i = 0; i < 3; i++) { _atmosphereSystem.React(component.Air, component); } pressure = component.Air.Pressure; var range = (pressure - component.TankFragmentPressure) / component.TankFragmentScale; // Let's cap the explosion, yeah? // !1984 if (range > GasTankComponent.MaxExplosionRange) { range = GasTankComponent.MaxExplosionRange; } _explosions.TriggerExplosive(component.Owner, radius: range); return; } if (pressure > component.TankRupturePressure) { if (component.Integrity <= 0) { var environment = _atmosphereSystem.GetContainingMixture(component.Owner, false, true); if (environment != null) { _atmosphereSystem.Merge(environment, component.Air); } SoundSystem.Play(component.RuptureSound.GetSound(), Filter.Pvs(component.Owner), Transform(component.Owner).Coordinates, AudioHelpers.WithVariation(0.125f)); QueueDel(component.Owner); return; } component.Integrity--; return; } if (pressure > component.TankLeakPressure) { if (component.Integrity <= 0) { var environment = _atmosphereSystem.GetContainingMixture(component.Owner, false, true); if (environment == null) { return; } var leakedGas = component.Air.RemoveRatio(0.25f); _atmosphereSystem.Merge(environment, leakedGas); } else { component.Integrity--; } return; } if (component.Integrity < 3) { component.Integrity++; } }