Много чего
This commit is contained in:
14
Content.Server/_White/AddImplant/AddImplantComponent.cs
Normal file
14
Content.Server/_White/AddImplant/AddImplantComponent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
|
||||
|
||||
namespace Content.Server._White.AddImplant;
|
||||
|
||||
/// <summary>
|
||||
/// WD.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class AddImplantComponent : Component
|
||||
{
|
||||
[DataField("implants", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<EntityPrototype>))]
|
||||
public HashSet<String> Implants { get; private set; } = new();
|
||||
}
|
||||
21
Content.Server/_White/AddImplant/AddImplantSystem.cs
Normal file
21
Content.Server/_White/AddImplant/AddImplantSystem.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Implants;
|
||||
|
||||
namespace Content.Server._White.AddImplant;
|
||||
|
||||
public sealed class AddImplantSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedSubdermalImplantSystem _implantSystem = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<AddImplantComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
public void OnMapInit(Entity<AddImplantComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
_implantSystem.AddImplants(ent.Owner, ent.Comp.Implants);
|
||||
RemComp<AddImplantComponent>(ent.Owner);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Content.Server._White.ContractorIDCard;
|
||||
|
||||
/// <summary>
|
||||
/// WD.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class ContractorIDCardComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public string Details = string.Empty;
|
||||
}
|
||||
24
Content.Server/_White/FillIDCard/ContractorIDCardSystem.cs
Normal file
24
Content.Server/_White/FillIDCard/ContractorIDCardSystem.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
using Content.Shared.Examine;
|
||||
|
||||
namespace Content.Server._White.ContractorIDCard;
|
||||
|
||||
public sealed class ContractorIDCardSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ContractorIDCardComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
public void OnExamined(Entity<ContractorIDCardComponent> ent, ref ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange)
|
||||
return;
|
||||
|
||||
if (ent.Comp.Details == string.Empty)
|
||||
return;
|
||||
|
||||
args.PushMarkup(ent.Comp.Details);
|
||||
}
|
||||
}
|
||||
11
Content.Server/_White/FillIDCard/FillIDCardComponent.cs
Normal file
11
Content.Server/_White/FillIDCard/FillIDCardComponent.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Content.Server._White.FillIDCard;
|
||||
|
||||
/// <summary>
|
||||
/// WD.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class FillIDCardComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public bool IsContractor = false;
|
||||
}
|
||||
72
Content.Server/_White/FillIDCard/FillIDCardSystem.cs
Normal file
72
Content.Server/_White/FillIDCard/FillIDCardSystem.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
using Content.Server._White.ContractorIDCard;
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.Forensics;
|
||||
using Content.Server.PDA;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.PDA;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server._White.FillIDCard;
|
||||
|
||||
public sealed class FillIDCardSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
[Dependency] private readonly PdaSystem _pdaSystem = default!;
|
||||
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly IdCardSystem _idCardSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FillIDCardComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
|
||||
private void OnMapInit(Entity<FillIDCardComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
Timer.Spawn(15000, () => ItDoBeDoing(ent)); // 15 seconds and yes this is bad // TODO Make it less dogshit
|
||||
}
|
||||
|
||||
private void ItDoBeDoing(Entity<FillIDCardComponent> ent)
|
||||
{
|
||||
if (!TryComp<MetaDataComponent>(ent.Owner, out var targetMeta))
|
||||
{
|
||||
RemComp<FillIDCardComponent>(ent.Owner);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_inventorySystem.TryGetSlotEntity(ent.Owner, "id", out var idcardSlot))
|
||||
{
|
||||
RemComp<FillIDCardComponent>(ent.Owner);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryComp<PdaComponent>(idcardSlot, out var pda))
|
||||
{
|
||||
_pdaSystem.SetOwnerName((EntityUid) idcardSlot, pda, targetMeta.EntityName);
|
||||
|
||||
_containerSystem.TryGetContainer((EntityUid) idcardSlot, "PDA-id", out var container);
|
||||
|
||||
if (container != null)
|
||||
{
|
||||
var idCardInPda = container.ContainedEntities[0];
|
||||
_idCardSystem.TryChangeFullName(idCardInPda, targetMeta.EntityName);
|
||||
}
|
||||
}
|
||||
else if (HasComp<IdCardComponent>(idcardSlot))
|
||||
{
|
||||
_idCardSystem.TryChangeFullName((EntityUid) idcardSlot, targetMeta.EntityName);
|
||||
if (ent.Comp.IsContractor)
|
||||
{
|
||||
EnsureComp<ContractorIDCardComponent>((EntityUid) idcardSlot, out var comp);
|
||||
if (TryComp<FingerprintComponent>(ent.Owner, out var fingerprintComponent) && TryComp<DnaComponent>(ent.Owner, out var dnaComponent))
|
||||
comp.Details = $"На карте имеется следующая информация:\nВладелец карты: {targetMeta.EntityName}\nОтпечаток пальцев владельца: {fingerprintComponent.Fingerprint}\nДНК владельца: {dnaComponent.DNA}";
|
||||
}
|
||||
}
|
||||
|
||||
RemComp<FillIDCardComponent>(ent.Owner);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user