From fd2a08153947d8b8bd435221b54a87495da80b0f Mon Sep 17 00:00:00 2001 From: Swept Date: Fri, 4 Jun 2021 00:26:08 +0000 Subject: [PATCH] Slims down disposal unit ui and fixes thrown collisions (#4122) * Cleans up disposal unit yaml and fixes inability to throw things in them. * Comments out mailing units because they are beyond broken and need a refactor. * Makes Disposal UI look better * Localized the disposal unit * Removes title line * Removes changes to VendingMachineMenu, mistakenly committed. * Applies code reviews * Now uses BaseMachinePowered --- .../Disposal/DisposalMailingUnitWindow.cs | 2 +- .../Components/Disposal/DisposalUnitWindow.cs | 65 ++++---- .../VendingMachines/VendingMachineMenu.cs | 3 +- Resources/Locale/en-US/ui/disposal.ftl | 13 ++ .../{ => Atmospherics}/gascanisterports.yml | 0 .../{ => Atmospherics}/gascanisters.yml | 0 .../Piping/{ => Atmospherics}/gasfilters.yml | 0 .../{ => Atmospherics}/gasgenerator.yml | 0 .../Piping/{ => Atmospherics}/heaters.yml | 0 .../Piping/{ => Atmospherics}/pipes.yml | 0 .../Piping/{ => Atmospherics}/pumps.yml | 0 .../Piping/{ => Atmospherics}/scrubbers.yml | 0 .../Piping/{ => Atmospherics}/vents.yml | 0 .../Disposal/pipes.yml} | 154 +----------------- .../Constructible/Piping/Disposal/units.yml | 94 +++++++++++ 15 files changed, 144 insertions(+), 187 deletions(-) create mode 100644 Resources/Locale/en-US/ui/disposal.ftl rename Resources/Prototypes/Entities/Constructible/Piping/{ => Atmospherics}/gascanisterports.yml (100%) rename Resources/Prototypes/Entities/Constructible/Piping/{ => Atmospherics}/gascanisters.yml (100%) rename Resources/Prototypes/Entities/Constructible/Piping/{ => Atmospherics}/gasfilters.yml (100%) rename Resources/Prototypes/Entities/Constructible/Piping/{ => Atmospherics}/gasgenerator.yml (100%) rename Resources/Prototypes/Entities/Constructible/Piping/{ => Atmospherics}/heaters.yml (100%) rename Resources/Prototypes/Entities/Constructible/Piping/{ => Atmospherics}/pipes.yml (100%) rename Resources/Prototypes/Entities/Constructible/Piping/{ => Atmospherics}/pumps.yml (100%) rename Resources/Prototypes/Entities/Constructible/Piping/{ => Atmospherics}/scrubbers.yml (100%) rename Resources/Prototypes/Entities/Constructible/Piping/{ => Atmospherics}/vents.yml (100%) rename Resources/Prototypes/Entities/Constructible/{Specific/disposal.yml => Piping/Disposal/pipes.yml} (63%) create mode 100644 Resources/Prototypes/Entities/Constructible/Piping/Disposal/units.yml diff --git a/Content.Client/GameObjects/Components/Disposal/DisposalMailingUnitWindow.cs b/Content.Client/GameObjects/Components/Disposal/DisposalMailingUnitWindow.cs index e40bc19e02..56afa3db32 100644 --- a/Content.Client/GameObjects/Components/Disposal/DisposalMailingUnitWindow.cs +++ b/Content.Client/GameObjects/Components/Disposal/DisposalMailingUnitWindow.cs @@ -1,4 +1,4 @@ -using Content.Shared.GameObjects.Components.Disposal; +using Content.Shared.GameObjects.Components.Disposal; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; diff --git a/Content.Client/GameObjects/Components/Disposal/DisposalUnitWindow.cs b/Content.Client/GameObjects/Components/Disposal/DisposalUnitWindow.cs index 7826ea1dd3..e78cc5a1af 100644 --- a/Content.Client/GameObjects/Components/Disposal/DisposalUnitWindow.cs +++ b/Content.Client/GameObjects/Components/Disposal/DisposalUnitWindow.cs @@ -1,8 +1,10 @@ -using Content.Shared.GameObjects.Components.Disposal; +using Content.Client.UserInterface.Stylesheets; +using Content.Shared.GameObjects.Components.Disposal; using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; +using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalUnitComponent; @@ -16,45 +18,43 @@ namespace Content.Client.GameObjects.Components.Disposal { private readonly Label _unitState; private readonly ProgressBar _pressureBar; - private readonly Label _pressurePercentage; public readonly Button Engage; public readonly Button Eject; public readonly Button Power; public DisposalUnitWindow() { - MinSize = SetSize = (300, 225); - + IoCManager.InjectDependencies(this); + MinSize = SetSize = (300, 140); + Resizable = false; Contents.AddChild(new VBoxContainer { Children = { new HBoxContainer { + SeparationOverride = 4, Children = { - new Label {Text = Loc.GetString("State: ")}, - (_unitState = new Label {Text = Loc.GetString("Ready")}) + new Label {Text = Loc.GetString("ui-disposal-unit-label-state")}, + (_unitState = new Label {Text = Loc.GetString("ui-disposal-unit-label-status")}) } }, - new Control {MinSize = (0, 10)}, + new Control {MinSize = (0, 5)}, new HBoxContainer { + SeparationOverride = 4, Children = { - new Label {Text = Loc.GetString("Pressure:")}, + new Label {Text = Loc.GetString("ui-disposal-unit-label-pressure")}, (_pressureBar = new ProgressBar { - MinSize = (200, 20), + MinSize = (190, 20), HorizontalAlignment = HAlignment.Right, MinValue = 0, MaxValue = 1, Page = 0, - Value = 0.5f, - Children = - { - (_pressurePercentage = new Label()) - } + Value = 0.5f }) } }, @@ -63,29 +63,25 @@ namespace Content.Client.GameObjects.Components.Disposal { Children = { - new Label {Text = Loc.GetString("Handle:")}, (Engage = new Button { - Text = Loc.GetString("Engage"), + Text = Loc.GetString("ui-disposal-unit-button-flush"), + StyleClasses = {StyleBase.ButtonOpenRight}, ToggleMode = true + }), + + (Eject = new Button + { + Text = Loc.GetString("ui-disposal-unit-button-eject"), + StyleClasses = {StyleBase.ButtonOpenBoth} + }), + + (Power = new CheckButton + { + Text = Loc.GetString("ui-disposal-unit-button-power"), + StyleClasses = {StyleBase.ButtonOpenLeft} }) - } - }, - new Control {MinSize = (0, 10)}, - new HBoxContainer - { - Children = - { - new Label {Text = Loc.GetString("Eject:")}, - (Eject = new Button {Text = Loc.GetString("Eject Contents")}) - } - }, - new Control {MinSize = (0, 10)}, - new HBoxContainer - { - Children = - { - (Power = new CheckButton {Text = Loc.GetString("Power")}), + } } } @@ -127,9 +123,6 @@ namespace Content.Client.GameObjects.Components.Disposal var foregroundStyleBoxOverride = (StyleBoxFlat) _pressureBar.ForegroundStyleBoxOverride; foregroundStyleBoxOverride.BackgroundColor = Color.FromHsv(new Vector4(finalHue, saturation, value, alpha)); - - var percentage = pressure / _pressureBar.MaxValue * 100; - _pressurePercentage.Text = $" {percentage:0}%"; } public void UpdateState(DisposalUnitBoundUserInterfaceState state) diff --git a/Content.Client/VendingMachines/VendingMachineMenu.cs b/Content.Client/VendingMachines/VendingMachineMenu.cs index d1b75f700d..92d36e6e8c 100644 --- a/Content.Client/VendingMachines/VendingMachineMenu.cs +++ b/Content.Client/VendingMachines/VendingMachineMenu.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Content.Client.GameObjects.Components.VendingMachines; using Robust.Client.GameObjects; using Robust.Client.Graphics; diff --git a/Resources/Locale/en-US/ui/disposal.ftl b/Resources/Locale/en-US/ui/disposal.ftl new file mode 100644 index 0000000000..b9d3399def --- /dev/null +++ b/Resources/Locale/en-US/ui/disposal.ftl @@ -0,0 +1,13 @@ +### Disposal UIs + +## Disposal Units + +ui-disposal-unit-title = Disposal Unit + +ui-disposal-unit-label-state = State: +ui-disposal-unit-label-pressure = Pressure: +ui-disposal-unit-label-status = Ready + +ui-disposal-unit-button-flush = Flush +ui-disposal-unit-button-eject = Eject Contents +ui-disposal-unit-button-power = Power diff --git a/Resources/Prototypes/Entities/Constructible/Piping/gascanisterports.yml b/Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/gascanisterports.yml similarity index 100% rename from Resources/Prototypes/Entities/Constructible/Piping/gascanisterports.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/gascanisterports.yml diff --git a/Resources/Prototypes/Entities/Constructible/Piping/gascanisters.yml b/Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/gascanisters.yml similarity index 100% rename from Resources/Prototypes/Entities/Constructible/Piping/gascanisters.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/gascanisters.yml diff --git a/Resources/Prototypes/Entities/Constructible/Piping/gasfilters.yml b/Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/gasfilters.yml similarity index 100% rename from Resources/Prototypes/Entities/Constructible/Piping/gasfilters.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/gasfilters.yml diff --git a/Resources/Prototypes/Entities/Constructible/Piping/gasgenerator.yml b/Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/gasgenerator.yml similarity index 100% rename from Resources/Prototypes/Entities/Constructible/Piping/gasgenerator.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/gasgenerator.yml diff --git a/Resources/Prototypes/Entities/Constructible/Piping/heaters.yml b/Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/heaters.yml similarity index 100% rename from Resources/Prototypes/Entities/Constructible/Piping/heaters.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/heaters.yml diff --git a/Resources/Prototypes/Entities/Constructible/Piping/pipes.yml b/Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/pipes.yml similarity index 100% rename from Resources/Prototypes/Entities/Constructible/Piping/pipes.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/pipes.yml diff --git a/Resources/Prototypes/Entities/Constructible/Piping/pumps.yml b/Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/pumps.yml similarity index 100% rename from Resources/Prototypes/Entities/Constructible/Piping/pumps.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/pumps.yml diff --git a/Resources/Prototypes/Entities/Constructible/Piping/scrubbers.yml b/Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/scrubbers.yml similarity index 100% rename from Resources/Prototypes/Entities/Constructible/Piping/scrubbers.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/scrubbers.yml diff --git a/Resources/Prototypes/Entities/Constructible/Piping/vents.yml b/Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/vents.yml similarity index 100% rename from Resources/Prototypes/Entities/Constructible/Piping/vents.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Atmospherics/vents.yml diff --git a/Resources/Prototypes/Entities/Constructible/Specific/disposal.yml b/Resources/Prototypes/Entities/Constructible/Piping/Disposal/pipes.yml similarity index 63% rename from Resources/Prototypes/Entities/Constructible/Specific/disposal.yml rename to Resources/Prototypes/Entities/Constructible/Piping/Disposal/pipes.yml index 87c97b4e92..638301f040 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/disposal.yml +++ b/Resources/Prototypes/Entities/Constructible/Piping/Disposal/pipes.yml @@ -1,4 +1,6 @@ -- type: entity +# Base + +- type: entity id: DisposalPipeBase abstract: true placement: @@ -32,6 +34,8 @@ components: - type: DisposalHolder +# Pipes + - type: entity id: DisposalPipe parent: DisposalPipeBase @@ -108,77 +112,6 @@ bounds: "-0.5,-0.25,0.4,0.25" layer: [ Underplating ] -- type: entity - id: DisposalUnit - parent: BaseConstructible - name: disposal unit - description: A pneumatic waste disposal unit - placement: - mode: SnapgridCenter - snap: - - Disposal - components: - - type: Sprite - netsync: false - sprite: Constructible/Power/disposal.rsi - layers: - - state: condisposal - map: ["enum.DisposalUnitVisualLayers.Base"] - - state: dispover-handle - map: ["enum.DisposalUnitVisualLayers.Handle"] - - state: dispover-ready - map: ["enum.DisposalUnitVisualLayers.Light"] - - type: PowerReceiver - - type: DisposalUnit - flushTime: 2 - - type: InteractionOutline - - type: Physics - bodyType: Static - fixtures: - - shape: - !type:PhysShapeAabb - bounds: "-0.4,-0.25,0.4,0.25" - mask: - - SmallImpassable - layer: - - Opaque - - MobImpassable - - type: Anchorable - - type: Damageable - resistances: metallicResistances - - type: Destructible - thresholds: - - trigger: - !type:DamageTrigger - damage: 100 - behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - - !type:PlaySoundBehavior - sound: /Audio/Effects/metalbreak.ogg - - !type:SpawnEntitiesBehavior - spawn: - SheetSteel1: - min: 1 - max: 1 - - type: Appearance - visuals: - - type: DisposalUnitVisualizer - state_unanchored: condisposal - state_anchored: disposal - state_charging: disposal-charging - overlay_charging: dispover-charge - overlay_ready: dispover-ready - overlay_full: dispover-full - overlay_engaged: dispover-handle - state_flush: disposal-flush - flush_sound: /Audio/Machines/disposalflush.ogg - flush_time: 2 - - type: UserInterface - interfaces: - - key: enum.DisposalUnitUiKey.Key - type: DisposalUnitBoundUserInterface - - type: entity id: DisposalRouter parent: DisposalPipeBase @@ -352,80 +285,3 @@ !type:PhysShapeAabb bounds: "-0.5,-0.5,0.25,0.25" layer: [ Underplating ] - -- type: entity - id: DisposalMailingUnit - name: disposal mailing unit - description: A pneumatic waste disposal unit - placement: - mode: SnapgridCenter - snap: - - Disposal - components: - - type: Sprite - netsync: false - sprite: Constructible/Power/disposal.rsi - layers: - - state: condisposal - map: ["enum.DisposalUnitVisualLayers.Base"] - - state: dispover-handle - map: ["enum.DisposalUnitVisualLayers.Handle"] - - state: dispover-ready - map: ["enum.DisposalUnitVisualLayers.Light"] - - type: PowerReceiver - - type: Configuration - keys: - - Tag - - type: DisposalMailingUnit - flushTime: 2 - - type: Clickable - - type: InteractionOutline - - type: Physics - bodyType: Static - fixtures: - - shape: - !type:PhysShapeAabb - bounds: "-0.35,-0.3,0.35,0.3" - mask: - - Impassable - - MobImpassable - - VaultImpassable - - SmallImpassable - layer: - - Opaque - - Impassable - - MobImpassable - - VaultImpassable - - SmallImpassable - - type: SnapGrid - - type: Anchorable - - type: Damageable - resistances: metallicResistances - - type: Destructible - thresholds: - - trigger: - !type:DamageTrigger - damage: 100 - behaviors: - - !type:DoActsBehavior - acts: ["Destruction"] - - type: Appearance - visuals: - - type: DisposalUnitVisualizer - state_unanchored: condisposal - state_anchored: disposal - state_charging: disposal-charging - overlay_charging: dispover-charge - overlay_ready: dispover-ready - overlay_full: dispover-full - overlay_engaged: dispover-handle - state_flush: disposal-flush - flush_sound: /Audio/Machines/disposalflush.ogg - flush_time: 2 - - type: UserInterface - interfaces: - - key: enum.DisposalMailingUnitUiKey.Key - type: DisposalMailingUnitBoundUserInterface - - key: enum.ConfigurationUiKey.Key - type: ConfigurationBoundUserInterface - - type: Pullable diff --git a/Resources/Prototypes/Entities/Constructible/Piping/Disposal/units.yml b/Resources/Prototypes/Entities/Constructible/Piping/Disposal/units.yml new file mode 100644 index 0000000000..77543a62e5 --- /dev/null +++ b/Resources/Prototypes/Entities/Constructible/Piping/Disposal/units.yml @@ -0,0 +1,94 @@ +- type: entity + abstract: true + id: DisposalUnitBase + parent: BaseMachinePowered + description: A pneumatic waste disposal unit. + placement: + mode: SnapgridCenter + snap: + - Disposal + components: + - type: Sprite + netsync: false + sprite: Constructible/Power/disposal.rsi + layers: + - state: condisposal + map: ["enum.DisposalUnitVisualLayers.Base"] + - state: dispover-handle + map: ["enum.DisposalUnitVisualLayers.Handle"] + - state: dispover-ready + map: ["enum.DisposalUnitVisualLayers.Light"] + - type: Physics + bodyType: Static + fixtures: + - shape: + !type:PhysShapeAabb + bounds: "-0.4,-0.25,0.4,0.25" + mass: 30 + mask: + - SmallImpassable + layer: + - Opaque + - Impassable + - MobImpassable + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 100 + behaviors: + - !type:DoActsBehavior + acts: ["Destruction"] + - !type:PlaySoundBehavior + sound: /Audio/Effects/metalbreak.ogg + - !type:SpawnEntitiesBehavior + spawn: + SheetSteel1: + min: 1 + max: 1 + - type: Appearance + visuals: + - type: DisposalUnitVisualizer + state_unanchored: condisposal + state_anchored: disposal + state_charging: disposal-charging + overlay_charging: dispover-charge + overlay_ready: dispover-ready + overlay_full: dispover-full + overlay_engaged: dispover-handle + state_flush: disposal-flush + flush_sound: /Audio/Machines/disposalflush.ogg + flush_time: 2 + - type: UserInterface + interfaces: + - key: enum.DisposalUnitUiKey.Key + type: DisposalUnitBoundUserInterface + +- type: entity + id: DisposalUnit + parent: DisposalUnitBase + name: disposal unit + components: + - type: DisposalUnit + flushTime: 2 + - type: UserInterface + interfaces: + - key: enum.DisposalUnitUiKey.Key + type: DisposalUnitBoundUserInterface + +# - type: entity +# parent: DisposalUnitBase +# id: DisposalMailingUnit +# name: disposal mailing unit +# components: +# - type: Configuration +# keys: +# - Tag +# - type: DisposalMailingUnit +# flushTime: 2 +# - type: UserInterface +# interfaces: +# - key: enum.DisposalMailingUnitUiKey.Key +# type: DisposalMailingUnitBoundUserInterface +# - key: enum.ConfigurationUiKey.Key +# type: ConfigurationBoundUserInterface