fix starting gear without PDAs (#24463)

* fix starting gear without PDAs

* legacy as shit
This commit is contained in:
Nemanja
2024-01-23 19:02:24 -05:00
committed by GitHub
parent a86659d731
commit 71cb62e9c6

View File

@@ -182,10 +182,13 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
if (!InventorySystem.TryGetSlotEntity(entity, "id", out var idUid))
return;
if (!EntityManager.TryGetComponent(idUid, out PdaComponent? pdaComponent) || !TryComp<IdCardComponent>(pdaComponent.ContainedId, out var card))
var cardId = idUid.Value;
if (TryComp<PdaComponent>(idUid, out var pdaComponent) && pdaComponent.ContainedId != null)
cardId = pdaComponent.ContainedId.Value;
if (!TryComp<IdCardComponent>(cardId, out var card))
return;
var cardId = pdaComponent.ContainedId.Value;
_cardSystem.TryChangeFullName(cardId, characterName, card);
_cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card);
@@ -203,7 +206,8 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
_accessSystem.SetAccessToJob(cardId, jobPrototype, extendedAccess);
_pdaSystem.SetOwner(idUid.Value, pdaComponent, characterName);
if (pdaComponent != null)
_pdaSystem.SetOwner(idUid.Value, pdaComponent, characterName);
}