Makes atmos superconduction a CVar, disables it by default.

This commit is contained in:
Vera Aguilera Puerto
2021-03-25 18:17:30 +01:00
parent e45548ac74
commit 195feb70a7
3 changed files with 19 additions and 2 deletions

View File

@@ -407,7 +407,7 @@ namespace Content.Server.GameObjects.Components.Atmos
public virtual void AddSuperconductivityTile(TileAtmosphere tile) public virtual void AddSuperconductivityTile(TileAtmosphere tile)
{ {
if (tile?.GridIndex != _gridId) return; if (tile?.GridIndex != _gridId || !AtmosphereSystem.Superconduction) return;
_superconductivityTiles.Add(tile); _superconductivityTiles.Add(tile);
} }
@@ -606,7 +606,10 @@ namespace Content.Server.GameObjects.Components.Atmos
} }
_paused = false; _paused = false;
_state = ProcessState.Superconductivity; // Next state depends on whether superconduction is enabled or not.
// Note: We do this here instead of on the tile equalization step to prevent ending it early.
// Therefore, a change to this CVar might only be applied after that step is over.
_state = AtmosphereSystem.Superconduction ? ProcessState.Superconductivity : ProcessState.PipeNet;
break; break;
case ProcessState.Superconductivity: case ProcessState.Superconductivity:
if (!ProcessSuperconductivity(_paused, maxProcessTime)) if (!ProcessSuperconductivity(_paused, maxProcessTime))

View File

@@ -69,6 +69,7 @@ namespace Content.Server.GameObjects.EntitySystems
_cfg.OnValueChanged(CCVars.SpaceWind, OnSpaceWindChanged, true); _cfg.OnValueChanged(CCVars.SpaceWind, OnSpaceWindChanged, true);
_cfg.OnValueChanged(CCVars.MonstermosEqualization, OnMonstermosEqualizationChanged, true); _cfg.OnValueChanged(CCVars.MonstermosEqualization, OnMonstermosEqualizationChanged, true);
_cfg.OnValueChanged(CCVars.Superconduction, OnSuperconductionChanged, true);
_cfg.OnValueChanged(CCVars.AtmosMaxProcessTime, OnAtmosMaxProcessTimeChanged, true); _cfg.OnValueChanged(CCVars.AtmosMaxProcessTime, OnAtmosMaxProcessTimeChanged, true);
_cfg.OnValueChanged(CCVars.AtmosTickRate, OnAtmosTickRateChanged, true); _cfg.OnValueChanged(CCVars.AtmosTickRate, OnAtmosTickRateChanged, true);
_cfg.OnValueChanged(CCVars.ExcitedGroupsSpaceIsAllConsuming, OnExcitedGroupsSpaceIsAllConsumingChanged, true); _cfg.OnValueChanged(CCVars.ExcitedGroupsSpaceIsAllConsuming, OnExcitedGroupsSpaceIsAllConsumingChanged, true);
@@ -76,6 +77,7 @@ namespace Content.Server.GameObjects.EntitySystems
public bool SpaceWind { get; private set; } public bool SpaceWind { get; private set; }
public bool MonstermosEqualization { get; private set; } public bool MonstermosEqualization { get; private set; }
public bool Superconduction { get; private set; }
public bool ExcitedGroupsSpaceIsAllConsuming { get; private set; } public bool ExcitedGroupsSpaceIsAllConsuming { get; private set; }
public float AtmosMaxProcessTime { get; private set; } public float AtmosMaxProcessTime { get; private set; }
public float AtmosTickRate { get; private set; } public float AtmosTickRate { get; private set; }
@@ -100,6 +102,11 @@ namespace Content.Server.GameObjects.EntitySystems
MonstermosEqualization = obj; MonstermosEqualization = obj;
} }
private void OnSuperconductionChanged(bool obj)
{
Superconduction = obj;
}
private void OnSpaceWindChanged(bool obj) private void OnSpaceWindChanged(bool obj)
{ {
SpaceWind = obj; SpaceWind = obj;

View File

@@ -234,6 +234,13 @@ namespace Content.Shared
public static readonly CVarDef<bool> MonstermosEqualization = public static readonly CVarDef<bool> MonstermosEqualization =
CVarDef.Create("atmos.monstermos_equalization", true, CVar.SERVERONLY); CVarDef.Create("atmos.monstermos_equalization", true, CVar.SERVERONLY);
/// <summary>
/// Whether atmos superconduction is enabled.
/// </summary>
/// <remarks> Disabled by default, superconduction is awful. </remarks>
public static readonly CVarDef<bool> Superconduction =
CVarDef.Create("atmos.superconduction", false, CVar.SERVERONLY);
/// <summary> /// <summary>
/// Maximum time in milliseconds that atmos can take processing. /// Maximum time in milliseconds that atmos can take processing.
/// </summary> /// </summary>