Fix startingGear storage (#33394)
* fix starting gear storage * removal of unused --------- Co-authored-by: MetalSage <metalsage.official@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Preferences.Loadouts;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Storage;
|
||||
@@ -145,27 +146,23 @@ public abstract class SharedStationSpawningSystem : EntitySystem
|
||||
if (startingGear.Storage.Count > 0)
|
||||
{
|
||||
var coords = _xformSystem.GetMapCoordinates(entity);
|
||||
var ents = new ValueList<EntityUid>();
|
||||
_inventoryQuery.TryComp(entity, out var inventoryComp);
|
||||
|
||||
foreach (var (slot, entProtos) in startingGear.Storage)
|
||||
foreach (var (slotName, entProtos) in startingGear.Storage)
|
||||
{
|
||||
ents.Clear();
|
||||
if (entProtos.Count == 0)
|
||||
if (entProtos == null || entProtos.Count == 0)
|
||||
continue;
|
||||
|
||||
if (inventoryComp != null &&
|
||||
InventorySystem.TryGetSlotEntity(entity, slot, out var slotEnt, inventoryComponent: inventoryComp) &&
|
||||
InventorySystem.TryGetSlotEntity(entity, slotName, out var slotEnt, inventoryComponent: inventoryComp) &&
|
||||
_storageQuery.TryComp(slotEnt, out var storage))
|
||||
{
|
||||
foreach (var ent in entProtos)
|
||||
{
|
||||
ents.Add(Spawn(ent, coords));
|
||||
}
|
||||
|
||||
foreach (var ent in ents)
|
||||
foreach (var entProto in entProtos)
|
||||
{
|
||||
_storage.Insert(slotEnt.Value, ent, out _, storageComp: storage, playSound: false);
|
||||
var spawnedEntity = Spawn(entProto, coords);
|
||||
|
||||
_storage.Insert(slotEnt.Value, spawnedEntity, out _, storageComp: storage, playSound: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user