using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Random;
+using Robust.Shared.Configuration;
+using Content.Shared.CCVar;
namespace Content.Server.Atmos.EntitySystems
{
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!;
+ [Dependency] private readonly IConfigurationManager _cfg = default!;
private const float TimerDelay = 0.5f;
private float _timer = 0f;
private const float MinimumSoundValvePressure = 10.0f;
+ private float _maxExplosionRange;
public override void Initialize()
{
SubscribeLocalEvent<GasTankComponent, GasAnalyzerScanEvent>(OnAnalyzed);
SubscribeLocalEvent<GasTankComponent, PriceCalculationEvent>(OnGasTankPrice);
SubscribeLocalEvent<GasTankComponent, GetVerbsEvent<AlternativeVerb>>(OnGetAlternativeVerb);
+ Subs.CVar(_cfg, CCVars.AtmosTankFragment, UpdateMaxRange, true);
+ }
+
+ private void UpdateMaxRange(float value)
+ {
+ _maxExplosionRange = value;
}
private void OnGasShutdown(Entity<GasTankComponent> gasTank, ref ComponentShutdown args)
var pressure = component.Air.Pressure;
- if (pressure > component.TankFragmentPressure)
+ if (pressure > component.TankFragmentPressure && _maxExplosionRange > 0)
{
// Give the gas a chance to build up more pressure.
for (var i = 0; i < 3; i++)
// Let's cap the explosion, yeah?
// !1984
- if (range > GasTankComponent.MaxExplosionRange)
- {
- range = GasTankComponent.MaxExplosionRange;
- }
+ range = Math.Min(Math.Min(range, GasTankComponent.MaxExplosionRange), _maxExplosionRange);
_explosions.TriggerExplosive(owner, radius: range);
public static readonly CVarDef<float> AtmosHeatScale =
CVarDef.Create("atmos.heat_scale", 8f, CVar.SERVERONLY);
+ /// <summary>
+ /// Maximum explosion radius for explosions caused by bursting a gas tank ("max caps").
+ /// Setting this to zero disables the explosion but still allows the tank to burst and leak.
+ /// </summary>
+ public static readonly CVarDef<float> AtmosTankFragment =
+ CVarDef.Create("atmos.max_explosion_range", 26f, CVar.SERVERONLY);
+
/*
* MIDI instruments
*/