Skip to content

Commit 4b357a3

Browse files
TurboTrackerss14Partmediaslarticodefast
authored
Removal of Maxcaps via cvar (space-wizards#31437)
* Comment out gastank explosion trigger * CVAR creation * Blank line between method + toml update * I fucking hate VistualStudio * change bool logic into float * cat dancing.gif * Adjust some minor nits * Update Content.Server/Atmos/EntitySystems/GasTankSystem.cs Co-authored-by: Partmedia <kevinz5000@gmail.com> * Un-hardcode unused initial cached CVar value * Update Resources/ConfigPresets/WizardsDen/wizardsDen.toml --------- Co-authored-by: Kevin Zheng <kevinz5000@gmail.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
1 parent 21817c7 commit 4b357a3

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

Content.Server/Atmos/EntitySystems/GasTankSystem.cs

+12-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
using Robust.Shared.Audio.Systems;
1818
using Robust.Shared.Containers;
1919
using Robust.Shared.Random;
20+
using Robust.Shared.Configuration;
21+
using Content.Shared.CCVar;
2022

2123
namespace Content.Server.Atmos.EntitySystems
2224
{
@@ -32,10 +34,12 @@ public sealed class GasTankSystem : EntitySystem
3234
[Dependency] private readonly UserInterfaceSystem _ui = default!;
3335
[Dependency] private readonly IRobustRandom _random = default!;
3436
[Dependency] private readonly ThrowingSystem _throwing = default!;
37+
[Dependency] private readonly IConfigurationManager _cfg = default!;
3538

3639
private const float TimerDelay = 0.5f;
3740
private float _timer = 0f;
3841
private const float MinimumSoundValvePressure = 10.0f;
42+
private float _maxExplosionRange;
3943

4044
public override void Initialize()
4145
{
@@ -51,6 +55,12 @@ public override void Initialize()
5155
SubscribeLocalEvent<GasTankComponent, GasAnalyzerScanEvent>(OnAnalyzed);
5256
SubscribeLocalEvent<GasTankComponent, PriceCalculationEvent>(OnGasTankPrice);
5357
SubscribeLocalEvent<GasTankComponent, GetVerbsEvent<AlternativeVerb>>(OnGetAlternativeVerb);
58+
Subs.CVar(_cfg, CCVars.AtmosTankFragment, UpdateMaxRange, true);
59+
}
60+
61+
private void UpdateMaxRange(float value)
62+
{
63+
_maxExplosionRange = value;
5464
}
5565

5666
private void OnGasShutdown(Entity<GasTankComponent> gasTank, ref ComponentShutdown args)
@@ -320,7 +330,7 @@ public void CheckStatus(Entity<GasTankComponent> ent)
320330

321331
var pressure = component.Air.Pressure;
322332

323-
if (pressure > component.TankFragmentPressure)
333+
if (pressure > component.TankFragmentPressure && _maxExplosionRange > 0)
324334
{
325335
// Give the gas a chance to build up more pressure.
326336
for (var i = 0; i < 3; i++)
@@ -333,10 +343,7 @@ public void CheckStatus(Entity<GasTankComponent> ent)
333343

334344
// Let's cap the explosion, yeah?
335345
// !1984
336-
if (range > GasTankComponent.MaxExplosionRange)
337-
{
338-
range = GasTankComponent.MaxExplosionRange;
339-
}
346+
range = Math.Min(Math.Min(range, GasTankComponent.MaxExplosionRange), _maxExplosionRange);
340347

341348
_explosions.TriggerExplosive(owner, radius: range);
342349

Content.Shared/CCVar/CCVars.cs

+7
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,13 @@ public static readonly CVarDef<bool>
12401240
public static readonly CVarDef<float> AtmosHeatScale =
12411241
CVarDef.Create("atmos.heat_scale", 8f, CVar.SERVERONLY);
12421242

1243+
/// <summary>
1244+
/// Maximum explosion radius for explosions caused by bursting a gas tank ("max caps").
1245+
/// Setting this to zero disables the explosion but still allows the tank to burst and leak.
1246+
/// </summary>
1247+
public static readonly CVarDef<float> AtmosTankFragment =
1248+
CVarDef.Create("atmos.max_explosion_range", 26f, CVar.SERVERONLY);
1249+
12431250
/*
12441251
* MIDI instruments
12451252
*/

Resources/ConfigPresets/WizardsDen/wizardsDen.toml

+3
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ see_own_notes = true
3838
deadmin_on_join = true
3939
new_player_threshold = 600
4040
alert.min_players_sharing_connection = 2
41+
42+
[atmos]
43+
max_explosion_range = 5

0 commit comments

Comments
 (0)