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 <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>
This commit is contained in:
TurboTracker
2024-09-10 23:05:12 +01:00
committed by GitHub
parent 21817c7028
commit 4b357a370b
3 changed files with 22 additions and 5 deletions

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