StyleClasses="OpenLeft"/>
</BoxContainer>
<Control MinSize="0 10"/>
- <ScrollContainer HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True" MinSize="0 160">
- <PanelContainer VerticalExpand="True"
- SizeFlagsStretchRatio="6"
- MinSize="0 150">
- <PanelContainer.PanelOverride>
- <gfx:StyleBoxFlat BackgroundColor="#1b1b1e" />
- </PanelContainer.PanelOverride>
- <BoxContainer Name="ContainerInfo"
- Orientation="Vertical"
- HorizontalExpand="True">
- <Label Text="{Loc 'reagent-dispenser-window-no-container-loaded-text'}"/>
- </BoxContainer>
- </PanelContainer>
- </ScrollContainer>
+ <BoxContainer Orientation="Horizontal">
+ <SpriteView Name="View" Scale="4 4" MinSize="150 150"/>
+ <ScrollContainer HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True" MinSize="0 160">
+ <PanelContainer VerticalExpand="True"
+ SizeFlagsStretchRatio="6"
+ MinSize="0 150">
+ <PanelContainer.PanelOverride>
+ <gfx:StyleBoxFlat BackgroundColor="#1b1b1e" />
+ </PanelContainer.PanelOverride>
+ <BoxContainer Name="ContainerInfo"
+ Orientation="Vertical"
+ HorizontalExpand="True">
+ <Label Text="{Loc 'reagent-dispenser-window-no-container-loaded-text'}"/>
+ </BoxContainer>
+ </PanelContainer>
+ </ScrollContainer>
+ </BoxContainer>
</BoxContainer>
</DefaultWindow>
-using System.Linq;
using Content.Client.Stylesheets;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
public sealed partial class ReagentDispenserWindow : DefaultWindow
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+ [Dependency] private readonly IEntityManager _entityManager = default!;
public event Action<BaseButton.ButtonEventArgs, DispenseReagentButton>? OnDispenseReagentButtonPressed;
public event Action<GUIMouseHoverEventArgs, DispenseReagentButton>? OnDispenseReagentButtonMouseEntered;
public event Action<GUIMouseHoverEventArgs, DispenseReagentButton>? OnDispenseReagentButtonMouseExited;
/// Update the button grid of reagents which can be dispensed.
/// </summary>
/// <param name="inventory">Reagents which can be dispensed by this dispenser</param>
- public void UpdateReagentsList(List<KeyValuePair<string, KeyValuePair<string,string>>> inventory)
+ public void UpdateReagentsList(List<KeyValuePair<string, KeyValuePair<string, string>>> inventory)
{
if (ChemicalList == null)
return;
UpdateContainerInfo(castState);
UpdateReagentsList(castState.Inventory);
+ _entityManager.TryGetEntity(castState.OutputContainerEntity, out var outputContainerEnt);
+ View.SetEntity(outputContainerEnt);
+
// Disable the Clear & Eject button if no beaker
ClearButton.Disabled = castState.OutputContainer is null;
EjectButton.Disabled = castState.OutputContainer is null;
if (state.OutputContainer is null)
{
- ContainerInfo.Children.Add(new Label {Text = Loc.GetString("reagent-dispenser-window-no-container-loaded-text") });
+ ContainerInfo.Children.Add(new Label { Text = Loc.GetString("reagent-dispenser-window-no-container-loaded-text") });
return;
}
? p.LocalizedName
: Loc.GetString("reagent-dispenser-window-reagent-name-not-found-text");
- var nameLabel = new Label {Text = $"{localizedName}: "};
+ var nameLabel = new Label { Text = $"{localizedName}: " };
var quantityLabel = new Label
{
Text = Loc.GetString("reagent-dispenser-window-quantity-label-text", ("quantity", quantity)),
- StyleClasses = {StyleNano.StyleClassLabelSecondaryColor},
+ StyleClasses = { StyleNano.StyleClassLabelSecondaryColor },
};
ContainerInfo.Children.Add(new BoxContainer
var inventory = GetInventory(reagentDispenser);
- var state = new ReagentDispenserBoundUserInterfaceState(outputContainerInfo, inventory, reagentDispenser.Comp.DispenseAmount);
+ var state = new ReagentDispenserBoundUserInterfaceState(outputContainerInfo, GetNetEntity(outputContainer), inventory, reagentDispenser.Comp.DispenseAmount);
_userInterfaceSystem.TrySetUiState(reagentDispenser, ReagentDispenserUiKey.Key, state);
}
public sealed class ReagentDispenserBoundUserInterfaceState : BoundUserInterfaceState
{
public readonly ContainerInfo? OutputContainer;
+
+ public readonly NetEntity? OutputContainerEntity;
/// <summary>
/// A list of the reagents which this dispenser can dispense.
/// </summary>
public readonly ReagentDispenserDispenseAmount SelectedDispenseAmount;
- public ReagentDispenserBoundUserInterfaceState(ContainerInfo? outputContainer, List<KeyValuePair<string, KeyValuePair<string, string>>> inventory, ReagentDispenserDispenseAmount selectedDispenseAmount)
+ public ReagentDispenserBoundUserInterfaceState(ContainerInfo? outputContainer, NetEntity? outputContainerEntity, List<KeyValuePair<string, KeyValuePair<string, string>>> inventory, ReagentDispenserDispenseAmount selectedDispenseAmount)
{
OutputContainer = outputContainer;
+ OutputContainerEntity = outputContainerEntity;
Inventory = inventory;
SelectedDispenseAmount = selectedDispenseAmount;
}