Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a cvar to limit maxcap range & Lower it for wizards den #31437

Merged
merged 10 commits into from
Sep 10, 2024
17 changes: 12 additions & 5 deletions Content.Server/Atmos/EntitySystems/GasTankSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
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
{
Expand All @@ -32,10 +34,12 @@ public sealed class GasTankSystem : EntitySystem
[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()
{
Expand All @@ -51,6 +55,12 @@ 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)
Expand Down Expand Up @@ -320,7 +330,7 @@ public void CheckStatus(Entity<GasTankComponent> ent)

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++)
Expand All @@ -333,10 +343,7 @@ public void CheckStatus(Entity<GasTankComponent> ent)

// 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);

Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,13 @@ public static readonly CVarDef<bool>
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
*/
Expand Down
3 changes: 3 additions & 0 deletions Resources/ConfigPresets/WizardsDen/wizardsDen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ see_own_notes = true
deadmin_on_join = true
new_player_threshold = 600
alert.min_players_sharing_connection = 2

[atmos]
max_explosion_range = 0
slarticodefast marked this conversation as resolved.
Show resolved Hide resolved
Loading