forked from Horizon-Station-Coders/Horizon-Station
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement records saving. Add an additional column to the database that stores records as JSON. Currently the serialization logic is not very robust so a future commit should improve it so it can deal with missing and extra fields in the database. * Record editor gui Implements a record editor tab for HumanoidProfileEditor. In addition, this improves the robustness of the CharacterRecords deserializer. * Add imperial units to record editor. * Remove SecurityClearance from CharacterRecords * Add up and down buttons to the record entry editor This lets you select the order that records will appear in game. * Add system for managing records in game * Initial viewer UI Add the record console UI, currently it does not display entries. * Add entries to the record console * Clarify record computers. * Add records viewer to aghost * Add admin modification ui for character records * Improve record entry viewer * Remove contact number record * Character Records Guidebook Entry * Change from DefaultWindow to FancyWindow * Fix compile errors relating to rebase * Add rich text to record viewer We support all tags except the heading tag. This is because it looks very ugly. In addition, we also add a view button to the editor GUI so you can make sure your rich text works without going into a game. * Integrate wanted status into security records * Correctly subscribe to Bui events * Add comments to records and fix a few minor issues
- Loading branch information
1 parent
5e2767d
commit 2df5c3a
Showing
47 changed files
with
5,875 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
Title="{Loc cd-actions-admin-modify-records}" | ||
MinSize="300 300"> | ||
<BoxContainer Orientation="Vertical"> | ||
<LineEdit Name="EntityEdit" PlaceHolder="Entity" HorizontalExpand="True" /> | ||
<OptionButton Name="EntityEntryType" HorizontalExpand="True" /> | ||
<LineEdit Name="EntityEntryIndex" PlaceHolder="Index"/> | ||
<BoxContainer Orientation="Horizontal" > | ||
<cc:CommandButton Name="PurgeCommand" Text="{Loc cd-actions-admin-modify-reset}"/> | ||
<cc:CommandButton Name="DelCommand" Text="{Loc cd-actions-admin-modify-del-entry}"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</DefaultWindow> |
48 changes: 48 additions & 0 deletions
48
Content.Client/_CD/Admin/UI/ModifyCharacterRecords.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Content.Shared._CD.Records; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client._CD.Admin.UI; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class ModifyCharacterRecords : DefaultWindow | ||
{ | ||
public ModifyCharacterRecords() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
|
||
foreach (var v in Enum.GetValues<CharacterRecordType>()) | ||
{ | ||
EntityEntryType.AddItem(v.ToString()); | ||
} | ||
|
||
EntityEntryType.OnItemSelected += args => | ||
{ | ||
EntityEntryType.SelectId(args.Id); | ||
UpdateCommands(); | ||
}; | ||
|
||
EntityEdit.OnTextChanged += _ => UpdateCommands(); | ||
EntityEntryIndex.OnTextChanged += _ => UpdateCommands(); | ||
} | ||
|
||
private void UpdateCommands() | ||
{ | ||
if (!int.TryParse(EntityEdit.Text, out var uid)) | ||
{ | ||
return; | ||
} | ||
|
||
if (!int.TryParse(EntityEntryIndex.Text, out var idx)) | ||
{ | ||
return; | ||
} | ||
|
||
var ty = (CharacterRecordType)EntityEntryType.SelectedId; | ||
|
||
PurgeCommand.Command = $"purgecharacterrecords {uid}"; | ||
DelCommand.Command = $"delrecordentry {uid} {ty.ToString()} {idx}"; | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
Content.Client/_CD/Records/UI/CharacterRecordConsoleBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using Content.Shared._CD.Records; | ||
using Content.Shared.CriminalRecords; | ||
using Content.Shared.CriminalRecords.Components; | ||
using Content.Shared.Security; | ||
using Content.Shared.StationRecords; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Client._CD.Records.UI; | ||
|
||
[UsedImplicitly] | ||
public sealed class CharacterRecordConsoleBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] private CharacterRecordViewer? _window; | ||
|
||
[Dependency] private readonly EntityManager _entMan = default!; | ||
|
||
public CharacterRecordConsoleBoundUserInterface(EntityUid owner, Enum key) | ||
: base(owner, key) | ||
{ | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState baseState) | ||
{ | ||
base.UpdateState(baseState); | ||
if (baseState is not CharacterRecordConsoleState state) | ||
return; | ||
|
||
if (_window?.IsSecurity() ?? false) | ||
{ | ||
var comp = EntMan.GetComponent<CriminalRecordsConsoleComponent>(Owner); | ||
_window!.SecurityWantedStatusMaxLength = comp.MaxStringLength; | ||
} | ||
|
||
_window?.UpdateState(state); | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_window = new(); | ||
_window.OnClose += Close; | ||
_window.OnKeySelected += (ent, stationRecordKey) => | ||
{ | ||
SendMessage(new CharacterRecordConsoleSelectMsg(ent)); | ||
|
||
// If we are a security records console, we also need to inform the criminal records | ||
// system of our state. | ||
if (_window.IsSecurity() && stationRecordKey != null) | ||
{ | ||
SendMessage(new SelectStationRecord(stationRecordKey)); | ||
_window.SetSecurityStatusEnabled(true); | ||
} | ||
else | ||
{ | ||
// If the user does not have criminal records for some reason, we should not be able | ||
// to set their wanted status | ||
_window.SetSecurityStatusEnabled(false); | ||
} | ||
}; | ||
|
||
_window.OnFiltersChanged += (ty, txt) => | ||
{ | ||
if (txt == null) | ||
SendMessage(new CharacterRecordsConsoleFilterMsg(null)); | ||
else | ||
SendMessage(new CharacterRecordsConsoleFilterMsg(new StationRecordsFilter(ty, txt))); | ||
}; | ||
|
||
_window.OnSetSecurityStatus += status => | ||
{ | ||
SendMessage(new CriminalRecordChangeStatus(status, null)); | ||
}; | ||
|
||
_window.OnSetWantedStatus += reason => | ||
{ | ||
SendMessage(new CriminalRecordChangeStatus(SecurityStatus.Wanted, reason)); | ||
}; | ||
|
||
_window.OpenCentered(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
_window?.Close(); | ||
} | ||
} |
135 changes: 135 additions & 0 deletions
135
Content.Client/_CD/Records/UI/CharacterRecordViewer.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
MinSize="750 600"> | ||
<BoxContainer Orientation="Vertical"> | ||
<!-- Search bar --> | ||
<BoxContainer Margin="5 5 5 10" HorizontalExpand="true" VerticalAlignment="Center"> | ||
<OptionButton Name="RecordFilterType" MinWidth="200" Margin="0 0 10 0" Visible="False"/> | ||
<!-- Yes, we do steal some localizations, should be fine --> | ||
<LineEdit Name="RecordFiltersValue" | ||
PlaceHolder="{Loc 'general-station-record-for-filter-line-placeholder'}" HorizontalExpand="True"/> | ||
<Button Name="RecordFilters" Text="{Loc 'general-station-record-console-search-records'}"/> | ||
<Button Name="RecordFiltersReset" Text="{Loc 'general-station-record-console-reset-filters'}"/> | ||
</BoxContainer> | ||
<BoxContainer VerticalExpand="True"> | ||
<!-- Record listing --> | ||
<BoxContainer Orientation="Vertical" Margin="5" MinWidth="250" MaxWidth="250"> | ||
<Label Name="RecordListingStatus" Visible="False" /> | ||
<ScrollContainer VerticalExpand="True"> | ||
<ItemList Name="RecordListing" /> | ||
</ScrollContainer> | ||
</BoxContainer> | ||
<!-- Record box --> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="5"> | ||
<Label Name="RecordContainerStatus" Visible="False" Text="{Loc 'cd-record-viewer-no-record-selected'}"/> | ||
<BoxContainer Name="RecordContainer" Orientation="Vertical" Visible="False" > | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True"> | ||
<!-- Common --> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True"> | ||
<Label Name="RecordContainerName" StyleClasses="LabelBig" /> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'cd-character-records-viewer-record-age'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerAge" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'cd-character-records-viewer-record-title'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerJob" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'cd-character-records-viewer-record-gender'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerGender" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'cd-character-records-viewer-record-species'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerSpecies" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-height'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerHeight" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-weight'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerWeight" Align="Right"/> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-contact-name'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerContactName" Align="Right" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
<!-- Employment --> | ||
<BoxContainer Name="RecordContainerEmployment" Orientation="Vertical" HorizontalExpand="True" Visible="False" > | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-work-authorization'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerWorkAuth" Align="Right" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
<!-- Medical --> | ||
<BoxContainer Name="RecordContainerMedical" Orientation="Vertical" HorizontalExpand="True" Visible="False" > | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-allergies'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerAllergies" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-drug-allergies'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerDrugAllergies" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-postmortem'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerPostmortem" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'cd-character-records-viewer-record-med-sex'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerSex" Align="Right" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
<!-- Security --> | ||
<BoxContainer Name="RecordContainerSecurity" Orientation="Vertical" HorizontalExpand="True" Visible="False" > | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-identifying-features'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerIdentFeatures" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'cd-character-records-viewer-record-sec-fingerprint'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerFingerprint" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc 'cd-character-records-viewer-record-sec-dna'}"/> | ||
<Control HorizontalExpand="True" /> | ||
<Label Name="RecordContainerDNA" Align="Right" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal" Margin="5 5 5 5"> | ||
<Label Text="{Loc 'criminal-records-console-status'}" FontColorOverride="DarkGray"/> | ||
<OptionButton Name="StatusOptionButton"/> | ||
<Control MinWidth="5"/> | ||
<Label Name="RecordContainerWantedReason" Visible="False" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
<!-- Entry viewer --> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="10" SeparationOverride="5"> | ||
<ItemList Name="RecordEntryList" HorizontalExpand="True" MinHeight="200" /> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Button Name="RecordEntryViewButton" Text="{Loc 'cd-character-records-viewer-view-entry'}"/> | ||
<!-- Admin console entry type selector --> | ||
<OptionButton Name="RecordEntryViewType" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</controls:FancyWindow> |
Oops, something went wrong.