diff --git a/Content.Client/PDA/PdaMenu.xaml b/Content.Client/PDA/PdaMenu.xaml index 8c9b4ae2ee..d66e51a0c7 100644 --- a/Content.Client/PDA/PdaMenu.xaml +++ b/Content.Client/PDA/PdaMenu.xaml @@ -43,6 +43,11 @@ + + + + + diff --git a/Content.Client/PDA/PdaMenu.xaml.cs b/Content.Client/PDA/PdaMenu.xaml.cs index 712e0cbb01..38da9c9077 100644 --- a/Content.Client/PDA/PdaMenu.xaml.cs +++ b/Content.Client/PDA/PdaMenu.xaml.cs @@ -32,6 +32,7 @@ namespace Content.Client.PDA 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"); + private string _currentDate = Loc.GetString("comp-pda-ui-unknown"); // DeltaV - PDA date private int _currentView; @@ -125,6 +126,13 @@ namespace Content.Client.PDA _clipboard.SetText(_instructions); }; + // Begin DeltaV additions + CurrentDateButton.OnPressed += _ => + { + _clipboard.SetText(_currentDate); + }; + // End DeltaV additions + @@ -187,6 +195,14 @@ namespace Content.Client.PDA "comp-pda-ui-station-alert-level-instructions", ("instructions", _instructions)) ); + // Begin DeltaV additions + if (state.PdaOwnerInfo.CurrentDate is { } curDate) + _currentDate = curDate.ToString("dd MMMM yyyy"); + CurrentDateLabel.SetMarkup(Loc.GetString( + "comp-pda-ui-current-date", + ("date", _currentDate) + )); + // End DeltaV additions AddressLabel.Text = state.Address?.ToUpper() ?? " - "; diff --git a/Content.Server/PDA/PdaSystem.cs b/Content.Server/PDA/PdaSystem.cs index 282290e469..dfd28ee9ed 100644 --- a/Content.Server/PDA/PdaSystem.cs +++ b/Content.Server/PDA/PdaSystem.cs @@ -7,6 +7,7 @@ using Content.Server.PDA.Ringer; using Content.Server.Station.Systems; using Content.Server.Store.Systems; using Content.Server.Traitor.Uplink; +using Content.Shared._DV.CCVars; // DeltaV - PDA date using Content.Shared.Access.Components; using Content.Shared.CartridgeLoader; using Content.Shared.Chat; @@ -19,6 +20,7 @@ using Content.Shared.PDA; using Content.Shared.PDA.Ringer; using Robust.Server.Containers; using Robust.Server.GameObjects; +using Robust.Shared.Configuration; // DeltaV - PDA date using Robust.Shared.Containers; using Robust.Shared.Player; using Robust.Shared.Utility; @@ -37,6 +39,9 @@ namespace Content.Server.PDA [Dependency] private readonly UnpoweredFlashlightSystem _unpoweredFlashlight = default!; [Dependency] private readonly ContainerSystem _containerSystem = default!; [Dependency] private readonly IdCardSystem _idCard = default!; + [Dependency] private readonly IConfigurationManager _config = default!; // DeltaV + + private static DateTime ServerDate; // DeltaV - PDA public override void Initialize() { @@ -59,6 +64,13 @@ namespace Content.Server.PDA SubscribeLocalEvent(OnEntityRenamed, after: new[] { typeof(IdCardSystem) }); SubscribeLocalEvent(OnAlertLevelChanged); SubscribeLocalEvent>(ChameleonControllerOutfitItemSelected); + + // Begin DeltaV additions + Subs.CVar(_config, + DCCVars.YearOffset, + value => ServerDate = DateTime.Today.AddYears(value), + true); + // End DeltaV additions } private void ChameleonControllerOutfitItemSelected(Entity ent, ref InventoryRelayedEvent args) @@ -189,6 +201,7 @@ namespace Content.Server.PDA var hasInstrument = HasComp(uid); var showUplink = HasComp(uid) && IsUnlocked(uid); + pda.CurrentDate = pda.DateOverride ?? ServerDate; // DeltaV - PDA date UpdateStationName(uid, pda); UpdateAlertLevel(uid, pda); // TODO: Update the level and name of the station with each call to UpdatePdaUi is only needed for latejoin players. @@ -211,6 +224,7 @@ namespace Content.Server.PDA ActualOwnerName = pda.OwnerName, IdOwner = id?.FullName, JobTitle = id?.LocalizedJobTitle, + CurrentDate = pda.CurrentDate, // DeltaV - PDA date StationAlertLevel = pda.StationAlertLevel, StationAlertColor = pda.StationAlertColor }, diff --git a/Content.Shared/PDA/PdaComponent.cs b/Content.Shared/PDA/PdaComponent.cs index cdfeffa2c1..fc010d32e3 100644 --- a/Content.Shared/PDA/PdaComponent.cs +++ b/Content.Shared/PDA/PdaComponent.cs @@ -38,5 +38,7 @@ namespace Content.Shared.PDA [ViewVariables] public string? StationName; [ViewVariables] public string? StationAlertLevel; [ViewVariables] public Color StationAlertColor = Color.White; + [DataField] public DateTime CurrentDate; // DeltaV - PDA date + [DataField] public DateTime? DateOverride; // DeltaV - PDA date } } diff --git a/Content.Shared/PDA/PdaUpdateState.cs b/Content.Shared/PDA/PdaUpdateState.cs index cf217ed9b2..784ca35d43 100644 --- a/Content.Shared/PDA/PdaUpdateState.cs +++ b/Content.Shared/PDA/PdaUpdateState.cs @@ -49,5 +49,6 @@ namespace Content.Shared.PDA public string? JobTitle; public string? StationAlertLevel; public Color StationAlertColor; + public DateTime? CurrentDate; // DeltaV - PDA date } } diff --git a/Content.Shared/_DV/CCVars/DCCVars.cs b/Content.Shared/_DV/CCVars/DCCVars.cs index a34604bec8..5cb9799a62 100644 --- a/Content.Shared/_DV/CCVars/DCCVars.cs +++ b/Content.Shared/_DV/CCVars/DCCVars.cs @@ -106,6 +106,12 @@ public sealed partial class DCCVars public static readonly CVarDef Shipyard = CVarDef.Create("shuttle.shipyard", true, CVar.SERVERONLY); + /// + /// What year it is in the game. Actual value shown in game is server date + this value. + /// + public static readonly CVarDef YearOffset = + CVarDef.Create("game.current_year_offset", 550, CVar.SERVERONLY); + /* * Feedback webhook */ diff --git a/Resources/Locale/en-US/_DV/pda/pda-component.ftl b/Resources/Locale/en-US/_DV/pda/pda-component.ftl new file mode 100644 index 0000000000..45701eebf4 --- /dev/null +++ b/Resources/Locale/en-US/_DV/pda/pda-component.ftl @@ -0,0 +1 @@ +comp-pda-ui-current-date = Current date: [color=white]{ $date }[/color]