public Action<string>? OnAddHistory;
public Action<uint>? OnDeleteHistory;
+ private uint _maxLength;
private uint? _index;
private DialogWindow? _dialog;
- public CrimeHistoryWindow()
+ public CrimeHistoryWindow(uint maxLength)
{
RobustXamlLoader.Load(this);
+ _maxLength = maxLength;
+
OnClose += () =>
{
_dialog?.Close();
_dialog.OnConfirmed += responses =>
{
var line = responses[field];
- // TODO: whenever the console is moved to shared unhardcode this
- if (line.Length < 1 || line.Length > 256)
+ if (line.Length < 1 || line.Length > _maxLength)
return;
OnAddHistory?.Invoke(line);
using Content.Shared.Access.Systems;
using Content.Shared.CriminalRecords;
+using Content.Shared.CriminalRecords.Components;
using Content.Shared.Security;
using Content.Shared.StationRecords;
using Robust.Client.Player;
{
base.Open();
- _window = new(Owner, _playerManager, _proto, _random, _accessReader);
+ var comp = EntMan.GetComponent<CriminalRecordsConsoleComponent>(Owner);
+
+ _window = new(Owner, comp.MaxStringLength, _playerManager, _proto, _random, _accessReader);
_window.OnKeySelected += key =>
SendMessage(new SelectStationRecord(key));
_window.OnFiltersChanged += (type, filterValue) =>
_window.OnHistoryClosed += () => _historyWindow?.Close();
_window.OnClose += Close;
- _historyWindow = new();
+ _historyWindow = new(comp.MaxStringLength);
_historyWindow.OnAddHistory += line => SendMessage(new CriminalRecordAddHistory(line));
_historyWindow.OnDeleteHistory += index => SendMessage(new CriminalRecordDeleteHistory(index));
public Action? OnHistoryClosed;
public Action<SecurityStatus, string>? OnDialogConfirmed;
+ private uint _maxLength;
private bool _isPopulating;
private bool _access;
private uint? _selectedKey;
private StationRecordFilterType _currentFilterType;
- public CriminalRecordsConsoleWindow(EntityUid console, IPlayerManager playerManager, IPrototypeManager prototypeManager, IRobustRandom robustRandom, AccessReaderSystem accessReader)
+ public CriminalRecordsConsoleWindow(EntityUid console, uint maxLength, IPlayerManager playerManager, IPrototypeManager prototypeManager, IRobustRandom robustRandom, AccessReaderSystem accessReader)
{
RobustXamlLoader.Load(this);
_random = robustRandom;
_accessReader = accessReader;
+ _maxLength = maxLength;
_currentFilterType = StationRecordFilterType.Name;
OpenCentered();
_reasonDialog.OnConfirmed += responses =>
{
var reason = responses[field];
- // TODO: same as history unhardcode
- if (reason.Length < 1 || reason.Length > 256)
+ if (reason.Length < 1 || reason.Length > _maxLength)
return;
OnDialogConfirmed?.Invoke(SecurityStatus.Wanted, reason);
--- /dev/null
+using Content.Shared.CriminalRecords.Systems;
+
+namespace Content.Client.CriminalRecords.Systems;
+
+public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleSystem
+{
+}
-using Content.Server.CriminalRecords.Components;
using Content.Server.Popups;
using Content.Server.Radio.EntitySystems;
using Content.Server.Station.Systems;
using Content.Server.StationRecords.Systems;
using Content.Shared.Access.Systems;
using Content.Shared.CriminalRecords;
+using Content.Shared.CriminalRecords.Components;
+using Content.Shared.CriminalRecords.Systems;
using Content.Shared.Security;
using Content.Shared.StationRecords;
using Robust.Server.GameObjects;
namespace Content.Server.CriminalRecords.Systems;
-public sealed class CriminalRecordsConsoleSystem : EntitySystem
+/// <summary>
+/// Handles all UI for criminal records console
+/// </summary>
+public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleSystem
{
[Dependency] private readonly AccessReaderSystem _access = default!;
[Dependency] private readonly CriminalRecordsSystem _criminalRecords = default!;
-using Content.Server.CriminalRecords.Systems;
+using Content.Shared.CriminalRecords.Systems;
using Content.Shared.Radio;
using Content.Shared.StationRecords;
using Robust.Shared.Prototypes;
-namespace Content.Server.CriminalRecords.Components;
+namespace Content.Shared.CriminalRecords.Components;
/// <summary>
/// A component for Criminal Record Console storing an active station record key and a currently applied filter
/// </summary>
[RegisterComponent]
-[Access(typeof(CriminalRecordsConsoleSystem))]
+[Access(typeof(SharedCriminalRecordsConsoleSystem))]
public sealed partial class CriminalRecordsConsoleComponent : Component
{
/// <summary>
--- /dev/null
+namespace Content.Shared.CriminalRecords.Systems;
+
+/// <summary>
+/// Nothing is predicted just exists for access.
+/// </summary>
+public abstract class SharedCriminalRecordsConsoleSystem : EntitySystem
+{
+}