diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.cs b/Content.Client/IconSmoothing/IconSmoothSystem.cs index 2715805e758..d6afbc42cb4 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.cs @@ -81,21 +81,25 @@ public void SetStateBase(EntityUid uid, IconSmoothComponent component, string ne private void SetCornerLayers(SpriteComponent sprite, IconSmoothComponent component) { - sprite.LayerMapRemove(CornerLayers.SE); - sprite.LayerMapRemove(CornerLayers.NE); - sprite.LayerMapRemove(CornerLayers.NW); - sprite.LayerMapRemove(CornerLayers.SW); - + // Frontier: Allow overlays on entities using CornerLayers smoothing - don't remove layers, adjust existing ones or create new ones. var state0 = $"{component.StateBase}0"; - sprite.LayerMapSet(CornerLayers.SE, sprite.AddLayerState(state0)); - sprite.LayerSetDirOffset(CornerLayers.SE, DirectionOffset.None); - sprite.LayerMapSet(CornerLayers.NE, sprite.AddLayerState(state0)); - sprite.LayerSetDirOffset(CornerLayers.NE, DirectionOffset.CounterClockwise); - sprite.LayerMapSet(CornerLayers.NW, sprite.AddLayerState(state0)); - sprite.LayerSetDirOffset(CornerLayers.NW, DirectionOffset.Flip); - sprite.LayerMapSet(CornerLayers.SW, sprite.AddLayerState(state0)); - sprite.LayerSetDirOffset(CornerLayers.SW, DirectionOffset.Clockwise); + SetCornerLayerState(sprite, CornerLayers.SE, DirectionOffset.None, state0); + SetCornerLayerState(sprite, CornerLayers.NE, DirectionOffset.CounterClockwise, state0); + SetCornerLayerState(sprite, CornerLayers.NW, DirectionOffset.Flip, state0); + SetCornerLayerState(sprite, CornerLayers.SW, DirectionOffset.Clockwise, state0); + // End Frontier: Allow overlays on entities using CornerLayers smoothing - don't remove layers, adjust existing ones or create new ones. + } + + // Frontier: set layer function to remove redundancy + private void SetCornerLayerState(SpriteComponent sprite, CornerLayers corner, DirectionOffset offset, string state) + { + if (sprite.LayerMapTryGet(corner, out var layer)) + sprite.LayerSetState(layer, state); + else + sprite.LayerMapSet(corner, sprite.AddLayerState(state)); + sprite.LayerSetDirOffset(corner, offset); } + // End Frontier: set layer function to remove redundancy private void OnShutdown(EntityUid uid, IconSmoothComponent component, ComponentShutdown args) { diff --git a/Content.Client/Stack/StackCustomSplitBoundUserInterface.cs b/Content.Client/Stack/StackCustomSplitBoundUserInterface.cs new file mode 100644 index 00000000000..ff9a03580a9 --- /dev/null +++ b/Content.Client/Stack/StackCustomSplitBoundUserInterface.cs @@ -0,0 +1,41 @@ +// Cherry-picked from space-station-14#32938 courtesy of Ilya246 +using JetBrains.Annotations; +using Content.Shared.Stacks; +using Robust.Client.GameObjects; +using Robust.Client.UserInterface; + +namespace Content.Client.Stack +{ + [UsedImplicitly] + public sealed class StackCustomSplitBoundUserInterface : BoundUserInterface + { + private IEntityManager _entManager; + private EntityUid _owner; + [ViewVariables] + private StackCustomSplitWindow? _window; + + public StackCustomSplitBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + _owner = owner; + _entManager = IoCManager.Resolve(); + } + + protected override void Open() + { + base.Open(); + _window = this.CreateWindow(); + + if (_entManager.TryGetComponent(_owner, out var comp)) + _window.SetMax(comp.Count); + + _window.ApplyButton.OnPressed += _ => + { + if (int.TryParse(_window.AmountLineEdit.Text, out var i)) + { + SendMessage(new StackCustomSplitAmountMessage(i)); + _window.Close(); + } + }; + } + } +} diff --git a/Content.Client/Stack/StackCustomSplitWindow.xaml b/Content.Client/Stack/StackCustomSplitWindow.xaml new file mode 100644 index 00000000000..2294d459415 --- /dev/null +++ b/Content.Client/Stack/StackCustomSplitWindow.xaml @@ -0,0 +1,15 @@ + + + + + + + + + +