Predict StorageComponent (#19682)

This commit is contained in:
metalgearsloth
2023-09-11 21:20:46 +10:00
committed by GitHub
parent 99b77bc2d3
commit d5bd1c6f86
68 changed files with 1124 additions and 1121 deletions

View File

@@ -1,12 +1,12 @@
using System.Linq;
using Content.Server.Construction.Components;
using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems;
using Content.Shared.DoAfter;
using Content.Shared.Construction.Components;
using Content.Shared.Exchanger;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.Storage;
using Robust.Shared.Containers;
using Robust.Shared.Utility;
using Content.Shared.Wires;
@@ -41,13 +41,13 @@ public sealed class PartExchangerSystem : EntitySystem
if (args.Handled || args.Args.Target == null)
return;
if (!TryComp<ServerStorageComponent>(uid, out var storage) || storage.Storage == null)
if (!TryComp<StorageComponent>(uid, out var storage) || storage.Container == null)
return; //the parts are stored in here
var machinePartQuery = GetEntityQuery<MachinePartComponent>();
var machineParts = new List<(EntityUid, MachinePartComponent)>();
foreach (var item in storage.Storage.ContainedEntities) //get parts in RPED
foreach (var item in storage.Container.ContainedEntities) //get parts in RPED
{
if (machinePartQuery.TryGetComponent(item, out var part))
machineParts.Add((item, part));
@@ -96,7 +96,7 @@ public sealed class PartExchangerSystem : EntitySystem
//put the unused parts back into rped. (this also does the "swapping")
foreach (var (unused, _) in machineParts)
{
_storage.Insert(storageUid, unused, null, false);
_storage.Insert(storageUid, unused, playSound: false);
}
_construction.RefreshParts(uid, machine);
}
@@ -146,7 +146,7 @@ public sealed class PartExchangerSystem : EntitySystem
//put the unused parts back into rped. (this also does the "swapping")
foreach (var (unused, _) in machineParts)
{
_storage.Insert(storageEnt, unused, null, false);
_storage.Insert(storageEnt, unused, playSound: false);
}
}