Make reagent dispensers gridinv-based instead of pseudo-listinv (#34205)
This simplifies the code and makes the experience of examining contents easier without the reagent dispenser UI, as well as adding the possibility for dispensers to have items of heterogeneous sizes in them, which would allow configuring reagent dispensers to accept smaller containers such as beakers or vials in order to allow for more types of smaller quantities of reagents, or other flexibilities brought by using a standard storage component.
This commit is contained in:
committed by
GitHub
parent
942b2b4dcb
commit
5a0e0524ca
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface;
|
||||
@@ -9,15 +10,15 @@ namespace Content.Client.Chemistry.UI;
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class ReagentCardControl : Control
|
||||
{
|
||||
public string StorageSlotId { get; }
|
||||
public Action<string>? OnPressed;
|
||||
public Action<string>? OnEjectButtonPressed;
|
||||
public ItemStorageLocation StorageLocation { get; }
|
||||
public Action<ItemStorageLocation>? OnPressed;
|
||||
public Action<ItemStorageLocation>? OnEjectButtonPressed;
|
||||
|
||||
public ReagentCardControl(ReagentInventoryItem item)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
StorageSlotId = item.StorageSlotId;
|
||||
StorageLocation = item.StorageLocation;
|
||||
ColorPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = item.ReagentColor };
|
||||
ReagentNameLabel.Text = item.ReagentLabel;
|
||||
FillLabel.Text = Loc.GetString("reagent-dispenser-window-quantity-label-text", ("quantity", item.Quantity));;
|
||||
@@ -26,7 +27,7 @@ public sealed partial class ReagentCardControl : Control
|
||||
if (item.Quantity == 0.0)
|
||||
MainButton.Disabled = true;
|
||||
|
||||
MainButton.OnPressed += args => OnPressed?.Invoke(StorageSlotId);
|
||||
EjectButton.OnPressed += args => OnEjectButtonPressed?.Invoke(StorageSlotId);
|
||||
MainButton.OnPressed += args => OnPressed?.Invoke(StorageLocation);
|
||||
EjectButton.OnPressed += args => OnEjectButtonPressed?.Invoke(StorageLocation);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user