From 4b357a370bca00ca9648051c645b7d2281ee1904 Mon Sep 17 00:00:00 2001 From: TurboTracker <130304754+TurboTrackerss14@users.noreply.github.com> Date: Tue, 10 Sep 2024 23:05:12 +0100 Subject: [PATCH] Removal of Maxcaps via cvar (#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 * Un-hardcode unused initial cached CVar value * Update Resources/ConfigPresets/WizardsDen/wizardsDen.toml --------- Co-authored-by: Kevin Zheng Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --- .../Atmos/EntitySystems/GasTankSystem.cs | 17 ++++++++++++----- Content.Shared/CCVar/CCVars.cs | 7 +++++++ .../ConfigPresets/WizardsDen/wizardsDen.toml | 3 +++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs index 8c5cded0f1..4d409a7082 100644 --- a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs @@ -17,6 +17,8 @@ using Robust.Shared.Audio; 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 { @@ -32,10 +34,12 @@ 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() { @@ -51,6 +55,12 @@ namespace Content.Server.Atmos.EntitySystems SubscribeLocalEvent(OnAnalyzed); SubscribeLocalEvent(OnGasTankPrice); SubscribeLocalEvent>(OnGetAlternativeVerb); + Subs.CVar(_cfg, CCVars.AtmosTankFragment, UpdateMaxRange, true); + } + + private void UpdateMaxRange(float value) + { + _maxExplosionRange = value; } private void OnGasShutdown(Entity gasTank, ref ComponentShutdown args) @@ -320,7 +330,7 @@ namespace Content.Server.Atmos.EntitySystems 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++) @@ -333,10 +343,7 @@ namespace Content.Server.Atmos.EntitySystems // 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); diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 9e95231c84..d6d8bafa0e 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1240,6 +1240,13 @@ namespace Content.Shared.CCVar public static readonly CVarDef AtmosHeatScale = CVarDef.Create("atmos.heat_scale", 8f, CVar.SERVERONLY); + /// + /// 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. + /// + public static readonly CVarDef AtmosTankFragment = + CVarDef.Create("atmos.max_explosion_range", 26f, CVar.SERVERONLY); + /* * MIDI instruments */ diff --git a/Resources/ConfigPresets/WizardsDen/wizardsDen.toml b/Resources/ConfigPresets/WizardsDen/wizardsDen.toml index bf10f6c837..077ff3fe40 100644 --- a/Resources/ConfigPresets/WizardsDen/wizardsDen.toml +++ b/Resources/ConfigPresets/WizardsDen/wizardsDen.toml @@ -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 = 5 -- 2.51.2