From e71e5bec39f60e5ca97b39f9015c778a98081fb7 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Sun, 26 Sep 2021 15:38:07 +0200 Subject: [PATCH] StackSystem uses PopupSystem. Stacks are at the vanguard, as always. --- Content.Server/Stack/StackSystem.cs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Content.Server/Stack/StackSystem.cs b/Content.Server/Stack/StackSystem.cs index b5b655b834..930cfa75ef 100644 --- a/Content.Server/Stack/StackSystem.cs +++ b/Content.Server/Stack/StackSystem.cs @@ -1,12 +1,13 @@ using System; +using Content.Server.Popups; using Content.Shared.Interaction; -using Content.Shared.Popups; using Content.Shared.Stacks; using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Map; +using Robust.Shared.Maths; using Robust.Shared.Prototypes; namespace Content.Server.Stack @@ -19,6 +20,7 @@ namespace Content.Server.Stack public class StackSystem : SharedStackSystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly PopupSystem _popupSystem = default!; public override void Initialize() { @@ -86,34 +88,29 @@ namespace Content.Server.Stack SetCount(args.Used.Uid, otherStack.Count + toTransfer, otherStack); var popupPos = args.ClickLocation; + if (!popupPos.IsValid(EntityManager)) { popupPos = args.User.Transform.Coordinates; } + var filter = _popupSystem.GetFilterFromEntity(args.User); + switch (toTransfer) { case > 0: - popupPos.PopupMessage(args.User, $"+{toTransfer}"); + _popupSystem.PopupCoordinates($"+{toTransfer}", popupPos, filter); if (otherStack.AvailableSpace == 0) { - args.Used.SpawnTimer( - 300, - () => popupPos.PopupMessage( - args.User, - Loc.GetString("comp-stack-becomes-full") - ) - ); + _popupSystem.PopupCoordinates(Loc.GetString("comp-stack-becomes-full"), + popupPos.Offset(new Vector2(0, -0.5f)) , filter); } break; case 0 when otherStack.AvailableSpace == 0: - popupPos.PopupMessage( - args.User, - Loc.GetString("comp-stack-already-full") - ); + _popupSystem.PopupCoordinates(Loc.GetString("comp-stack-already-full"), popupPos, filter); break; }