Skip to content

Commit 138cd1e

Browse files
committed
More Output changes and polishing
1 parent fdfc5d6 commit 138cd1e

3 files changed

Lines changed: 63 additions & 12 deletions

File tree

Content.Client/_Starlight/Chemistry/UI/ModernChemMasterWindow.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@
162162
<Label Text="{Loc 'chem-master-output-source'}" StyleClasses="LabelSecondaryColor" Margin="0 0 5 0"/>
163163
<Button MinSize="80 0" Name="OutputBufferDraw" Access="Public"
164164
Text="{Loc 'chem-master-output-buffer-draw'}"
165-
ToggleMode="True" StyleClasses="OpenRight" />
165+
ToggleMode="True" StyleClasses="OpenRight" ToolTip="{Loc 'chem-master-window-buffer-draw-tooltip'}" />
166166
<Button MinSize="80 0" Name="OutputBeakerDraw" Access="Public"
167167
Text="{Loc 'chem-master-output-beaker-draw'}"
168-
ToggleMode="True" StyleClasses="OpenLeft" />
168+
ToggleMode="True" StyleClasses="OpenLeft" ToolTip="{Loc 'chem-master-window-beaker-draw-tooltip'}" />
169169
<Control HorizontalExpand="True"/>
170170
<Label Name="DrawSource"/>
171171
<Label Name="BufferCurrentVolume" StyleClasses="LabelSecondaryColor" />
@@ -326,10 +326,10 @@
326326
<Label Text="{Loc 'chem-master-output-source'}" StyleClasses="LabelSecondaryColor" Margin="0 0 5 0"/>
327327
<Button MinSize="80 0" Name="OutputBufferDrawClassic" Access="Public"
328328
Text="{Loc 'chem-master-output-buffer-draw'}"
329-
ToggleMode="True" StyleClasses="OpenRight" />
329+
ToggleMode="True" StyleClasses="OpenRight" ToolTip="{Loc 'chem-master-window-buffer-draw-tooltip'}" />
330330
<Button MinSize="80 0" Name="OutputBeakerDrawClassic" Access="Public"
331331
Text="{Loc 'chem-master-output-beaker-draw'}"
332-
ToggleMode="True" StyleClasses="OpenLeft" />
332+
ToggleMode="True" StyleClasses="OpenLeft" ToolTip="{Loc 'chem-master-window-beaker-draw-tooltip'}" />
333333
<Control HorizontalExpand="True"/>
334334
<Label Name="DrawSourceClassic"/>
335335
<Label Name="BufferCurrentVolumeClassic" StyleClasses="LabelSecondaryColor" />

Content.Client/_Starlight/Chemistry/UI/ModernChemMasterWindow.xaml.cs

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -488,14 +488,25 @@ public void UpdateState(BoundUserInterfaceState state)
488488
OutputEjectButton.Disabled = castState.OutputContainerInfo is null;
489489
OutputEjectButtonClassic.Disabled = castState.OutputContainerInfo is null;
490490

491-
CreateBottleButton.Disabled = castState.OutputContainerInfo?.Reagents == null;
492-
CreateBottleButtonClassic.Disabled = castState.OutputContainerInfo?.Reagents == null;
491+
var output = castState.OutputContainerInfo;
492+
var bottleFull = output?.Reagents != null && output.CurrentVolume >= output.MaxVolume;
493+
var pillFull = output?.PillEntities != null && output.CurrentVolume >= output.MaxVolume;
494+
var patchFull = output?.PatchEntities != null && output.CurrentVolume >= output.MaxVolume;
495+
496+
CreateBottleButton.Disabled = castState.OutputContainerInfo?.Reagents == null || bottleFull;
497+
CreateBottleButtonClassic.Disabled = castState.OutputContainerInfo?.Reagents == null || bottleFull;
498+
CreateBottleButton.ToolTip = !CreateBottleButton.Disabled ? null : bottleFull ? Loc.GetString("chem-master-window-create-bottle-full-tooltip") : Loc.GetString("chem-master-window-create-bottle-tooltip");
499+
CreateBottleButtonClassic.ToolTip = !CreateBottleButtonClassic.Disabled ? null : bottleFull ? Loc.GetString("chem-master-window-create-bottle-full-tooltip") : Loc.GetString("chem-master-window-create-bottle-tooltip");
493500

494-
CreatePillButton.Disabled = castState.OutputContainerInfo?.PillEntities == null;
495-
CreatePillButtonClassic.Disabled = castState.OutputContainerInfo?.PillEntities == null;
501+
CreatePillButton.Disabled = castState.OutputContainerInfo?.PillEntities == null || pillFull;
502+
CreatePillButtonClassic.Disabled = castState.OutputContainerInfo?.PillEntities == null || pillFull;
503+
CreatePillButton.ToolTip = !CreatePillButton.Disabled ? null : pillFull ? Loc.GetString("chem-master-window-create-pill-full-tooltip") : Loc.GetString("chem-master-window-create-pill-tooltip");
504+
CreatePillButtonClassic.ToolTip = !CreatePillButtonClassic.Disabled ? null : pillFull ? Loc.GetString("chem-master-window-create-pill-full-tooltip") : Loc.GetString("chem-master-window-create-pill-tooltip");
496505

