From e698fdf2626dad9d65d77a3a17c2b48a70881983 Mon Sep 17 00:00:00 2001 From: Fansana Date: Fri, 11 Oct 2024 04:38:56 +0200 Subject: [PATCH 1/3] add CCvars for arrivals shuttle --- Content.Shared/CCVar/CCVars.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 058dee0f04c..15186424a34 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1513,6 +1513,18 @@ public static readonly CVarDef public static readonly CVarDef ArrivalsCooldown = CVarDef.Create("shuttle.arrivals_cooldown", 50f, CVar.SERVERONLY); + /// + /// Time it takes the shuttle to spin up it's hyper drive and jump + /// + public static readonly CVarDef ArrivalsStartupTime= + CVarDef.Create("shuttle.arrivals_startup_time", 5.5f, CVar.SERVERONLY); + + /// + /// Time spent in hyperspace + /// + public static readonly CVarDef ArrivalsHyperspaceTime = + CVarDef.Create("shuttle.arrivals_hyperspace_time", 20f, CVar.SERVERONLY); + /// /// Are players allowed to return on the arrivals shuttle. /// From 83bd1a59abaa7fcfbafa8aae13fda06a5c46204a Mon Sep 17 00:00:00 2001 From: Fansana Date: Fri, 11 Oct 2024 04:42:06 +0200 Subject: [PATCH 2/3] fix shuttle docking to wrong port --- Content.Server/Shuttles/Systems/ArrivalsSystem.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 070d61e56a7..814af5edf58 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -170,6 +170,7 @@ private void ArrivalsCommand(IConsoleShell shell, string argstr, string[] args) RemCompDeferred(uid); shell.WriteLine(Loc.GetString("cmd-arrivals-forced", ("uid", ToPrettyString(uid)))); } + break; default: shell.WriteError(Loc.GetString($"cmd-arrivals-invalid")); @@ -254,7 +255,8 @@ private void OnArrivalsFTL(EntityUid shuttleUid, ArrivalsShuttleComponent compon private void OnArrivalsDocked(EntityUid uid, ArrivalsShuttleComponent component, ref FTLCompletedEvent args) { - TimeSpan dockTime = component.NextTransfer - _timing.CurTime + TimeSpan.FromSeconds(ShuttleSystem.DefaultStartupTime); + TimeSpan dockTime = component.NextTransfer - _timing.CurTime + + TimeSpan.FromSeconds(ShuttleSystem.DefaultStartupTime); if (TryComp(uid, out var netComp)) { @@ -426,7 +428,7 @@ public override void Update(float frameTime) if (xform.MapUid != arrivalsXform.MapUid) { if (arrivals.IsValid()) - _shuttles.FTLToDock(uid, shuttle, arrivals); + _shuttles.FTLToDock(uid, shuttle, arrivals, _cfgManager.GetCVar(CCVars.ArrivalsStartupTime), _cfgManager.GetCVar(CCVars.ArrivalsHyperspaceTime), "DockArrivals"); comp.NextArrivalsTime = _timing.CurTime + TimeSpan.FromSeconds(tripTime); } @@ -436,7 +438,7 @@ public override void Update(float frameTime) var targetGrid = _station.GetLargestGrid(data); if (targetGrid != null) - _shuttles.FTLToDock(uid, shuttle, targetGrid.Value); + _shuttles.FTLToDock(uid, shuttle, targetGrid.Value, _cfgManager.GetCVar(CCVars.ArrivalsStartupTime), _cfgManager.GetCVar(CCVars.ArrivalsHyperspaceTime), "DockArrivals"); // The ArrivalsCooldown includes the trip there, so we only need to add the time taken for // the trip back. @@ -563,7 +565,8 @@ private void SetupShuttle(EntityUid uid, StationArrivalsComponent component) arrivalsComp.Station = uid; EnsureComp(uid); _shuttles.FTLToDock(component.Shuttle, shuttleComp, arrivals, hyperspaceTime: RoundStartFTLDuration); - arrivalsComp.NextTransfer = _timing.CurTime + TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.ArrivalsCooldown)); + arrivalsComp.NextTransfer = + _timing.CurTime + TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.ArrivalsCooldown)); } // Don't start the arrivals shuttle immediately docked so power has a time to stabilise? From 3d5c47b91df95241570ee39b8f6e0508a0672448 Mon Sep 17 00:00:00 2001 From: Fansana Date: Fri, 11 Oct 2024 04:47:36 +0200 Subject: [PATCH 3/3] revert editor formating --- Content.Server/Shuttles/Systems/ArrivalsSystem.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 814af5edf58..3ea74436d5c 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -170,7 +170,6 @@ private void ArrivalsCommand(IConsoleShell shell, string argstr, string[] args) RemCompDeferred(uid); shell.WriteLine(Loc.GetString("cmd-arrivals-forced", ("uid", ToPrettyString(uid)))); } - break; default: shell.WriteError(Loc.GetString($"cmd-arrivals-invalid")); @@ -255,8 +254,7 @@ private void OnArrivalsFTL(EntityUid shuttleUid, ArrivalsShuttleComponent compon private void OnArrivalsDocked(EntityUid uid, ArrivalsShuttleComponent component, ref FTLCompletedEvent args) { - TimeSpan dockTime = component.NextTransfer - _timing.CurTime + - TimeSpan.FromSeconds(ShuttleSystem.DefaultStartupTime); + TimeSpan dockTime = component.NextTransfer - _timing.CurTime + TimeSpan.FromSeconds(ShuttleSystem.DefaultStartupTime); if (TryComp(uid, out var netComp)) { @@ -565,8 +563,7 @@ private void SetupShuttle(EntityUid uid, StationArrivalsComponent component) arrivalsComp.Station = uid; EnsureComp(uid); _shuttles.FTLToDock(component.Shuttle, shuttleComp, arrivals, hyperspaceTime: RoundStartFTLDuration); - arrivalsComp.NextTransfer = - _timing.CurTime + TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.ArrivalsCooldown)); + arrivalsComp.NextTransfer = _timing.CurTime + TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.ArrivalsCooldown)); } // Don't start the arrivals shuttle immediately docked so power has a time to stabilise?