Disable emergency shuttles locally (#9195)
Can still re-enable via cvar but this is to make devving faster.
This commit is contained in:
@@ -46,13 +46,41 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
private const float ShuttleSpawnBuffer = 1f;
|
||||
|
||||
private bool _emergencyShuttleEnabled;
|
||||
|
||||
private void InitializeEscape()
|
||||
{
|
||||
#if !FULL_RELEASE
|
||||
_configManager.OverrideDefault(CCVars.EmergencyShuttleEnabled, false);
|
||||
#endif
|
||||
_emergencyShuttleEnabled = _configManager.GetCVar(CCVars.EmergencyShuttleEnabled);
|
||||
// Don't immediately invoke as roundstart will just handle it.
|
||||
_configManager.OnValueChanged(CCVars.EmergencyShuttleEnabled, SetEmergencyShuttleEnabled);
|
||||
SubscribeLocalEvent<RoundStartingEvent>(OnRoundStart);
|
||||
SubscribeLocalEvent<StationDataComponent, ComponentStartup>(OnStationStartup);
|
||||
SubscribeNetworkEvent<EmergencyShuttleRequestPositionMessage>(OnShuttleRequestPosition);
|
||||
}
|
||||
|
||||
private void SetEmergencyShuttleEnabled(bool value)
|
||||
{
|
||||
if (_emergencyShuttleEnabled == value) return;
|
||||
_emergencyShuttleEnabled = value;
|
||||
|
||||
if (value)
|
||||
{
|
||||
SetupEmergencyShuttle();
|
||||
}
|
||||
else
|
||||
{
|
||||
CleanupEmergencyShuttle();
|
||||
}
|
||||
}
|
||||
|
||||
private void ShutdownEscape()
|
||||
{
|
||||
_configManager.UnsubValueChanged(CCVars.EmergencyShuttleEnabled, SetEmergencyShuttleEnabled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the client is requesting debug info on where an emergency shuttle would dock.
|
||||
/// </summary>
|
||||
@@ -343,7 +371,7 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
private void OnRoundStart(RoundStartingEvent ev)
|
||||
{
|
||||
Setup();
|
||||
SetupEmergencyShuttle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -353,6 +381,12 @@ public sealed partial class ShuttleSystem
|
||||
{
|
||||
if (EmergencyShuttleArrived) return;
|
||||
|
||||
if (!_emergencyShuttleEnabled)
|
||||
{
|
||||
_roundEnd.EndRound();
|
||||
return;
|
||||
}
|
||||
|
||||
_consoleAccumulator = _configManager.GetCVar(CCVars.EmergencyShuttleDockTime);
|
||||
EmergencyShuttleArrived = true;
|
||||
|
||||
@@ -402,9 +436,9 @@ public sealed partial class ShuttleSystem
|
||||
return result;
|
||||
}
|
||||
|
||||
private void Setup()
|
||||
private void SetupEmergencyShuttle()
|
||||
{
|
||||
if (_centcommMap != null && _mapManager.MapExists(_centcommMap.Value)) return;
|
||||
if (!_emergencyShuttleEnabled || _centcommMap != null && _mapManager.MapExists(_centcommMap.Value)) return;
|
||||
|
||||
_centcommMap = _mapManager.CreateMap();
|
||||
_mapManager.SetMapPaused(_centcommMap.Value, true);
|
||||
@@ -421,7 +455,7 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
private void AddEmergencyShuttle(StationDataComponent component)
|
||||
{
|
||||
if (_centcommMap == null || component.EmergencyShuttle != null) return;
|
||||
if (!_emergencyShuttleEnabled || _centcommMap == null || component.EmergencyShuttle != null) return;
|
||||
|
||||
// Load escape shuttle
|
||||
var (_, shuttle) = _loader.LoadBlueprint(_centcommMap.Value, component.EmergencyShuttlePath.ToString(), new MapLoadOptions()
|
||||
@@ -442,6 +476,12 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
private void CleanupEmergencyShuttle()
|
||||
{
|
||||
// If we get cleaned up mid roundend just end it.
|
||||
if (_launchedShuttles)
|
||||
{
|
||||
_roundEnd.EndRound();
|
||||
}
|
||||
|
||||
_shuttleIndex = 0f;
|
||||
|
||||
if (_centcommMap == null || !_mapManager.MapExists(_centcommMap.Value))
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace Content.Server.Shuttles.Systems
|
||||
public override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
ShutdownEscape();
|
||||
ShutdownEmergencyConsole();
|
||||
_configManager.UnsubValueChanged(CCVars.ShuttleMaxLinearSpeed, SetShuttleMaxLinearSpeed);
|
||||
_configManager.UnsubValueChanged(CCVars.ShuttleMaxAngularSpeed, SetShuttleMaxAngularSpeed);
|
||||
|
||||
@@ -928,6 +928,12 @@ namespace Content.Shared.CCVar
|
||||
public static readonly CVarDef<float> EmergencyShuttleTransitTime =
|
||||
CVarDef.Create("shuttle.emergency_transit_time", 120f, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// Whether the emergency shuttle is enabled or should the round just end.
|
||||
/// </summary>
|
||||
public static readonly CVarDef<bool> EmergencyShuttleEnabled =
|
||||
CVarDef.Create("shuttle.emergency_enabled", true, CVar.SERVERONLY);
|
||||
|
||||
/*
|
||||
* VIEWPORT
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user