]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Removal of Maxcaps via cvar (#31437)
authorTurboTracker <130304754+TurboTrackerss14@users.noreply.github.com>
Tue, 10 Sep 2024 22:05:12 +0000 (23:05 +0100)
committerGitHub <noreply@github.com>
Tue, 10 Sep 2024 22:05:12 +0000 (00:05 +0200)
* 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>
Content.Server/Atmos/EntitySystems/GasTankSystem.cs
Content.Shared/CCVar/CCVars.cs
Resources/ConfigPresets/WizardsDen/wizardsDen.toml

index 8c5cded0f1c162d0abedc7bd1890a71523d75a99..4d409a708229b488f8a4b9bb5ebd1afb36fd78b9 100644 (file)
@@ -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<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)
@@ -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);
 
index 9e95231c84ade81fed6ce30506fbfa81a4ae84c6..d6d8bafa0e6c1924e9c85c4223a6919b0571ae87 100644 (file)
@@ -1240,6 +1240,13 @@ namespace Content.Shared.CCVar
         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
          */
index bf10f6c837774274b440dd2d62fc43a6feff0428..077ff3fe40a687481eb89c44032c222fd26f2ec3 100644 (file)
@@ -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