497-
CreatePatchButton.Disabled = castState.OutputContainerInfo?.PatchEntities == null;
498-
CreatePatchButtonClassic.Disabled = castState.OutputContainerInfo?.PatchEntities == null;
506+
CreatePatchButton.Disabled = castState.OutputContainerInfo?.PatchEntities == null || patchFull;
507+
CreatePatchButtonClassic.Disabled = castState.OutputContainerInfo?.PatchEntities == null || patchFull;
508+
CreatePatchButton.ToolTip = !CreatePatchButton.Disabled ? null : patchFull ? Loc.GetString("chem-master-window-create-patch-full-tooltip") : Loc.GetString("chem-master-window-create-patch-tooltip");
509+
CreatePatchButtonClassic.ToolTip = !CreatePatchButtonClassic.Disabled ? null : patchFull ? Loc.GetString("chem-master-window-create-patch-full-tooltip") : Loc.GetString("chem-master-window-create-patch-tooltip");
499510

500511
var valveText = Loc.GetString(castState.ValveOpen
501512
? "chem-master-window-valve-open"
@@ -585,12 +596,12 @@ private void UpdatePanelInfo(ChemMasterBoundUserInterfaceState state)
585596
// Modern layout containers
586597
BuildContainerUI(InputContainerInfo, state.InputContainerInfo, true, modernMode: true);
587598
BuildContainerUI(OutputContainerInfo, state.OutputContainerInfo, false, modernMode: true, "chem-master-window-no-output-container-loaded-text");
588-
BuildContainerUI(OutputInputContainerInfo, state.InputContainerInfo, false, modernMode: false, "chem-master-window-no-input-container-loaded-text");
599+
BuildOutputLeftContainer(OutputInputContainerInfo, state, modernMode: false);
589600

590601
// Classic layout containers
591602
BuildContainerUI(InputContainerInfoClassic, state.InputContainerInfo, true, modernMode: false);
592603
BuildContainerUI(OutputContainerInfoClassic, state.OutputContainerInfo, false, modernMode: false, "chem-master-window-no-output-container-loaded-text");
593-
BuildContainerUI(OutputInputContainerInfoClassic, state.InputContainerInfo, false, modernMode: false, "chem-master-window-no-input-container-loaded-text");
604+
BuildOutputLeftContainer(OutputInputContainerInfoClassic, state, modernMode: false);
594605

595606
BufferInfo.Children.Clear();
596607
BufferInfoClassic.Children.Clear();
@@ -664,6 +675,38 @@ void AddBufferHeader(BoxContainer target)
664675
UpdateReagentPrototypes(SearchBar.Text);
665676
}
666677

678+
private void BuildOutputLeftContainer(Control control, ChemMasterBoundUserInterfaceState state, bool modernMode)
679+
{
680+
if (state.DrawSource == ChemMasterDrawSource.Internal)
681+
{
682+
// Show buffer contents when packaging from buffer
683+
control.Children.Clear();
684+
if (!state.BufferReagents.Any())
685+
{
686+
control.Children.Add(new Label { Text = Loc.GetString("chem-master-window-buffer-empty-text") });
687+
return;
688+
}
689+
control.Children.Add(new BoxContainer
690+
{
691+
Orientation = LayoutOrientation.Horizontal,
692+
Children =
693+
{
694+
new Label { Text = $"{Loc.GetString("chem-master-window-buffer-label")} " },
695+
new Label { Text = $"{state.BufferCurrentVolume}u", StyleClasses = { StyleClass.LabelWeak } }
696+
}
697+
});
698+
var rowCount = 0;
699+
foreach (var (reagent, quantity) in state.BufferReagents)
700+
{
701+
_prototypeManager.TryIndex(reagent.Prototype, out ReagentPrototype? proto);
702+
var name = proto?.LocalizedName ?? Loc.GetString("chem-master-window-unknown-reagent-text");
703+
control.Children.Add(BuildReagentRow(default, rowCount++, name, reagent, quantity, true, false, modernMode));
704+
}
705+
return;
706+
}
707+
BuildContainerUI(control, state.InputContainerInfo, false, modernMode, "chem-master-window-no-input-container-loaded-text");
708+
}
709+
667710
private void BuildContainerUI(Control control, ContainerInfo? info, bool addReagentButtons, bool modernMode, string emptyLoc = "chem-master-window-no-container-loaded-text")
668711
{
669712
control.Children.Clear();

Resources/Locale/en-US/_Starlight/chemistry/components/chem-master-component.ftl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,11 @@ chem-master-window-custom-amount-placeholder = Enter a custom amount ...
2020
chem-master-window-containers-label = Containers
2121
chem-master-window-no-input-container-loaded-text = No input container loaded.
2222
chem-master-window-no-output-container-loaded-text = No output container loaded.
23+
chem-master-window-create-pill-tooltip = Insert an empty pill canister to make pills.
24+
chem-master-window-create-patch-tooltip = Insert an empty patch pack to make patches.
25+
chem-master-window-create-bottle-tooltip = Insert an empty bottle to fill a bottle.
26+
chem-master-window-create-pill-full-tooltip = The pill canister is full. Insert a new pill canister to make pills.
27+
chem-master-window-create-patch-full-tooltip = The patch pack is full. Insert a new patch pack to make patches.
28+
chem-master-window-create-bottle-full-tooltip = The bottle is full. Insert a new bottle to fill a bottle.
29+
chem-master-window-buffer-draw-tooltip = Packages from the machine's internal buffer, evenly mixing all stored reagents from the buffer.
30+
chem-master-window-beaker-draw-tooltip = Packages from the inserted beaker, evenly mixing all stored reagents from the beaker.

0 commit comments

Comments
 (0)