Add in-game date to the PDA (#4277)
* Change stuff * Change stuff * Comment the XAML * Change some more stuff * _DV bruh * Fix format string
This commit is contained in:
parent
83f9db03a0
commit
4126ef130b
|
|
@ -43,6 +43,11 @@
|
|||
<ContainerButton Name="StationTimeButton">
|
||||
<RichTextLabel Name="StationTimeLabel" Access="Public"/>
|
||||
</ContainerButton>
|
||||
<!-- Begin DeltaV changes -->
|
||||
<ContainerButton Name="CurrentDateButton">
|
||||
<RichTextLabel Name="CurrentDateLabel" Access="Public"/>
|
||||
</ContainerButton>
|
||||
<!-- End DeltaV changes -->
|
||||
<ContainerButton Name="StationAlertLevelInstructionsButton">
|
||||
<RichTextLabel Name="StationAlertLevelInstructions" Access="Public"/>
|
||||
</ContainerButton>
|
||||
|
|
|
|||
|
|
@ -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() ?? " - ";
|
||||
|
||||
|
|
|
|||
|
|
@ -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<EntityRenamedEvent>(OnEntityRenamed, after: new[] { typeof(IdCardSystem) });
|
||||
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertLevelChanged);
|
||||
SubscribeLocalEvent<PdaComponent, InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent>>(ChameleonControllerOutfitItemSelected);
|
||||
|
||||
// Begin DeltaV additions
|
||||
Subs.CVar(_config,
|
||||
DCCVars.YearOffset,
|
||||
value => ServerDate = DateTime.Today.AddYears(value),
|
||||
true);
|
||||
// End DeltaV additions
|
||||
}
|
||||
|
||||
private void ChameleonControllerOutfitItemSelected(Entity<PdaComponent> ent, ref InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent> args)
|
||||
|
|
@ -189,6 +201,7 @@ namespace Content.Server.PDA
|
|||
var hasInstrument = HasComp<InstrumentComponent>(uid);
|
||||
var showUplink = HasComp<UplinkComponent>(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
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,5 +49,6 @@ namespace Content.Shared.PDA
|
|||
public string? JobTitle;
|
||||
public string? StationAlertLevel;
|
||||
public Color StationAlertColor;
|
||||
public DateTime? CurrentDate; // DeltaV - PDA date
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,12 @@ public sealed partial class DCCVars
|
|||
public static readonly CVarDef<bool> Shipyard =
|
||||
CVarDef.Create("shuttle.shipyard", true, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// What year it is in the game. Actual value shown in game is server date + this value.
|
||||
/// </summary>
|
||||
public static readonly CVarDef<int> YearOffset =
|
||||
CVarDef.Create("game.current_year_offset", 550, CVar.SERVERONLY);
|
||||
|
||||
/*
|
||||
* Feedback webhook
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
comp-pda-ui-current-date = Current date: [color=white]{ $date }[/color]
|
||||
Loading…
Reference in New Issue