diff --git a/Content.Client/PDA/PdaMenu.xaml b/Content.Client/PDA/PdaMenu.xaml
index 8b26860332d..b3a420f58eb 100644
--- a/Content.Client/PDA/PdaMenu.xaml
+++ b/Content.Client/PDA/PdaMenu.xaml
@@ -43,6 +43,9 @@
+
+
+
diff --git a/Content.Client/PDA/PdaMenu.xaml.cs b/Content.Client/PDA/PdaMenu.xaml.cs
index 630861d0840..fd991b13cf4 100644
--- a/Content.Client/PDA/PdaMenu.xaml.cs
+++ b/Content.Client/PDA/PdaMenu.xaml.cs
@@ -32,7 +32,11 @@ public sealed partial class PdaMenu : PdaWindow
private string _stationName = Loc.GetString("comp-pda-ui-unknown");
private string _alertLevel = Loc.GetString("comp-pda-ui-unknown");
private string _instructions = Loc.GetString("comp-pda-ui-unknown");
-
+
+ // Sunrise-start
+ private TimeSpan? _evacShuttleTime;
+ private EvacShuttleStatus _evacShuttleStatus;
+ // Sunrise-end
private int _currentView;
@@ -125,7 +129,7 @@ public PdaMenu()
_clipboard.SetText(_instructions);
};
-
+
HideAllViews();
@@ -136,6 +140,11 @@ public void UpdateState(PdaUpdateState state)
{
FlashLightToggleButton.IsActive = state.FlashlightEnabled;
+ // Sunrise-start
+ _evacShuttleTime = state.PdaOwnerInfo.EvacShuttleTime;
+ _evacShuttleStatus = state.PdaOwnerInfo.EvacShuttleStatus;
+ // Sunrise-end
+
if (state.PdaOwnerInfo.ActualOwnerName != null)
{
_pdaOwner = state.PdaOwnerInfo.ActualOwnerName;
@@ -160,13 +169,25 @@ public void UpdateState(PdaUpdateState state)
_stationName = state.StationName ?? Loc.GetString("comp-pda-ui-unknown");
StationNameLabel.SetMarkup(Loc.GetString("comp-pda-ui-station",
("station", _stationName)));
-
+
var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);
StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
("time", stationTime.ToString("hh\\:mm\\:ss"))));
+ // Sunrise-start
+ var remaining = TimeSpan.Zero;
+
+ if (state.PdaOwnerInfo.EvacShuttleTime != null)
+ remaining = TimeSpan.FromSeconds(Math.Max((state.PdaOwnerInfo.EvacShuttleTime.Value - _gameTiming.CurTime).TotalSeconds, 0));
+
+ var statusText = EvacShuttleTitle(_evacShuttleStatus);
+
+ ShuttleTimeLabel.SetMarkup(Loc.GetString(statusText,
+ ("time", remaining.ToString("hh\\:mm\\:ss"))));
+ // Sunrise-end
+
var alertLevel = state.PdaOwnerInfo.StationAlertLevel;
var alertColor = state.PdaOwnerInfo.StationAlertColor;
var alertLevelKey = alertLevel != null ? $"alert-level-{alertLevel}" : "alert-level-unknown";
@@ -332,6 +353,23 @@ private void HideAllViews()
}
}
+ // Sunrise-start
+ private string EvacShuttleTitle(EvacShuttleStatus status)
+ {
+ switch (status)
+ {
+ case EvacShuttleStatus.WaitingToLaunch:
+ return "comp-pda-ui-shuttle-launch-time";
+ case EvacShuttleStatus.WaitingToArrival:
+ return "comp-pda-ui-shuttle-arrival-time";
+ case EvacShuttleStatus.WaitingToCall:
+ return "comp-pda-ui-shuttle-call-time";
+ default:
+ return "comp-pda-ui-shuttle-call-time";
+ }
+ }
+ // Sunrise-end
+
protected override void Draw(DrawingHandleScreen handle)
{
base.Draw(handle);
@@ -340,6 +378,18 @@ protected override void Draw(DrawingHandleScreen handle)
StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
("time", stationTime.ToString("hh\\:mm\\:ss"))));
+
+ // Sunrise-start
+ var remaining = TimeSpan.Zero;
+
+ if (_evacShuttleTime != null)
+ remaining = TimeSpan.FromSeconds(Math.Max((_evacShuttleTime.Value - _gameTiming.CurTime).TotalSeconds, 0));
+
+ var statusText = EvacShuttleTitle(_evacShuttleStatus);
+
+ ShuttleTimeLabel.SetMarkup(Loc.GetString(statusText,
+ ("time", remaining.ToString("hh\\:mm\\:ss"))));
+ // Sunrise-end
}
}
}
diff --git a/Content.Server/PDA/PdaSystem.cs b/Content.Server/PDA/PdaSystem.cs
index 43bf571eb45..e277fcff6f1 100644
--- a/Content.Server/PDA/PdaSystem.cs
+++ b/Content.Server/PDA/PdaSystem.cs
@@ -5,6 +5,9 @@
using Content.Server.Instruments;
using Content.Server.Light.EntitySystems;
using Content.Server.PDA.Ringer;
+using Content.Server.RoundEnd;
+using Content.Server.Shuttles.Components;
+using Content.Server.Shuttles.Systems;
using Content.Server.Station.Systems;
using Content.Server.Store.Components;
using Content.Server.Store.Systems;
@@ -19,9 +22,12 @@
using Content.Shared.Store.Components;
using Robust.Server.Containers;
using Robust.Server.GameObjects;
+using Robust.Shared.Configuration;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Utility;
+using Content.Shared.CCVar;
+using Robust.Shared.Timing;
namespace Content.Server.PDA
{
@@ -36,6 +42,9 @@ public sealed class PdaSystem : SharedPdaSystem
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly UnpoweredFlashlightSystem _unpoweredFlashlight = default!;
[Dependency] private readonly ContainerSystem _containerSystem = default!;
+ [Dependency] private readonly RoundEndSystem _roundEndSystem = default!;
+ [Dependency] private readonly EmergencyShuttleSystem _emergencyShuttleSystem = default!;
+ [Dependency] private readonly IGameTiming _gameTiming = default!;
public override void Initialize()
{
@@ -67,6 +76,7 @@ protected override void OnComponentInit(EntityUid uid, PdaComponent pda, Compone
UpdateAlertLevel(uid, pda);
UpdateStationName(uid, pda);
+ UpdateEvacShuttle(uid, pda); // Sunrise-edit
}
protected override void OnItemInserted(EntityUid uid, PdaComponent pda, EntInsertedIntoContainerMessage args)
@@ -158,6 +168,7 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null)
UpdateStationName(uid, pda);
UpdateAlertLevel(uid, pda);
+ UpdateEvacShuttle(uid, pda); // Sunrise-edit
// TODO: Update the level and name of the station with each call to UpdatePdaUi is only needed for latejoin players.
// TODO: If someone can implement changing the level and name of the station when changing the PDA grid, this can be removed.
@@ -179,7 +190,9 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null)
IdOwner = id?.FullName,
JobTitle = id?.JobTitle,
StationAlertLevel = pda.StationAlertLevel,
- StationAlertColor = pda.StationAlertColor
+ StationAlertColor = pda.StationAlertColor,
+ EvacShuttleStatus = pda.ShuttleStatus, // Sunrise-edit
+ EvacShuttleTime = pda.ShuttleTime // Sunrise-edit
},
pda.StationName,
showUplink,
@@ -266,6 +279,38 @@ private void UpdateStationName(EntityUid uid, PdaComponent pda)
pda.StationName = station is null ? null : Name(station.Value);
}
+ // Sunrise-start
+ private void UpdateEvacShuttle(EntityUid uid, PdaComponent pda)
+ {
+ TimeSpan? shuttleTime;
+ EvacShuttleStatus shuttleStatus;
+ if (_emergencyShuttleSystem.EmergencyShuttleArrived)
+ {
+ shuttleTime = _gameTiming.CurTime + TimeSpan.FromSeconds(_emergencyShuttleSystem.СonsoleAccumulator);
+ shuttleStatus = EvacShuttleStatus.WaitingToLaunch;
+ }
+ else
+ {
+ if (_roundEndSystem.ExpectedCountdownEnd != null)
+ {
+ shuttleTime = _roundEndSystem.ExpectedCountdownEnd;
+ shuttleStatus = EvacShuttleStatus.WaitingToArrival;
+ }
+ else
+ {
+ shuttleTime = _roundEndSystem.TimeToCallShuttle();
+ shuttleStatus = EvacShuttleStatus.WaitingToCall;
+ }
+ }
+ var station = _station.GetOwningStation(uid);
+ if (!TryComp(station, out var stationEmergencyShuttleComponent))
+ return;
+
+ pda.ShuttleStatus = shuttleStatus;
+ pda.ShuttleTime = shuttleTime;
+ }
+ // Sunrise-end
+
private void UpdateAlertLevel(EntityUid uid, PdaComponent pda)
{
var station = _station.GetOwningStation(uid);
diff --git a/Content.Server/RoundEnd/RoundEndSystem.cs b/Content.Server/RoundEnd/RoundEndSystem.cs
index 7aa005fb3cf..3f0e77abcea 100644
--- a/Content.Server/RoundEnd/RoundEndSystem.cs
+++ b/Content.Server/RoundEnd/RoundEndSystem.cs
@@ -363,6 +363,16 @@ public override void Update(float frameTime)
SetAutoCallTime();
}
}
+
+ // Sunrise-start
+ public TimeSpan TimeToCallShuttle()
+ {
+ var autoCalledBefore = _autoCalledBefore
+ ? _cfg.GetCVar(CCVars.EmergencyShuttleAutoCallExtensionTime)
+ : _cfg.GetCVar(CCVars.EmergencyShuttleAutoCallTime);
+ return AutoCallStartTime + TimeSpan.FromMinutes(autoCalledBefore);
+ }
+ // Sunrise-end
}
public sealed class RoundEndSystemChangedEvent : EntityEventArgs
diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
index b388147504b..4790c351e85 100644
--- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
+++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
@@ -39,6 +39,10 @@ public sealed partial class EmergencyShuttleSystem
///
private float _consoleAccumulator = float.MinValue;
+ // Sunrise-start
+ public float СonsoleAccumulator => _consoleAccumulator;
+ // Sunrise-end
+
///
/// How long after the transit is over to end the round.
///
diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
index 04063305f84..25bb84570d2 100644
--- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
+++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
@@ -37,6 +37,7 @@
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
+using Content.Server.GameTicking;
namespace Content.Server.Shuttles.Systems;
@@ -71,6 +72,10 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
private const float ShuttleSpawnBuffer = 1f;
+ // Sunrise-start
+ public TimeSpan? DockTime;
+ // Sunrise-end
+
private bool _emergencyShuttleEnabled;
[ValidatePrototypeId]
@@ -91,9 +96,17 @@ public override void Initialize()
SubscribeLocalEvent(OnEmergencyFTL);
SubscribeLocalEvent(OnEmergencyFTLComplete);
SubscribeNetworkEvent(OnShuttleRequestPosition);
+ SubscribeLocalEvent(OnRoundEnded); // Sunrise-edit
InitializeEmergencyConsole();
}
+ // Sunrise-start
+ private void OnRoundEnded(RoundEndTextAppendEvent ev)
+ {
+ DockTime = null;
+ }
+ // Sunrise-end
+
private void OnRoundStart(RoundStartingEvent ev)
{
CleanupEmergencyConsole();
@@ -271,6 +284,10 @@ public void CallEmergencyShuttle(EntityUid stationUid, StationEmergencyShuttleCo
var targetGrid = _station.GetLargestGrid(Comp(stationUid));
+ // Sunrise-start
+ DockTime = _timing.CurTime;
+ // Sunrise-end
+
// UHH GOOD LUCK
if (targetGrid == null)
{
diff --git a/Content.Shared/PDA/PdaComponent.cs b/Content.Shared/PDA/PdaComponent.cs
index d4cfc4fc0d8..42b355c917d 100644
--- a/Content.Shared/PDA/PdaComponent.cs
+++ b/Content.Shared/PDA/PdaComponent.cs
@@ -40,5 +40,7 @@ public sealed partial class PdaComponent : Component
[ViewVariables] public string? StationName;
[ViewVariables] public string? StationAlertLevel;
[ViewVariables] public Color StationAlertColor = Color.White;
+ [ViewVariables] public TimeSpan? ShuttleTime; // Sunrise-edit
+ [ViewVariables] public EvacShuttleStatus ShuttleStatus; // Sunrise-edit
}
}
diff --git a/Content.Shared/PDA/PdaUpdateState.cs b/Content.Shared/PDA/PdaUpdateState.cs
index cf217ed9b25..726433d6601 100644
--- a/Content.Shared/PDA/PdaUpdateState.cs
+++ b/Content.Shared/PDA/PdaUpdateState.cs
@@ -49,5 +49,16 @@ public struct PdaIdInfoText
public string? JobTitle;
public string? StationAlertLevel;
public Color StationAlertColor;
+ public TimeSpan? EvacShuttleTime; // Sunrise-edit
+ public EvacShuttleStatus EvacShuttleStatus; // Sunrise-edit
}
+
+ // Sunrise-start
+ public enum EvacShuttleStatus
+ {
+ WaitingToCall,
+ WaitingToArrival,
+ WaitingToLaunch
+ }
+ // Sunrise-end
}
diff --git a/Resources/Changelog/ChangelogSunrise.yml b/Resources/Changelog/ChangelogSunrise.yml
index 3afcefc34d1..bfeaf7573be 100644
--- a/Resources/Changelog/ChangelogSunrise.yml
+++ b/Resources/Changelog/ChangelogSunrise.yml
@@ -222,3 +222,14 @@ Entries:
type: Add
id: 19
time: '2024-06-04T06:27:00.064518+00:00'
+- author: VigersRay
+ changes:
+ - message: "\u0412 \u041A\u041F\u041A \u0442\u0435\u043F\u0435\u0440\u044C \u043E\
+ \u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044F \u0432\u0440\
+ \u0435\u043C\u044F \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F\
+ \ \u0441\u043C\u0435\u043D\u044B, \u043F\u0440\u0438\u0431\u044B\u0442\u0438\
+ \u044F \u0438 \u043E\u0442\u0431\u044B\u0442\u0438\u044F \u044D\u0432\u0430\u043A\
+ \ \u0448\u0430\u0442\u0442\u043B\u0430."
+ type: Tweak
+ id: 20
+ time: '2024-06-05T11:33:25.670495+00:00'
diff --git a/Resources/Locale/ru-RU/pda/pda-component.ftl b/Resources/Locale/ru-RU/pda/pda-component.ftl
index a0549ca97d7..2b62a04fb66 100644
--- a/Resources/Locale/ru-RU/pda/pda-component.ftl
+++ b/Resources/Locale/ru-RU/pda/pda-component.ftl
@@ -29,3 +29,9 @@ comp-pda-ui-unknown = Неизвестно
comp-pda-ui-unassigned = Не назначено
pda-notification-message = [font size=12][bold]КПК[/bold] { $header }: [/font]
"{ $message }"
+
+# Sunrise-start
+comp-pda-ui-shuttle-call-time = До смены экипажа: [color=white]{ $time }[/color]
+comp-pda-ui-shuttle-arrival-time = До прибытия шаттла: [color=white]{ $time }[/color]
+comp-pda-ui-shuttle-launch-time = До запуска шаттла: [color=white]{ $time }[/color]
+# Sunrise-end