Files
tbd-station-14/Content.Shared/Access/Components/IdCardComponent.cs
John 796f599172 Job contraband rework (#33385)
* contraband system rework to allow restriction by job, not just department

* Fixing detective trenchcoat inheritance

* removing unnecessary using declarations

* trying to fix testing error by re-adding diagnostics using declaration

* removing unecessary dependency, making allowedJobs nullable

* Adding all of slarti's requested changes except for the hacky job icon method fix

* removing accidental whitespace

* choosing to use the non-localized version because we're comparing the string against the AllowedJobs field, and the contraband classes that fill that field are written in english

* removing unneeded using dec, fixing nesting logic problem

* didn't remove the old nesting, doing that now

* using localized job title and localizing the allowed jobs string, removing usages of JobTitle field. Also networked the _jobTitle field instead.

* rewrite some stuff

* fixes

* fix energy pen

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2025-01-21 10:51:27 +01:00

61 lines
1.9 KiB
C#

using Content.Shared.Access.Systems;
using Content.Shared.PDA;
using Content.Shared.Roles;
using Content.Shared.StatusIcon;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Access.Components;
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState]
[Access(typeof(SharedIdCardSystem), typeof(SharedPdaSystem), typeof(SharedAgentIdCardSystem), Other = AccessPermissions.ReadWrite)]
public sealed partial class IdCardComponent : Component
{
[DataField]
[AutoNetworkedField]
// FIXME Friends
public string? FullName;
[DataField]
[AutoNetworkedField]
[Access(typeof(SharedIdCardSystem), typeof(SharedPdaSystem), typeof(SharedAgentIdCardSystem), Other = AccessPermissions.ReadWrite)]
public LocId? JobTitle;
[DataField]
[AutoNetworkedField]
private string? _jobTitle;
[Access(typeof(SharedIdCardSystem), typeof(SharedPdaSystem), typeof(SharedAgentIdCardSystem), Other = AccessPermissions.ReadWriteExecute)]
public string? LocalizedJobTitle { set => _jobTitle = value; get => _jobTitle ?? Loc.GetString(JobTitle ?? string.Empty); }
/// <summary>
/// The state of the job icon rsi.
/// </summary>
[DataField]
[AutoNetworkedField]
public ProtoId<JobIconPrototype> JobIcon = "JobIconUnknown";
/// <summary>
/// The proto IDs of the departments associated with the job
/// </summary>
[DataField]
[AutoNetworkedField]
public List<ProtoId<DepartmentPrototype>> JobDepartments = new();
/// <summary>
/// Determines if accesses from this card should be logged by <see cref="AccessReaderComponent"/>
/// </summary>
[DataField]
public bool BypassLogging;
[DataField]
public LocId NameLocId = "access-id-card-component-owner-name-job-title-text";
[DataField]
public LocId FullNameLocId = "access-id-card-component-owner-full-name-job-title-text";
[DataField]
public bool CanMicrowave = true;
}