Skip to content

Commit

Permalink
fix starting gear without PDAs (space-wizards#24463)
Browse files Browse the repository at this point in the history
* fix starting gear without PDAs

* legacy as shit
  • Loading branch information
EmoGarbage404 authored Jan 24, 2024
1 parent a86659d commit 71cb62e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Content.Server/Station/Systems/StationSpawningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,13 @@ public void EquipIdCard(EntityUid entity, string characterName, JobPrototype job
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);

Expand All @@ -203,7 +206,8 @@ public void EquipIdCard(EntityUid entity, string characterName, JobPrototype job

_accessSystem.SetAccessToJob(cardId, jobPrototype, extendedAccess);

_pdaSystem.SetOwner(idUid.Value, pdaComponent, characterName);
if (pdaComponent != null)
_pdaSystem.SetOwner(idUid.Value, pdaComponent, characterName);
}


Expand Down

0 comments on commit 71cb62e

Please sign in to comment.