Assert.That(LifeStage(salternXform.MapUid.Value), Is.EqualTo(EntityLifeStage.MapInitialized));
// Set up shuttle timing
+ var shuttleSys = server.System<ShuttleSystem>();
var evacSys = server.System<EmergencyShuttleSystem>();
- evacSys.TransitTime = ShuttleSystem.DefaultTravelTime; // Absolute minimum transit time, so the test has to run for at least this long
+ evacSys.TransitTime = shuttleSys.DefaultTravelTime; // Absolute minimum transit time, so the test has to run for at least this long
// TODO SHUTTLE fix spaghetti
var dockTime = server.CfgMan.GetCVar(CCVars.EmergencyShuttleDockTime);
Assert.That(shuttleXform.MapUid, Is.EqualTo(ftl.Owner));
// Shuttle should have arrived at centcomm
- await pair.RunSeconds(ShuttleSystem.DefaultTravelTime);
+ await pair.RunSeconds(shuttleSys.DefaultTravelTime);
Assert.That(shuttleXform.MapUid, Is.EqualTo(centcommMap));
// Round should be ending now
using System.Numerics;
using Content.Server.Salvage.Expeditions;
-using Content.Server.Salvage.Expeditions.Structure;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
-using Content.Server.Shuttles.Systems;
using Content.Server.Station.Components;
using Content.Shared.Chat;
using Content.Shared.Humanoid;
using Content.Shared.Shuttles.Components;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
-using Robust.Shared.Utility;
namespace Content.Server.Salvage;
Announce(uid, Loc.GetString("salvage-expedition-announcement-countdown-minutes", ("duration", TimeSpan.FromMinutes(5).Minutes)));
}
// Auto-FTL out any shuttles
- else if (remaining < TimeSpan.FromSeconds(ShuttleSystem.DefaultStartupTime) + TimeSpan.FromSeconds(0.5))
+ else if (remaining < TimeSpan.FromSeconds(_shuttle.DefaultStartupTime) + TimeSpan.FromSeconds(0.5))
{
var ftlTime = (float) remaining.TotalSeconds;
- if (remaining < TimeSpan.FromSeconds(ShuttleSystem.DefaultStartupTime))
+ if (remaining < TimeSpan.FromSeconds(_shuttle.DefaultStartupTime))
{
ftlTime = MathF.Max(0, (float) remaining.TotalSeconds - 0.5f);
}
- ftlTime = MathF.Min(ftlTime, ShuttleSystem.DefaultStartupTime);
+ ftlTime = MathF.Min(ftlTime, _shuttle.DefaultStartupTime);
var shuttleQuery = AllEntityQuery<ShuttleComponent, TransformComponent>();
if (TryComp<StationDataComponent>(comp.Station, out var data))
using System.Linq;
using Content.Server.Administration;
+using Content.Server.DeviceNetwork.Components;
+using Content.Server.DeviceNetwork.Systems;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Events;
using Content.Server.Parallax;
-using Content.Server.DeviceNetwork.Components;
-using Content.Server.DeviceNetwork.Systems;
using Content.Server.Screens.Components;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
if (TryComp<DeviceNetworkComponent>(shuttleUid, out var netComp))
{
TryComp<FTLComponent>(shuttleUid, out var ftlComp);
- var ftlTime = TimeSpan.FromSeconds(ftlComp?.TravelTime ?? ShuttleSystem.DefaultTravelTime);
+ var ftlTime = TimeSpan.FromSeconds(ftlComp?.TravelTime ?? _shuttles.DefaultTravelTime);
var payload = new NetworkPayload
{
private void OnArrivalsDocked(EntityUid uid, ArrivalsShuttleComponent component, ref FTLCompletedEvent args)
{
- TimeSpan dockTime = component.NextTransfer - _timing.CurTime + TimeSpan.FromSeconds(ShuttleSystem.DefaultStartupTime);
+ var dockTime = component.NextTransfer - _timing.CurTime + TimeSpan.FromSeconds(_shuttles.DefaultStartupTime);
if (TryComp<DeviceNetworkComponent>(uid, out var netComp))
{
if (comp.NextTransfer > curTime || !TryComp<StationDataComponent>(comp.Station, out var data))
continue;
- var tripTime = ShuttleSystem.DefaultTravelTime + ShuttleSystem.DefaultStartupTime;
+ var tripTime = _shuttles.DefaultTravelTime + _shuttles.DefaultStartupTime;
// Go back to arrivals source
if (xform.MapUid != arrivalsXform.MapUid)
using System.Threading;
-using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.Screens.Components;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
-using Content.Shared.UserInterface;
using Content.Shared.Access;
using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.Shuttles.BUIStates;
using Content.Shared.Shuttles.Events;
using Content.Shared.Shuttles.Systems;
+using Content.Shared.UserInterface;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Timer = Robust.Shared.Timing.Timer;
private void UpdateEmergencyConsole(float frameTime)
{
// Add some buffer time so eshuttle always first.
- var minTime = -(TransitTime - (ShuttleSystem.DefaultStartupTime + ShuttleSystem.DefaultTravelTime + 1f));
+ var minTime = -(TransitTime - (_shuttle.DefaultStartupTime + _shuttle.DefaultTravelTime + 1f));
// TODO: I know this is shit but I already just cleaned up a billion things.
}
// Imminent departure
- if (!_launchedShuttles && _consoleAccumulator <= ShuttleSystem.DefaultStartupTime)
+ if (!_launchedShuttles && _consoleAccumulator <= _shuttle.DefaultStartupTime)
{
_launchedShuttles = true;
/// </summary>
private void OnEmergencyFTL(EntityUid uid, EmergencyShuttleComponent component, ref FTLStartedEvent args)
{
- TimeSpan ftlTime = TimeSpan.FromSeconds
+ var ftlTime = TimeSpan.FromSeconds
(
- TryComp<FTLComponent>(uid, out var ftlComp) ?
- ftlComp.TravelTime : ShuttleSystem.DefaultTravelTime
+ TryComp<FTLComponent>(uid, out var ftlComp) ? ftlComp.TravelTime : _shuttle.DefaultTravelTime
);
if (TryComp<DeviceNetworkComponent>(uid, out var netComp))
using Content.Server.Station.Events;
using Content.Shared.Body.Components;
using Content.Shared.Buckle.Components;
+using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.Ghost;
using Content.Shared.Maps;
* This is a way to move a shuttle from one location to another, via an intermediate map for fanciness.
*/
- public const float DefaultStartupTime = 5.5f;
- public const float DefaultTravelTime = 20f;
- public const float DefaultArrivalTime = 5f;
- private const float FTLCooldown = 10f;
- public const float FTLMassLimit = 300f;
-
- // I'm too lazy to make CVars.
- // >:(
- // Confusingly, some of them already are cvars?
- // I.e., shuttle transit time???
- // TODO Shuttle: fix spaghetti
-
private readonly SoundSpecifier _startupSound = new SoundPathSpecifier("/Audio/Effects/Shuttle/hyperspace_begin.ogg")
{
Params = AudioParams.Default.WithVolume(-5f),
Params = AudioParams.Default.WithVolume(-5f),
};
- private readonly TimeSpan _hyperspaceKnockdownTime = TimeSpan.FromSeconds(5);
+ public float DefaultStartupTime;
+ public float DefaultTravelTime;
+ public float DefaultArrivalTime;
+ private float FTLCooldown;
+ public float FTLMassLimit;
+ private TimeSpan _hyperspaceKnockdownTime = TimeSpan.FromSeconds(5);
/// <summary>
/// Left-side of the station we're allowed to use
_physicsQuery = GetEntityQuery<PhysicsComponent>();
_statusQuery = GetEntityQuery<StatusEffectsComponent>();
_xformQuery = GetEntityQuery<TransformComponent>();
+
+ _cfg.OnValueChanged(CCVars.FTLStartupTime, time => DefaultStartupTime = time, true);
+ _cfg.OnValueChanged(CCVars.FTLTravelTime, time => DefaultTravelTime = time, true);
+ _cfg.OnValueChanged(CCVars.FTLArrivalTime, time => DefaultArrivalTime = time, true);
+ _cfg.OnValueChanged(CCVars.FTLCooldown, time => FTLCooldown = time, true);
+ _cfg.OnValueChanged(CCVars.FTLMassLimit, time => FTLMassLimit = time, true);
+ _cfg.OnValueChanged(CCVars.HyperspaceKnockdownTime, time => _hyperspaceKnockdownTime = TimeSpan.FromSeconds(time), true);
}
private void OnStationPostInit(ref StationPostInitEvent ev)
return false;
}
- if (TryComp(shuttleUid, out PhysicsComponent? shuttlePhysics) && shuttlePhysics.Mass > FTLMassLimit)
+ if (FTLMassLimit > 0 &&
+ TryComp(shuttleUid, out PhysicsComponent? shuttlePhysics) &&
+ shuttlePhysics.Mass > FTLMassLimit)
{
reason = Loc.GetString("shuttle-console-mass");
return false;
ShuttleComponent component,
EntityCoordinates coordinates,
Angle angle,
- float startupTime = DefaultStartupTime,
- float hyperspaceTime = DefaultTravelTime,
+ float? startupTime = null,
+ float? hyperspaceTime = null,
string? priorityTag = null)
{
if (!TrySetupFTL(shuttleUid, component, out var hyperspace))
return;
- hyperspace.StartupTime = startupTime;
- hyperspace.TravelTime = hyperspaceTime;
+ startupTime ??= DefaultStartupTime;
+ hyperspaceTime ??= DefaultTravelTime;
+
+ hyperspace.StartupTime = startupTime.Value;
+ hyperspace.TravelTime = hyperspaceTime.Value;
hyperspace.StateTime = StartEndTime.FromStartDuration(
_gameTiming.CurTime,
TimeSpan.FromSeconds(hyperspace.StartupTime));
EntityUid shuttleUid,
ShuttleComponent component,
EntityUid target,
- float startupTime = DefaultStartupTime,
- float hyperspaceTime = DefaultTravelTime,
+ float? startupTime = null,
+ float? hyperspaceTime = null,
string? priorityTag = null)
{
if (!TrySetupFTL(shuttleUid, component, out var hyperspace))
return;
+ startupTime ??= DefaultStartupTime;
+ hyperspaceTime ??= DefaultTravelTime;
+
var config = _dockSystem.GetDockingConfig(shuttleUid, target, priorityTag);
- hyperspace.StartupTime = startupTime;
- hyperspace.TravelTime = hyperspaceTime;
+ hyperspace.StartupTime = startupTime.Value;
+ hyperspace.TravelTime = hyperspaceTime.Value;
hyperspace.StateTime = StartEndTime.FromStartDuration(
_gameTiming.CurTime,
TimeSpan.FromSeconds(hyperspace.StartupTime));
public static readonly CVarDef<bool> PreloadGrids =
CVarDef.Create("shuttle.preload_grids", true, CVar.SERVERONLY);
+ /// <summary>
+ /// Whether to automatically spawn escape shuttles.
+ /// </summary>
+ public static readonly CVarDef<float> FTLStartupTime =
+ CVarDef.Create("shuttle.startup_time", 5.5f, CVar.SERVERONLY);
+
+ /// <summary>
+ /// Whether to automatically spawn escape shuttles.
+ /// </summary>
+ public static readonly CVarDef<float> FTLTravelTime =
+ CVarDef.Create("shuttle.travel_time", 20f, CVar.SERVERONLY);
+
+ /// <summary>
+ /// Whether to automatically spawn escape shuttles.
+ /// </summary>
+ public static readonly CVarDef<float> FTLArrivalTime =
+ CVarDef.Create("shuttle.arrival_time", 5f, CVar.SERVERONLY);
+
+ /// <summary>
+ /// Whether to automatically spawn escape shuttles.
+ /// </summary>
+ public static readonly CVarDef<float> FTLCooldown =
+ CVarDef.Create("shuttle.cooldown", 10f, CVar.SERVERONLY);
+
+ /// <summary>
+ /// Whether to automatically spawn escape shuttles.
+ /// </summary>
+ public static readonly CVarDef<float> FTLMassLimit =
+ CVarDef.Create("shuttle.mass_limit", 300f, CVar.SERVERONLY);
+
+ /// <summary>
+ /// Whether to automatically spawn escape shuttles.
+ /// </summary>
+ public static readonly CVarDef<float> HyperspaceKnockdownTime =
+ CVarDef.Create("shuttle.hyperspace_knockdown_time", 5f, CVar.SERVERONLY);
+
/*
* Emergency
*/
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AL/@EntryIndexedValue">AL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BB/@EntryIndexedValue">BB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CC/@EntryIndexedValue">CC</s:String>
+ <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FTL/@EntryIndexedValue">FTL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GC/@EntryIndexedValue">GC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GD/@EntryIndexedValue">GD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GL/@EntryIndexedValue">GL</s:String>