- add: Criminal records hud icons (#32)
This commit is contained in:
@@ -34,8 +34,8 @@ public sealed class CriminalRecordsConsoleBoundUserInterface : BoundUserInterfac
|
|||||||
SendMessage(new SetStationRecordFilter(type, filterValue));
|
SendMessage(new SetStationRecordFilter(type, filterValue));
|
||||||
_window.OnStatusSelected += status =>
|
_window.OnStatusSelected += status =>
|
||||||
SendMessage(new CriminalRecordChangeStatus(status, null));
|
SendMessage(new CriminalRecordChangeStatus(status, null));
|
||||||
_window.OnDialogConfirmed += (_, reason) =>
|
_window.OnDialogConfirmed += (status, reason) => // WD EDIT
|
||||||
SendMessage(new CriminalRecordChangeStatus(SecurityStatus.Wanted, reason));
|
SendMessage(new CriminalRecordChangeStatus(status, reason)); // WD EDIT
|
||||||
_window.OnHistoryUpdated += UpdateHistory;
|
_window.OnHistoryUpdated += UpdateHistory;
|
||||||
_window.OnHistoryClosed += () => _historyWindow?.Close();
|
_window.OnHistoryClosed += () => _historyWindow?.Close();
|
||||||
_window.OnClose += Close;
|
_window.OnClose += Close;
|
||||||
|
|||||||
@@ -217,16 +217,16 @@ public sealed partial class CriminalRecordsConsoleWindow : FancyWindow
|
|||||||
|
|
||||||
private void SetStatus(SecurityStatus status)
|
private void SetStatus(SecurityStatus status)
|
||||||
{
|
{
|
||||||
if (status == SecurityStatus.Wanted)
|
if (status is SecurityStatus.Wanted or SecurityStatus.Suspected) // WD EDIT
|
||||||
{
|
{
|
||||||
GetWantedReason();
|
GetWantedReason(status); // WD EDIT
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OnStatusSelected?.Invoke(status);
|
OnStatusSelected?.Invoke(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GetWantedReason()
|
private void GetWantedReason(SecurityStatus status = SecurityStatus.Wanted) // WD EDIT
|
||||||
{
|
{
|
||||||
if (_reasonDialog != null)
|
if (_reasonDialog != null)
|
||||||
{
|
{
|
||||||
@@ -235,7 +235,7 @@ public sealed partial class CriminalRecordsConsoleWindow : FancyWindow
|
|||||||
}
|
}
|
||||||
|
|
||||||
var field = "reason";
|
var field = "reason";
|
||||||
var title = Loc.GetString("criminal-records-status-wanted");
|
var title = Loc.GetString($"criminal-records-status-{status.ToString().ToLower()}"); // WD EDIT
|
||||||
var placeholders = _proto.Index<DatasetPrototype>(ReasonPlaceholders);
|
var placeholders = _proto.Index<DatasetPrototype>(ReasonPlaceholders);
|
||||||
var placeholder = Loc.GetString("criminal-records-console-reason-placeholder", ("placeholder", _random.Pick(placeholders.Values))); // just funny it doesn't actually get used
|
var placeholder = Loc.GetString("criminal-records-console-reason-placeholder", ("placeholder", _random.Pick(placeholders.Values))); // just funny it doesn't actually get used
|
||||||
var prompt = Loc.GetString("criminal-records-console-reason");
|
var prompt = Loc.GetString("criminal-records-console-reason");
|
||||||
@@ -250,7 +250,7 @@ public sealed partial class CriminalRecordsConsoleWindow : FancyWindow
|
|||||||
if (reason.Length < 1 || reason.Length > 256)
|
if (reason.Length < 1 || reason.Length > 256)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OnDialogConfirmed?.Invoke(SecurityStatus.Wanted, reason);
|
OnDialogConfirmed?.Invoke(status, reason); // WD EDIT
|
||||||
};
|
};
|
||||||
|
|
||||||
_reasonDialog.OnClose += () => { _reasonDialog = null; };
|
_reasonDialog.OnClose += () => { _reasonDialog = null; };
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Content.Shared._Miracle.Components;
|
||||||
using Content.Shared.Access.Components;
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
|
using Content.Shared.IdentityManagement.Components;
|
||||||
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Mindshield.Components;
|
using Content.Shared.Mindshield.Components;
|
||||||
using Content.Shared.Overlays;
|
using Content.Shared.Overlays;
|
||||||
using Content.Shared.PDA;
|
using Content.Shared.PDA;
|
||||||
|
using Content.Shared.Security;
|
||||||
using Content.Shared.StatusIcon;
|
using Content.Shared.StatusIcon;
|
||||||
using Content.Shared.StatusIcon.Components;
|
using Content.Shared.StatusIcon.Components;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -13,12 +18,11 @@ public sealed class ShowSecurityIconsSystem : EquipmentHudSystem<ShowSecurityIco
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeMan = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeMan = default!;
|
||||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
||||||
/*/ WD EDIT START
|
// WD EDIT START
|
||||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||||
[Dependency] private readonly ShowCrimeRecordsSystem _parentSystem = default!;
|
[Dependency] private readonly SharedIdCardSystem _idCard = default!;
|
||||||
// WD EDIT END
|
// WD EDIT END
|
||||||
*/
|
|
||||||
|
|
||||||
[ValidatePrototypeId<StatusIconPrototype>]
|
[ValidatePrototypeId<StatusIconPrototype>]
|
||||||
private const string JobIconForNoId = "JobIconNoId";
|
private const string JobIconForNoId = "JobIconNoId";
|
||||||
@@ -80,84 +84,65 @@ public sealed class ShowSecurityIconsSystem : EquipmentHudSystem<ShowSecurityIco
|
|||||||
result.Add(icon);
|
result.Add(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*/ WD EDIT START
|
// WD EDIT START
|
||||||
if (!GetRecord(uid, out var type))
|
string? protoId;
|
||||||
return result;
|
switch (GetRecord(uid))
|
||||||
|
|
||||||
var protoId = type switch
|
|
||||||
{
|
{
|
||||||
EnumCriminalRecordType.Discharged => "CriminalRecordIconDischarged",
|
case SecurityStatus.Detained:
|
||||||
EnumCriminalRecordType.Incarcerated => "CriminalRecordIconIncarcerated",
|
protoId = "CriminalRecordIconIncarcerated";
|
||||||
EnumCriminalRecordType.Parolled => "CriminalRecordIconParolled",
|
break;
|
||||||
EnumCriminalRecordType.Suspected => "CriminalRecordIconSuspected",
|
case SecurityStatus.Released:
|
||||||
EnumCriminalRecordType.Wanted => "CriminalRecordIconWanted",
|
protoId = "CriminalRecordIconReleased";
|
||||||
_ => "CriminalRecordIconReleased"
|
break;
|
||||||
};
|
case SecurityStatus.Suspected:
|
||||||
|
protoId = "CriminalRecordIconSuspected";
|
||||||
|
break;
|
||||||
|
case SecurityStatus.Wanted:
|
||||||
|
protoId = "CriminalRecordIconWanted";
|
||||||
|
break;
|
||||||
|
case SecurityStatus.None:
|
||||||
|
default:
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (_prototypeMan.TryIndex<StatusIconPrototype>(protoId, out var recordIcon))
|
if (_prototypeMan.TryIndex<StatusIconPrototype>(protoId, out var recordIcon))
|
||||||
result.Add(recordIcon);
|
result.Add(recordIcon);
|
||||||
// WD EDIT END
|
// WD EDIT END
|
||||||
*/
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*/ WD EDIT START
|
// WD EDIT START
|
||||||
private bool GetRecord(EntityUid uid, out EnumCriminalRecordType type)
|
private SecurityStatus GetRecord(EntityUid uid)
|
||||||
{
|
{
|
||||||
if (!_entManager.TryGetComponent(uid, out MetaDataComponent? meta))
|
if (!_entManager.TryGetComponent(uid, out MetaDataComponent? meta))
|
||||||
|
return SecurityStatus.None;
|
||||||
|
|
||||||
|
var name = meta.EntityName;
|
||||||
|
|
||||||
|
var ev = new SeeIdentityAttemptEvent();
|
||||||
|
RaiseLocalEvent(uid, ev);
|
||||||
|
|
||||||
|
if (ev.Cancelled)
|
||||||
{
|
{
|
||||||
type = EnumCriminalRecordType.Released;
|
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid) &&
|
||||||
return false;
|
_idCard.TryGetIdCard(idUid.Value, out var idCard))
|
||||||
|
name = idCard.Comp.FullName;
|
||||||
|
else
|
||||||
|
return SecurityStatus.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
var serverList = _entManager.EntityQuery<CriminalRecordsServerComponent>();
|
if (name == null)
|
||||||
foreach (var server in serverList)
|
return SecurityStatus.None;
|
||||||
|
|
||||||
|
var query = EntityQuery<CriminalStatusDataComponent>();
|
||||||
|
foreach (var data in query)
|
||||||
{
|
{
|
||||||
// if all good - check avaible records
|
if (data.Statuses.TryGetValue(name, out var status))
|
||||||
foreach (var (key, info) in server.Cache)
|
return status;
|
||||||
{
|
|
||||||
// Check id
|
|
||||||
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid))
|
|
||||||
{
|
|
||||||
// PDA
|
|
||||||
if (_entManager.TryGetComponent(idUid, out PdaComponent? pda) &&
|
|
||||||
_entManager.TryGetComponent(pda.ContainedId, out IdCardComponent? idCard))
|
|
||||||
{
|
|
||||||
if (idCard.FullName == info.StationRecord.Name &&
|
|
||||||
idCard.JobTitle == info.StationRecord.JobTitle)
|
|
||||||
{
|
|
||||||
type = info.CriminalType;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ID Card
|
|
||||||
if (_entManager.TryGetComponent(idUid, out IdCardComponent? id))
|
|
||||||
{
|
|
||||||
idCard = id;
|
|
||||||
if (idCard.FullName == info.StationRecord.Name &&
|
|
||||||
idCard.JobTitle == info.StationRecord.JobTitle)
|
|
||||||
{
|
|
||||||
type = info.CriminalType;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Check DNA (Dirty Nanotrasen tehnology lol)
|
|
||||||
// And yeah, he can't check - is pulled mask or not
|
|
||||||
// it's only Content.Server logic, idk hot it impl to Content.Client
|
|
||||||
if (_parentSystem.CanIdentityName(uid) != meta.EntityName)
|
|
||||||
continue;
|
|
||||||
if (meta.EntityName != info.StationRecord.Name)
|
|
||||||
continue;
|
|
||||||
type = info.CriminalType;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type = EnumCriminalRecordType.Released;
|
return SecurityStatus.None;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
// WD EDIT END
|
// WD EDIT END
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Content.Shared.StationRecords;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Content.Shared._Miracle.Components;
|
||||||
|
|
||||||
namespace Content.Server.CriminalRecords.Systems;
|
namespace Content.Server.CriminalRecords.Systems;
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ public sealed class CriminalRecordsConsoleSystem : EntitySystem
|
|||||||
private void OnChangeStatus(Entity<CriminalRecordsConsoleComponent> ent, ref CriminalRecordChangeStatus msg)
|
private void OnChangeStatus(Entity<CriminalRecordsConsoleComponent> ent, ref CriminalRecordChangeStatus msg)
|
||||||
{
|
{
|
||||||
// prevent malf client violating wanted/reason nullability
|
// prevent malf client violating wanted/reason nullability
|
||||||
if ((msg.Status == SecurityStatus.Wanted) != (msg.Reason != null))
|
if ((msg.Status is SecurityStatus.Wanted or SecurityStatus.Suspected) != (msg.Reason != null)) // WD EDIT
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!CheckSelected(ent, msg.Session, out var mob, out var key))
|
if (!CheckSelected(ent, msg.Session, out var mob, out var key))
|
||||||
@@ -121,11 +122,31 @@ public sealed class CriminalRecordsConsoleSystem : EntitySystem
|
|||||||
(_, SecurityStatus.None) => "not-wanted",
|
(_, SecurityStatus.None) => "not-wanted",
|
||||||
// going from none or detained, AOS or prisonbreak / lazy secoff never set them to released and they reoffended
|
// going from none or detained, AOS or prisonbreak / lazy secoff never set them to released and they reoffended
|
||||||
(_, SecurityStatus.Wanted) => "wanted",
|
(_, SecurityStatus.Wanted) => "wanted",
|
||||||
|
// WD EDIT START
|
||||||
|
(_, SecurityStatus.Released) => "released",
|
||||||
|
(_, SecurityStatus.Suspected) => "suspected",
|
||||||
|
// WD EDIT END
|
||||||
// this is impossible
|
// this is impossible
|
||||||
_ => "not-wanted"
|
_ => "not-wanted"
|
||||||
};
|
};
|
||||||
_radio.SendRadioMessage(ent, Loc.GetString($"criminal-records-console-{statusString}", args), ent.Comp.SecurityChannel, ent);
|
_radio.SendRadioMessage(ent, Loc.GetString($"criminal-records-console-{statusString}", args), ent.Comp.SecurityChannel, ent);
|
||||||
|
|
||||||
|
// WD EDIT START
|
||||||
|
if (_stationRecords.TryGetRecord<GeneralStationRecord>(key.Value, out var rec))
|
||||||
|
{
|
||||||
|
var query = EntityQueryEnumerator<CriminalStatusDataComponent>();
|
||||||
|
if (!query.MoveNext(out var entity, out var criminalData))
|
||||||
|
{
|
||||||
|
entity = Spawn(null, Transform(ent).Coordinates);
|
||||||
|
criminalData = EnsureComp<CriminalStatusDataComponent>(entity);
|
||||||
|
}
|
||||||
|
criminalData.Statuses[rec.Name] = msg.Status;
|
||||||
|
criminalData.Statuses[rec.ClownName] = msg.Status;
|
||||||
|
criminalData.Statuses[rec.MimeName] = msg.Status;
|
||||||
|
Dirty(entity, criminalData);
|
||||||
|
}
|
||||||
|
// WD EDIT END
|
||||||
|
|
||||||
UpdateUserInterface(ent);
|
UpdateUserInterface(ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
public enum SecurityStatus : byte
|
public enum SecurityStatus : byte
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
Released, // WD EDIT
|
||||||
|
Suspected, // WD EDIT
|
||||||
Wanted,
|
Wanted,
|
||||||
Detained
|
Detained
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using Content.Shared.Security;
|
||||||
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
|
namespace Content.Shared._Miracle.Components;
|
||||||
|
|
||||||
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||||
|
public sealed partial class CriminalStatusDataComponent : Component
|
||||||
|
{
|
||||||
|
[AutoNetworkedField, ViewVariables]
|
||||||
|
public Dictionary<string, SecurityStatus> Statuses = new();
|
||||||
|
}
|
||||||
@@ -11,6 +11,9 @@ criminal-records-status-none = None
|
|||||||
criminal-records-status-wanted = Wanted
|
criminal-records-status-wanted = Wanted
|
||||||
criminal-records-status-detained = Detained
|
criminal-records-status-detained = Detained
|
||||||
|
|
||||||
|
criminal-records-status-suspected = Suspected
|
||||||
|
criminal-records-status-released = Released
|
||||||
|
|
||||||
criminal-records-console-wanted-reason = [color=gray]Wanted Reason[/color]
|
criminal-records-console-wanted-reason = [color=gray]Wanted Reason[/color]
|
||||||
criminal-records-console-reason = Reason
|
criminal-records-console-reason = Reason
|
||||||
criminal-records-console-reason-placeholder = For example: {$placeholder}
|
criminal-records-console-reason-placeholder = For example: {$placeholder}
|
||||||
@@ -32,6 +35,8 @@ criminal-records-console-detained = {$name} has been detained by {$officer}.
|
|||||||
criminal-records-console-released = {$name} has been released by {$officer}.
|
criminal-records-console-released = {$name} has been released by {$officer}.
|
||||||
criminal-records-console-not-wanted = {$name} is no longer wanted.
|
criminal-records-console-not-wanted = {$name} is no longer wanted.
|
||||||
|
|
||||||
|
criminal-records-console-suspected = {$name} is suspected by {$officer} for: {$reason}.
|
||||||
|
|
||||||
## Filters
|
## Filters
|
||||||
|
|
||||||
criminal-records-filter-placeholder = Input text and press "Enter"
|
criminal-records-filter-placeholder = Input text and press "Enter"
|
||||||
|
|||||||
Reference in New Issue
Block a user