Stack and storage enhancements (#16405)

This commit is contained in:
metalgearsloth
2023-05-15 12:24:45 +10:00
committed by GitHub
parent b20cc6f4d3
commit a9c0007c77
6 changed files with 127 additions and 23 deletions

View File

@@ -1,7 +1,10 @@
using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems;
using Content.Shared.Popups;
using Content.Shared.Stacks;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Server.Containers;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
@@ -14,6 +17,8 @@ namespace Content.Server.Stack
[UsedImplicitly]
public sealed class StackSystem : SharedStackSystem
{
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly StorageSystem _storage = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public static readonly int[] DefaultSplitAmounts = { 1, 5, 10, 20, 30, 50 };
@@ -160,6 +165,12 @@ namespace Content.Server.Stack
if (Split(uid, amount, userTransform.Coordinates, stack) is not {} split)
return;
if (_container.TryGetContainingContainer(uid, out var container) &&
TryComp<ServerStorageComponent>(container.Owner, out var storage))
{
_storage.UpdateStorageUI(container.Owner, storage);
}
HandsSystem.PickupOrDrop(userUid, split);
PopupSystem.PopupCursor(Loc.GetString("comp-stack-split"), userUid);