Dewarns access (#16666)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
TemporalOroboros
2023-07-22 21:19:51 -07:00
committed by GitHub
parent 415701fd74
commit df1dcb74ac
27 changed files with 438 additions and 407 deletions

View File

@@ -7,6 +7,7 @@ using Content.Server.Mind.Commands;
using Content.Server.PDA;
using Content.Server.Roles;
using Content.Server.Station.Components;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Content.Shared.CCVar;
using Content.Shared.Hands.Components;
@@ -44,6 +45,7 @@ public sealed class StationSpawningSystem : EntitySystem
[Dependency] private readonly PdaSystem _pdaSystem = default!;
[Dependency] private readonly SharedAccessSystem _accessSystem = default!;
[Dependency] private readonly IdentitySystem _identity = default!;
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
private bool _randomizeCharacters;
@@ -73,7 +75,7 @@ public sealed class StationSpawningSystem : EntitySystem
var ev = new PlayerSpawningEvent(job, profile, station);
RaiseLocalEvent(ev);
DebugTools.Assert(ev.SpawnResult is {Valid: true} or null);
DebugTools.Assert(ev.SpawnResult is { Valid: true } or null);
return ev.SpawnResult;
}
@@ -146,7 +148,7 @@ public sealed class StationSpawningSystem : EntitySystem
if (profile != null)
{
_humanoidSystem.LoadProfile(entity.Value, profile);
MetaData(entity.Value).EntityName = profile.Name;
_metaSystem.SetEntityName(entity.Value, profile.Name);
if (profile.FlavorText != "" && _configurationManager.GetCVar(CCVars.FlavorText))
{
AddComp<DetailExaminableComponent>(entity.Value).Content = profile.FlavorText;
@@ -158,7 +160,7 @@ public sealed class StationSpawningSystem : EntitySystem
return entity.Value;
}
private void DoJobSpecials(Job? job, EntityUid entity)
private static void DoJobSpecials(Job? job, EntityUid entity)
{
foreach (var jobSpecial in job?.Prototype.Special ?? Array.Empty<JobSpecial>())
{
@@ -211,11 +213,10 @@ public sealed class StationSpawningSystem : EntitySystem
if (!_inventorySystem.TryGetSlotEntity(entity, "id", out var idUid))
return;
if (!EntityManager.TryGetComponent(idUid, out PdaComponent? pdaComponent) || pdaComponent.ContainedId == null)
if (!EntityManager.TryGetComponent(idUid, out PdaComponent? pdaComponent) || !TryComp<IdCardComponent>(pdaComponent.ContainedId, out var card))
return;
var card = pdaComponent.ContainedId;
var cardId = card.Owner;
var cardId = pdaComponent.ContainedId.Value;
_cardSystem.TryChangeFullName(cardId, characterName, card);
_cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card);