17
17
using Robust . Shared . Audio . Systems ;
18
18
using Robust . Shared . Containers ;
19
19
using Robust . Shared . Random ;
20
+ using Robust . Shared . Configuration ;
21
+ using Content . Shared . CCVar ;
20
22
21
23
namespace Content . Server . Atmos . EntitySystems
22
24
{
@@ -32,10 +34,12 @@ public sealed class GasTankSystem : EntitySystem
32
34
[ Dependency ] private readonly UserInterfaceSystem _ui = default ! ;
33
35
[ Dependency ] private readonly IRobustRandom _random = default ! ;
34
36
[ Dependency ] private readonly ThrowingSystem _throwing = default ! ;
37
+ [ Dependency ] private readonly IConfigurationManager _cfg = default ! ;
35
38
36
39
private const float TimerDelay = 0.5f ;
37
40
private float _timer = 0f ;
38
41
private const float MinimumSoundValvePressure = 10.0f ;
42
+ private float _maxExplosionRange ;
39
43
40
44
public override void Initialize ( )
41
45
{
@@ -51,6 +55,12 @@ public override void Initialize()
51
55
SubscribeLocalEvent < GasTankComponent , GasAnalyzerScanEvent > ( OnAnalyzed ) ;
52
56
SubscribeLocalEvent < GasTankComponent , PriceCalculationEvent > ( OnGasTankPrice ) ;
53
57
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 ;
54
64
}
55
65
56
66
private void OnGasShutdown ( Entity < GasTankComponent > gasTank , ref ComponentShutdown args )
@@ -320,7 +330,7 @@ public void CheckStatus(Entity<GasTankComponent> ent)
320
330
321
331
var pressure = component . Air . Pressure ;
322
332
323
- if ( pressure > component . TankFragmentPressure )
333
+ if ( pressure > component . TankFragmentPressure && _maxExplosionRange > 0 )
324
334
{
325
335
// Give the gas a chance to build up more pressure.
326
336
for ( var i = 0 ; i < 3 ; i ++ )
@@ -333,10 +343,7 @@ public void CheckStatus(Entity<GasTankComponent> ent)
333
343
334
344
// Let's cap the explosion, yeah?
335
345
// !1984
336
- if ( range > GasTankComponent . MaxExplosionRange )
337
- {
338
- range = GasTankComponent . MaxExplosionRange ;
339
- }
346
+ range = Math . Min ( Math . Min ( range , GasTankComponent . MaxExplosionRange ) , _maxExplosionRange ) ;
340
347
341
348
_explosions . TriggerExplosive ( owner , radius : range ) ;
342
349
0 commit comments