StackSystem uses PopupSystem.
Stacks are at the vanguard, as always.
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Popups;
|
|
||||||
using Content.Shared.Stacks;
|
using Content.Shared.Stacks;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Stack
|
namespace Content.Server.Stack
|
||||||
@@ -19,6 +20,7 @@ namespace Content.Server.Stack
|
|||||||
public class StackSystem : SharedStackSystem
|
public class StackSystem : SharedStackSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -86,34 +88,29 @@ namespace Content.Server.Stack
|
|||||||
SetCount(args.Used.Uid, otherStack.Count + toTransfer, otherStack);
|
SetCount(args.Used.Uid, otherStack.Count + toTransfer, otherStack);
|
||||||
|
|
||||||
var popupPos = args.ClickLocation;
|
var popupPos = args.ClickLocation;
|
||||||
|
|
||||||
if (!popupPos.IsValid(EntityManager))
|
if (!popupPos.IsValid(EntityManager))
|
||||||
{
|
{
|
||||||
popupPos = args.User.Transform.Coordinates;
|
popupPos = args.User.Transform.Coordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var filter = _popupSystem.GetFilterFromEntity(args.User);
|
||||||
|
|
||||||
switch (toTransfer)
|
switch (toTransfer)
|
||||||
{
|
{
|
||||||
case > 0:
|
case > 0:
|
||||||
popupPos.PopupMessage(args.User, $"+{toTransfer}");
|
_popupSystem.PopupCoordinates($"+{toTransfer}", popupPos, filter);
|
||||||
|
|
||||||
if (otherStack.AvailableSpace == 0)
|
if (otherStack.AvailableSpace == 0)
|
||||||
{
|
{
|
||||||
args.Used.SpawnTimer(
|
_popupSystem.PopupCoordinates(Loc.GetString("comp-stack-becomes-full"),
|
||||||
300,
|
popupPos.Offset(new Vector2(0, -0.5f)) , filter);
|
||||||
() => popupPos.PopupMessage(
|
|
||||||
args.User,
|
|
||||||
Loc.GetString("comp-stack-becomes-full")
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0 when otherStack.AvailableSpace == 0:
|
case 0 when otherStack.AvailableSpace == 0:
|
||||||
popupPos.PopupMessage(
|
_popupSystem.PopupCoordinates(Loc.GetString("comp-stack-already-full"), popupPos, filter);
|
||||||
args.User,
|
|
||||||
Loc.GetString("comp-stack-already-full")
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user