Remove id card console component reference (#15205)
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
using Content.Shared.Access.Components;
|
|
||||||
|
|
||||||
namespace Content.Client.Access.Components;
|
|
||||||
|
|
||||||
[RegisterComponent]
|
|
||||||
[ComponentReference(typeof(SharedIdCardConsoleComponent))]
|
|
||||||
public sealed class IdCardConsoleComponent : SharedIdCardConsoleComponent {}
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using Content.Client.Access.Components;
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
using Content.Shared.CrewManifest;
|
using Content.Shared.CrewManifest;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.Shared.Access.Components.SharedIdCardConsoleComponent;
|
using static Content.Shared.Access.Components.IdCardConsoleComponent;
|
||||||
namespace Content.Client.Access.UI
|
namespace Content.Client.Access.UI
|
||||||
{
|
{
|
||||||
public sealed class IdCardConsoleBoundUserInterface : BoundUserInterface
|
public sealed class IdCardConsoleBoundUserInterface : BoundUserInterface
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Access;
|
using Content.Shared.Access;
|
||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
@@ -7,10 +6,8 @@ using Robust.Client.AutoGenerated;
|
|||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.Shared.Access.Components.SharedIdCardConsoleComponent;
|
using static Content.Shared.Access.Components.IdCardConsoleComponent;
|
||||||
|
|
||||||
namespace Content.Client.Access.UI
|
namespace Content.Client.Access.UI
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
using Content.Server.Access.Systems;
|
|
||||||
using Content.Shared.Access.Components;
|
|
||||||
|
|
||||||
namespace Content.Server.Access.Components;
|
|
||||||
|
|
||||||
[RegisterComponent]
|
|
||||||
[ComponentReference(typeof(SharedIdCardConsoleComponent))]
|
|
||||||
[Access(typeof(IdCardConsoleSystem))]
|
|
||||||
public sealed class IdCardConsoleComponent : SharedIdCardConsoleComponent
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.Shared.Access.Components.SharedIdCardConsoleComponent;
|
using static Content.Shared.Access.Components.IdCardConsoleComponent;
|
||||||
|
|
||||||
namespace Content.Server.Access.Systems;
|
namespace Content.Server.Access.Systems;
|
||||||
|
|
||||||
@@ -31,15 +31,15 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<SharedIdCardConsoleComponent, WriteToTargetIdMessage>(OnWriteToTargetIdMessage);
|
SubscribeLocalEvent<IdCardConsoleComponent, WriteToTargetIdMessage>(OnWriteToTargetIdMessage);
|
||||||
|
|
||||||
// one day, maybe bound user interfaces can be shared too.
|
// one day, maybe bound user interfaces can be shared too.
|
||||||
SubscribeLocalEvent<SharedIdCardConsoleComponent, ComponentStartup>(UpdateUserInterface);
|
SubscribeLocalEvent<IdCardConsoleComponent, ComponentStartup>(UpdateUserInterface);
|
||||||
SubscribeLocalEvent<SharedIdCardConsoleComponent, EntInsertedIntoContainerMessage>(UpdateUserInterface);
|
SubscribeLocalEvent<IdCardConsoleComponent, EntInsertedIntoContainerMessage>(UpdateUserInterface);
|
||||||
SubscribeLocalEvent<SharedIdCardConsoleComponent, EntRemovedFromContainerMessage>(UpdateUserInterface);
|
SubscribeLocalEvent<IdCardConsoleComponent, EntRemovedFromContainerMessage>(UpdateUserInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnWriteToTargetIdMessage(EntityUid uid, SharedIdCardConsoleComponent component, WriteToTargetIdMessage args)
|
private void OnWriteToTargetIdMessage(EntityUid uid, IdCardConsoleComponent component, WriteToTargetIdMessage args)
|
||||||
{
|
{
|
||||||
if (args.Session.AttachedEntity is not { Valid: true } player)
|
if (args.Session.AttachedEntity is not { Valid: true } player)
|
||||||
return;
|
return;
|
||||||
@@ -49,7 +49,7 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
|
|||||||
UpdateUserInterface(uid, component, args);
|
UpdateUserInterface(uid, component, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateUserInterface(EntityUid uid, SharedIdCardConsoleComponent component, EntityEventArgs args)
|
private void UpdateUserInterface(EntityUid uid, IdCardConsoleComponent component, EntityEventArgs args)
|
||||||
{
|
{
|
||||||
if (!component.Initialized)
|
if (!component.Initialized)
|
||||||
return;
|
return;
|
||||||
@@ -109,7 +109,7 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called whenever an access button is pressed, adding or removing that access from the target ID card.
|
/// Called whenever an access button is pressed, adding or removing that access from the target ID card.
|
||||||
/// Writes data passed from the UI into the ID stored in <see cref="SharedIdCardConsoleComponent.TargetIdSlot"/>, if present.
|
/// Writes data passed from the UI into the ID stored in <see cref="IdCardConsoleComponent.TargetIdSlot"/>, if present.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void TryWriteToTargetId(EntityUid uid,
|
private void TryWriteToTargetId(EntityUid uid,
|
||||||
string newFullName,
|
string newFullName,
|
||||||
@@ -117,7 +117,7 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
|
|||||||
List<string> newAccessList,
|
List<string> newAccessList,
|
||||||
string newJobProto,
|
string newJobProto,
|
||||||
EntityUid player,
|
EntityUid player,
|
||||||
SharedIdCardConsoleComponent? component = null)
|
IdCardConsoleComponent? component = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
return;
|
return;
|
||||||
@@ -153,9 +153,9 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if there is an ID in <see cref="SharedIdCardConsoleComponent.PrivilegedIdSlot"/> and said ID satisfies the requirements of <see cref="AccessReaderComponent"/>.
|
/// Returns true if there is an ID in <see cref="IdCardConsoleComponent.PrivilegedIdSlot"/> and said ID satisfies the requirements of <see cref="AccessReaderComponent"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool PrivilegedIdIsAuthorized(EntityUid uid, SharedIdCardConsoleComponent? component = null)
|
private bool PrivilegedIdIsAuthorized(EntityUid uid, IdCardConsoleComponent? component = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ namespace Content.Server.Access.Systems
|
|||||||
{
|
{
|
||||||
jobTitle = jobTitle.Trim();
|
jobTitle = jobTitle.Trim();
|
||||||
|
|
||||||
if (jobTitle.Length > SharedIdCardConsoleComponent.MaxJobTitleLength)
|
if (jobTitle.Length > IdCardConsoleComponent.MaxJobTitleLength)
|
||||||
jobTitle = jobTitle[..SharedIdCardConsoleComponent.MaxJobTitleLength];
|
jobTitle = jobTitle[..IdCardConsoleComponent.MaxJobTitleLength];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -132,8 +132,8 @@ namespace Content.Server.Access.Systems
|
|||||||
if (!string.IsNullOrWhiteSpace(fullName))
|
if (!string.IsNullOrWhiteSpace(fullName))
|
||||||
{
|
{
|
||||||
fullName = fullName.Trim();
|
fullName = fullName.Trim();
|
||||||
if (fullName.Length > SharedIdCardConsoleComponent.MaxFullNameLength)
|
if (fullName.Length > IdCardConsoleComponent.MaxFullNameLength)
|
||||||
fullName = fullName[..SharedIdCardConsoleComponent.MaxFullNameLength];
|
fullName = fullName[..IdCardConsoleComponent.MaxFullNameLength];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public sealed class RenameCommand : IConsoleCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
var name = args[1];
|
var name = args[1];
|
||||||
if (name.Length > SharedIdCardConsoleComponent.MaxFullNameLength)
|
if (name.Length > IdCardConsoleComponent.MaxFullNameLength)
|
||||||
{
|
{
|
||||||
shell.WriteLine("Name is too long.");
|
shell.WriteLine("Name is too long.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
117
Content.Shared/Access/Components/IdCardConsoleComponent.cs
Normal file
117
Content.Shared/Access/Components/IdCardConsoleComponent.cs
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
using Content.Shared.Access.Systems;
|
||||||
|
using Content.Shared.Containers.ItemSlots;
|
||||||
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||||
|
|
||||||
|
namespace Content.Shared.Access.Components;
|
||||||
|
|
||||||
|
[RegisterComponent, NetworkedComponent]
|
||||||
|
[Access(typeof(SharedIdCardConsoleSystem))]
|
||||||
|
public sealed class IdCardConsoleComponent : Component
|
||||||
|
{
|
||||||
|
public const int MaxFullNameLength = 30;
|
||||||
|
public const int MaxJobTitleLength = 30;
|
||||||
|
|
||||||
|
public static string PrivilegedIdCardSlotId = "IdCardConsole-privilegedId";
|
||||||
|
public static string TargetIdCardSlotId = "IdCardConsole-targetId";
|
||||||
|
|
||||||
|
[DataField("privilegedIdSlot")]
|
||||||
|
public ItemSlot PrivilegedIdSlot = new();
|
||||||
|
|
||||||
|
[DataField("targetIdSlot")]
|
||||||
|
public ItemSlot TargetIdSlot = new();
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public sealed class WriteToTargetIdMessage : BoundUserInterfaceMessage
|
||||||
|
{
|
||||||
|
public readonly string FullName;
|
||||||
|
public readonly string JobTitle;
|
||||||
|
public readonly List<string> AccessList;
|
||||||
|
public readonly string JobPrototype;
|
||||||
|
|
||||||
|
public WriteToTargetIdMessage(string fullName, string jobTitle, List<string> accessList, string jobPrototype)
|
||||||
|
{
|
||||||
|
FullName = fullName;
|
||||||
|
JobTitle = jobTitle;
|
||||||
|
AccessList = accessList;
|
||||||
|
JobPrototype = jobPrototype;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put this on shared so we just send the state once in PVS range rather than every time the UI updates.
|
||||||
|
|
||||||
|
[DataField("accessLevels", customTypeSerializer: typeof(PrototypeIdListSerializer<AccessLevelPrototype>))]
|
||||||
|
public List<string> AccessLevels = new()
|
||||||
|
{
|
||||||
|
"Armory",
|
||||||
|
"Atmospherics",
|
||||||
|
"Bar",
|
||||||
|
"Brig",
|
||||||
|
"Detective",
|
||||||
|
"Captain",
|
||||||
|
"Cargo",
|
||||||
|
"Chapel",
|
||||||
|
"Chemistry",
|
||||||
|
"ChiefEngineer",
|
||||||
|
"ChiefMedicalOfficer",
|
||||||
|
"Command",
|
||||||
|
"Engineering",
|
||||||
|
"External",
|
||||||
|
"HeadOfPersonnel",
|
||||||
|
"HeadOfSecurity",
|
||||||
|
"Hydroponics",
|
||||||
|
"Janitor",
|
||||||
|
"Kitchen",
|
||||||
|
"Maintenance",
|
||||||
|
"Medical",
|
||||||
|
"Quartermaster",
|
||||||
|
"Research",
|
||||||
|
"ResearchDirector",
|
||||||
|
"Salvage",
|
||||||
|
"Security",
|
||||||
|
"Service",
|
||||||
|
"Theatre",
|
||||||
|
};
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public sealed class IdCardConsoleBoundUserInterfaceState : BoundUserInterfaceState
|
||||||
|
{
|
||||||
|
public readonly string PrivilegedIdName;
|
||||||
|
public readonly bool IsPrivilegedIdPresent;
|
||||||
|
public readonly bool IsPrivilegedIdAuthorized;
|
||||||
|
public readonly bool IsTargetIdPresent;
|
||||||
|
public readonly string TargetIdName;
|
||||||
|
public readonly string? TargetIdFullName;
|
||||||
|
public readonly string? TargetIdJobTitle;
|
||||||
|
public readonly string[]? TargetIdAccessList;
|
||||||
|
public readonly string TargetIdJobPrototype;
|
||||||
|
|
||||||
|
public IdCardConsoleBoundUserInterfaceState(bool isPrivilegedIdPresent,
|
||||||
|
bool isPrivilegedIdAuthorized,
|
||||||
|
bool isTargetIdPresent,
|
||||||
|
string? targetIdFullName,
|
||||||
|
string? targetIdJobTitle,
|
||||||
|
string[]? targetIdAccessList,
|
||||||
|
string targetIdJobPrototype,
|
||||||
|
string privilegedIdName,
|
||||||
|
string targetIdName)
|
||||||
|
{
|
||||||
|
IsPrivilegedIdPresent = isPrivilegedIdPresent;
|
||||||
|
IsPrivilegedIdAuthorized = isPrivilegedIdAuthorized;
|
||||||
|
IsTargetIdPresent = isTargetIdPresent;
|
||||||
|
TargetIdFullName = targetIdFullName;
|
||||||
|
TargetIdJobTitle = targetIdJobTitle;
|
||||||
|
TargetIdAccessList = targetIdAccessList;
|
||||||
|
TargetIdJobPrototype = targetIdJobPrototype;
|
||||||
|
PrivilegedIdName = privilegedIdName;
|
||||||
|
TargetIdName = targetIdName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum IdCardConsoleUiKey : byte
|
||||||
|
{
|
||||||
|
Key,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
using Content.Shared.Containers.ItemSlots;
|
|
||||||
using Robust.Shared.GameStates;
|
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
|
||||||
|
|
||||||
namespace Content.Shared.Access.Components
|
|
||||||
{
|
|
||||||
[NetworkedComponent]
|
|
||||||
public abstract class SharedIdCardConsoleComponent : Component
|
|
||||||
{
|
|
||||||
public const int MaxFullNameLength = 30;
|
|
||||||
public const int MaxJobTitleLength = 30;
|
|
||||||
|
|
||||||
public static string PrivilegedIdCardSlotId = "IdCardConsole-privilegedId";
|
|
||||||
public static string TargetIdCardSlotId = "IdCardConsole-targetId";
|
|
||||||
|
|
||||||
[DataField("privilegedIdSlot")]
|
|
||||||
public ItemSlot PrivilegedIdSlot = new();
|
|
||||||
|
|
||||||
[DataField("targetIdSlot")]
|
|
||||||
public ItemSlot TargetIdSlot = new();
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public sealed class WriteToTargetIdMessage : BoundUserInterfaceMessage
|
|
||||||
{
|
|
||||||
public readonly string FullName;
|
|
||||||
public readonly string JobTitle;
|
|
||||||
public readonly List<string> AccessList;
|
|
||||||
public readonly string JobPrototype;
|
|
||||||
|
|
||||||
public WriteToTargetIdMessage(string fullName, string jobTitle, List<string> accessList, string jobPrototype)
|
|
||||||
{
|
|
||||||
FullName = fullName;
|
|
||||||
JobTitle = jobTitle;
|
|
||||||
AccessList = accessList;
|
|
||||||
JobPrototype = jobPrototype;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put this on shared so we just send the state once in PVS range rather than every time the UI updates.
|
|
||||||
|
|
||||||
[DataField("accessLevels", customTypeSerializer: typeof(PrototypeIdListSerializer<AccessLevelPrototype>))]
|
|
||||||
public List<string> AccessLevels = new()
|
|
||||||
{
|
|
||||||
"Armory",
|
|
||||||
"Atmospherics",
|
|
||||||
"Bar",
|
|
||||||
"Brig",
|
|
||||||
"Detective",
|
|
||||||
"Captain",
|
|
||||||
"Cargo",
|
|
||||||
"Chapel",
|
|
||||||
"Chemistry",
|
|
||||||
"ChiefEngineer",
|
|
||||||
"ChiefMedicalOfficer",
|
|
||||||
"Command",
|
|
||||||
"Engineering",
|
|
||||||
"External",
|
|
||||||
"HeadOfPersonnel",
|
|
||||||
"HeadOfSecurity",
|
|
||||||
"Hydroponics",
|
|
||||||
"Janitor",
|
|
||||||
"Kitchen",
|
|
||||||
"Maintenance",
|
|
||||||
"Medical",
|
|
||||||
"Quartermaster",
|
|
||||||
"Research",
|
|
||||||
"ResearchDirector",
|
|
||||||
"Salvage",
|
|
||||||
"Security",
|
|
||||||
"Service",
|
|
||||||
"Theatre",
|
|
||||||
};
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public sealed class IdCardConsoleBoundUserInterfaceState : BoundUserInterfaceState
|
|
||||||
{
|
|
||||||
public readonly string PrivilegedIdName;
|
|
||||||
public readonly bool IsPrivilegedIdPresent;
|
|
||||||
public readonly bool IsPrivilegedIdAuthorized;
|
|
||||||
public readonly bool IsTargetIdPresent;
|
|
||||||
public readonly string TargetIdName;
|
|
||||||
public readonly string? TargetIdFullName;
|
|
||||||
public readonly string? TargetIdJobTitle;
|
|
||||||
public readonly string[]? TargetIdAccessList;
|
|
||||||
public readonly string TargetIdJobPrototype;
|
|
||||||
|
|
||||||
public IdCardConsoleBoundUserInterfaceState(bool isPrivilegedIdPresent,
|
|
||||||
bool isPrivilegedIdAuthorized,
|
|
||||||
bool isTargetIdPresent,
|
|
||||||
string? targetIdFullName,
|
|
||||||
string? targetIdJobTitle,
|
|
||||||
string[]? targetIdAccessList,
|
|
||||||
string targetIdJobPrototype,
|
|
||||||
string privilegedIdName,
|
|
||||||
string targetIdName)
|
|
||||||
{
|
|
||||||
IsPrivilegedIdPresent = isPrivilegedIdPresent;
|
|
||||||
IsPrivilegedIdAuthorized = isPrivilegedIdAuthorized;
|
|
||||||
IsTargetIdPresent = isTargetIdPresent;
|
|
||||||
TargetIdFullName = targetIdFullName;
|
|
||||||
TargetIdJobTitle = targetIdJobTitle;
|
|
||||||
TargetIdAccessList = targetIdAccessList;
|
|
||||||
TargetIdJobPrototype = targetIdJobPrototype;
|
|
||||||
PrivilegedIdName = privilegedIdName;
|
|
||||||
TargetIdName = targetIdName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public enum IdCardConsoleUiKey : byte
|
|
||||||
{
|
|
||||||
Key,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,30 +17,30 @@ namespace Content.Shared.Access.Systems
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<SharedIdCardConsoleComponent, ComponentInit>(OnComponentInit);
|
SubscribeLocalEvent<IdCardConsoleComponent, ComponentInit>(OnComponentInit);
|
||||||
SubscribeLocalEvent<SharedIdCardConsoleComponent, ComponentRemove>(OnComponentRemove);
|
SubscribeLocalEvent<IdCardConsoleComponent, ComponentRemove>(OnComponentRemove);
|
||||||
SubscribeLocalEvent<SharedIdCardConsoleComponent, ComponentGetState>(OnGetState);
|
SubscribeLocalEvent<IdCardConsoleComponent, ComponentGetState>(OnGetState);
|
||||||
SubscribeLocalEvent<SharedIdCardConsoleComponent, ComponentHandleState>(OnHandleState);
|
SubscribeLocalEvent<IdCardConsoleComponent, ComponentHandleState>(OnHandleState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnHandleState(EntityUid uid, SharedIdCardConsoleComponent component, ref ComponentHandleState args)
|
private void OnHandleState(EntityUid uid, IdCardConsoleComponent component, ref ComponentHandleState args)
|
||||||
{
|
{
|
||||||
if (args.Current is not IdCardConsoleComponentState state) return;
|
if (args.Current is not IdCardConsoleComponentState state) return;
|
||||||
component.AccessLevels = state.AccessLevels;
|
component.AccessLevels = state.AccessLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGetState(EntityUid uid, SharedIdCardConsoleComponent component, ref ComponentGetState args)
|
private void OnGetState(EntityUid uid, IdCardConsoleComponent component, ref ComponentGetState args)
|
||||||
{
|
{
|
||||||
args.State = new IdCardConsoleComponentState(component.AccessLevels);
|
args.State = new IdCardConsoleComponentState(component.AccessLevels);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnComponentInit(EntityUid uid, SharedIdCardConsoleComponent component, ComponentInit args)
|
private void OnComponentInit(EntityUid uid, IdCardConsoleComponent component, ComponentInit args)
|
||||||
{
|
{
|
||||||
_itemSlotsSystem.AddItemSlot(uid, SharedIdCardConsoleComponent.PrivilegedIdCardSlotId, component.PrivilegedIdSlot);
|
_itemSlotsSystem.AddItemSlot(uid, IdCardConsoleComponent.PrivilegedIdCardSlotId, component.PrivilegedIdSlot);
|
||||||
_itemSlotsSystem.AddItemSlot(uid, SharedIdCardConsoleComponent.TargetIdCardSlotId, component.TargetIdSlot);
|
_itemSlotsSystem.AddItemSlot(uid, IdCardConsoleComponent.TargetIdCardSlotId, component.TargetIdSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnComponentRemove(EntityUid uid, SharedIdCardConsoleComponent component, ComponentRemove args)
|
private void OnComponentRemove(EntityUid uid, IdCardConsoleComponent component, ComponentRemove args)
|
||||||
{
|
{
|
||||||
_itemSlotsSystem.RemoveItemSlot(uid, component.PrivilegedIdSlot);
|
_itemSlotsSystem.RemoveItemSlot(uid, component.PrivilegedIdSlot);
|
||||||
_itemSlotsSystem.RemoveItemSlot(uid, component.TargetIdSlot);
|
_itemSlotsSystem.RemoveItemSlot(uid, component.TargetIdSlot);
|
||||||
|
|||||||
Reference in New Issue
Block a user