From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Wed, 24 Jan 2024 00:02:24 +0000 (-0500) Subject: fix starting gear without PDAs (#24463) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=71cb62e9c66bf05cd7cee7d9bbf5a93f2992e286;p=space-station-14.git fix starting gear without PDAs (#24463) * fix starting gear without PDAs * legacy as shit --- diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs index 9beccd06df..7e19b5f362 100644 --- a/Content.Server/Station/Systems/StationSpawningSystem.cs +++ b/Content.Server/Station/Systems/StationSpawningSystem.cs @@ -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(pdaComponent.ContainedId, out var card)) + var cardId = idUid.Value; + if (TryComp(idUid, out var pdaComponent) && pdaComponent.ContainedId != null) + cardId = pdaComponent.ContainedId.Value; + + if (!TryComp(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); }