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))
|
||||
|
||||
Reference in New Issue
Block a user