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
This commit is contained in:
Swept
2021-06-04 00:26:08 +00:00
committed by GitHub
parent b752b5732c
commit fd2a081539
15 changed files with 144 additions and 187 deletions

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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