[Feat] War crime console (#144)

* ADD: Icons, New component. Надо будет рефакторнуть худы в одну систему

* Some govno ebanoe

* ui

* Some govno

* UI and UI lol

* Dermo again

* ы

* Добавлена система консоли. Надо добавить манипуляцию с рекордами и сохранение крим. записей на сервер. Я пометил в туду

* Added functional for Criminal Records UI

* Дропаю это говно

* Рабочая версия крим консоли

* Fuull functional

* Added radio

* Arrest info feature

* improve ui

* another names

* New texturem Sprite viewer

* fix small names

* Added login menu

* Final fix.

* ох

* Убрал логгеры

* fix Comments and Access to proto

* moved dummy code, removed qustyions

* added disposer() when window was close

* Small fixes

* Removed comments. Added DNA check for CriminalityHud

* Small lol

---------

Co-authored-by: DocNITE <docnite0530@gmail.com>
This commit is contained in:
RavMorgan
2023-06-15 13:17:04 +03:00
committed by Aviu00
parent 13c0d15601
commit 5f51cb81de
41 changed files with 1922 additions and 28 deletions

View File

@@ -1,10 +1,13 @@
using Content.Client.White.EntityCrimeRecords;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Content.Shared.Inventory;
using Content.Shared.Mindshield.Components;
using Content.Shared.Overlays;
using Content.Shared.PDA;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Content.Shared.White.CriminalRecords;
using Robust.Shared.Prototypes;
namespace Content.Client.Overlays;
@@ -13,6 +16,11 @@ public sealed class ShowSecurityIconsSystem : EquipmentHudSystem<ShowSecurityIco
{
[Dependency] private readonly IPrototypeManager _prototypeMan = default!;
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
// WD EDIT START
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly ShowCrimeRecordsSystem _parentSystem = default!;
// WD EDIT END
[ValidatePrototypeId<StatusIconPrototype>]
private const string JobIconForNoId = "JobIconNoId";
@@ -74,8 +82,82 @@ public sealed class ShowSecurityIconsSystem : EquipmentHudSystem<ShowSecurityIco
result.Add(icon);
}
// Add arrest icons here, WYCI.
// WD EDIT START
if (!GetRecord(uid, out var type))
return result;
var protoId = type switch
{
EnumCriminalRecordType.Discharged => "CriminalRecordIconDischarged",
EnumCriminalRecordType.Incarcerated => "CriminalRecordIconIncarcerated",
EnumCriminalRecordType.Parolled => "CriminalRecordIconParolled",
EnumCriminalRecordType.Suspected => "CriminalRecordIconSuspected",
EnumCriminalRecordType.Wanted => "CriminalRecordIconWanted",
_ => "CriminalRecordIconReleased"
};
if (_prototypeMan.TryIndex<StatusIconPrototype>(protoId, out var recordIcon))
result.Add(recordIcon);
// WD EDIT END
return result;
}
// WD EDIT START
private bool GetRecord(EntityUid uid, out EnumCriminalRecordType type)
{
if (!_entManager.TryGetComponent(uid, out MetaDataComponent? meta))
{
type = EnumCriminalRecordType.Released;
return false;
}
var serverList = _entManager.EntityQuery<CriminalRecordsServerComponent>();
foreach (var server in serverList)
{
// if all good - check avaible records
foreach (var (key, info) in server.Cache)
{
// 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 false;
}
// WD EDIT END
}