Increase shuttle FTL cooldown to prevent FTL spamming (#42209)

* seperate out shuttle cooldowns

* fix

* feedback

* fix spacing

* update to TimeSpan

* GOAT float

* return to TimeSpan

* add var

* clarify with seconds

* clarifying some things
This commit is contained in:
mikey
2026-01-08 22:44:22 -08:00
committed by GitHub
parent 22682fccc3
commit ec024001e7
3 changed files with 24 additions and 5 deletions

View File

@@ -68,5 +68,12 @@ namespace Content.Server.Shuttles.Components
/// </summary>
[DataField]
public float DampingModifier;
/// <summary>
/// Optional override for the FTL cooldown for this shuttle.
/// If not null, then the value will be used instead of the shuttle.cooldown CCVar.
/// </summary>
[DataField]
public TimeSpan? FTLCooldownOverride = null;
}
}

View File

@@ -48,7 +48,8 @@ public sealed partial class ShuttleSystem
public float DefaultStartupTime;
public float DefaultTravelTime;
public float DefaultArrivalTime;
private float FTLCooldown;
private TimeSpan FTLCooldown;
private TimeSpan ArrivalsFTLCooldown;
public float FTLMassLimit;
private TimeSpan _hyperspaceKnockdownTime = TimeSpan.FromSeconds(5);
@@ -87,7 +88,8 @@ public sealed partial class ShuttleSystem
_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.FTLCooldown, time => FTLCooldown = TimeSpan.FromSeconds(time), true);
_cfg.OnValueChanged(CCVars.ArrivalsFTLCooldown, time => ArrivalsFTLCooldown = TimeSpan.FromSeconds(time), true);
_cfg.OnValueChanged(CCVars.FTLMassLimit, time => FTLMassLimit = time, true);
_cfg.OnValueChanged(CCVars.HyperspaceKnockdownTime, time => _hyperspaceKnockdownTime = TimeSpan.FromSeconds(time), true);
}
@@ -542,7 +544,10 @@ public sealed partial class ShuttleSystem
}
comp.State = FTLState.Cooldown;
comp.StateTime = StartEndTime.FromCurTime(_gameTiming, FTLCooldown);
var cooldown = entity.Comp2.FTLCooldownOverride ?? (HasComp<ArrivalsShuttleComponent>(uid)
? ArrivalsFTLCooldown
: FTLCooldown);
comp.StateTime = StartEndTime.FromCurTime(_gameTiming, cooldown);
_console.RefreshShuttleConsoles(uid);
_mapSystem.SetPaused(mapId, false);
Smimsh(uid, xform: xform);

View File

@@ -95,10 +95,17 @@ public sealed partial class CCVars
CVarDef.Create("shuttle.arrival_time", 5f, CVar.SERVERONLY);
/// <summary>
/// How much time needs to pass before a shuttle can FTL again.
/// How much time in seconds that needs to pass before a non-arrivals shuttle can FTL again.
/// </summary>
public static readonly CVarDef<float> FTLCooldown =
CVarDef.Create("shuttle.cooldown", 10f, CVar.SERVERONLY);
CVarDef.Create("shuttle.cooldown", 60f, CVar.SERVERONLY);
/// <summary>
/// How much time in seconds that needs to pass before the arrivals shuttle can FTL again.
/// If this is adjusted, ensure that shuttle.arrivals_cooldown is longer than this value.
/// </summary>
public static readonly CVarDef<float> ArrivalsFTLCooldown =
CVarDef.Create("shuttle.arrivals_ftl_cooldown", 10f, CVar.SERVERONLY);
/// <summary>
/// The maximum <see cref="PhysicsComponent.Mass"/> a grid can have before it becomes unable to FTL.