From 0b2d3e59b0870b6ab28832c6f2ca96a24e342619 Mon Sep 17 00:00:00 2001 From: FaDeOkno <143940725+FaDeOkno@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:38:32 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D1=81=D0=BF=D0=B0?= =?UTF-8?q?=D0=B2=D0=BD=D0=B0=20=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=B9=20?= =?UTF-8?q?=D1=88=D0=B8=D1=84=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=83=20=D0=9A=D0=9F=D0=91=20(#238)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Описание PR Исправил спавн КПБ без ключей шифрования **Медиа** **Проверки** - [ ] PR полностью завершён и мне не нужна помощь чтобы его закончить. - [ ] Я внимательно просмотрел все свои изменения и багов в них не нашёл. - [ ] Я запускал локальный сервер со своими изменениями и всё протестировал. - [ ] Я добавил скриншот/видео демонстрации PR в игре, **или** этот PR этого не требует. **Изменения** :cl: Котя - fix: Исправлен спавн КПБ без ключей шифрования --- .../Station/SharedStationSpawningSystem.cs | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Station/SharedStationSpawningSystem.cs b/Content.Shared/Station/SharedStationSpawningSystem.cs index ca53998115..d4068a4924 100644 --- a/Content.Shared/Station/SharedStationSpawningSystem.cs +++ b/Content.Shared/Station/SharedStationSpawningSystem.cs @@ -8,6 +8,9 @@ using Content.Shared.Storage.EntitySystems; using Robust.Shared.Collections; using Robust.Shared.Prototypes; +using Content.Shared.Radio.Components; // Parkstation-IPC +using Content.Shared.Containers; // Parkstation-IPC +using Robust.Shared.Containers; // Parkstation-IPC namespace Content.Shared.Station; @@ -18,6 +21,7 @@ public abstract class SharedStationSpawningSystem : EntitySystem [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedStorageSystem _storage = default!; [Dependency] private readonly SharedTransformSystem _xformSystem = default!; + [Dependency] private readonly SharedContainerSystem _container = default!; private EntityQuery _handsQuery; private EntityQuery _inventoryQuery; @@ -111,6 +115,34 @@ public void EquipStartingGear(EntityUid entity, StartingGearPrototype? startingG } } + // Parkstation-Ipc-Start + // Pretty much copied from StationSpawningSystem.SpawnStartingGear + if (TryComp(entity, out var keyHolderComp)) + { + var earEquipString = startingGear.GetGear("ears"); + + if (!string.IsNullOrEmpty(earEquipString)) + { + var earEntity = Spawn(earEquipString, Transform(entity).Coordinates); + + if (TryComp(earEntity, out _) && // I had initially wanted this to spawn the headset, and simply move all the keys over, but the headset didn't seem to have any keys in it when spawned... + TryComp(earEntity, out var fillComp) && + fillComp.Containers.TryGetValue(EncryptionKeyHolderComponent.KeyContainerName, out var defaultKeys)) + { + _container.CleanContainer(keyHolderComp.KeyContainer); + + foreach (var key in defaultKeys) + { + var keyEntity = Spawn(key, Transform(entity).Coordinates); + _container.Insert(keyEntity, keyHolderComp.KeyContainer); + } + } + + QueueDel(earEntity); + } + } + // Parkstation-Ipc-End + if (startingGear.Storage.Count > 0) { var coords = _xformSystem.GetMapCoordinates(entity); @@ -145,4 +177,4 @@ public void EquipStartingGear(EntityUid entity, StartingGearPrototype? startingG RaiseLocalEvent(entity, ref ev); } } -} \ No newline at end of file +}