Added auto label for ChemMaster (#5596)
This commit is contained in:
@@ -38,19 +38,19 @@ namespace Content.Client.Chemistry.UI
|
|||||||
_window.OnClose += Close;
|
_window.OnClose += Close;
|
||||||
|
|
||||||
//Setup static button actions.
|
//Setup static button actions.
|
||||||
_window.EjectButton.OnPressed += _ => PrepareData(UiAction.Eject, null, null, null, null);
|
_window.EjectButton.OnPressed += _ => PrepareData(UiAction.Eject, null, null, null, null, null);
|
||||||
_window.BufferTransferButton.OnPressed += _ => PrepareData(UiAction.Transfer, null, null, null, null);
|
_window.BufferTransferButton.OnPressed += _ => PrepareData(UiAction.Transfer, null, null, null, null, null);
|
||||||
_window.BufferDiscardButton.OnPressed += _ => PrepareData(UiAction.Discard, null, null, null, null);
|
_window.BufferDiscardButton.OnPressed += _ => PrepareData(UiAction.Discard, null, null, null, null, null);
|
||||||
_window.CreatePillButton.OnPressed += _ => PrepareData(UiAction.CreatePills, null, null, _window.PillAmount.Value, null);
|
_window.CreatePillButton.OnPressed += _ => PrepareData(UiAction.CreatePills, null, _window.LabelLine, null, _window.PillAmount.Value, null);
|
||||||
_window.CreateBottleButton.OnPressed += _ => PrepareData(UiAction.CreateBottles, null, null, null, _window.BottleAmount.Value);
|
_window.CreateBottleButton.OnPressed += _ => PrepareData(UiAction.CreateBottles, null, _window.LabelLine, null, null, _window.BottleAmount.Value);
|
||||||
|
|
||||||
for(uint i = 0; i < _window.PillTypeButtons.Length; i++)
|
for(uint i = 0; i < _window.PillTypeButtons.Length; i++)
|
||||||
{
|
{
|
||||||
uint type = i;
|
uint type = i;
|
||||||
_window.PillTypeButtons[i].OnPressed += _ => PrepareData(UiAction.SetPillType, null, type + 1, null, null);
|
_window.PillTypeButtons[i].OnPressed += _ => PrepareData(UiAction.SetPillType, null, null, type + 1, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
_window.OnChemButtonPressed += (args, button) => PrepareData(UiAction.ChemButton, button, null, null, null);
|
_window.OnChemButtonPressed += (args, button) => PrepareData(UiAction.ChemButton, button, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -69,15 +69,15 @@ namespace Content.Client.Chemistry.UI
|
|||||||
_window?.UpdateState(castState); //Update window state
|
_window?.UpdateState(castState); //Update window state
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrepareData(UiAction action, ChemButton? button, uint? pillType, int? pillAmount, int? bottleAmount)
|
private void PrepareData(UiAction action, ChemButton? button, string? label, uint? pillType, int? pillAmount, int? bottleAmount)
|
||||||
{
|
{
|
||||||
if (button != null)
|
if (button != null)
|
||||||
{
|
{
|
||||||
SendMessage(new UiActionMessage(action, button.Amount, button.Id, button.IsBuffer, null, null, null));
|
SendMessage(new UiActionMessage(action, button.Amount, button.Id, button.IsBuffer, null, null, null, null));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendMessage(new UiActionMessage(action, null, null, null, pillType, pillAmount, bottleAmount));
|
SendMessage(new UiActionMessage(action, null, null, null, label, pillType, pillAmount, bottleAmount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
StyleClasses="OpenLeft" />
|
StyleClasses="OpenLeft" />
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
<!-- Buffer info -->
|
<!-- Buffer info -->
|
||||||
<PanelContainer VerticalExpand="True" SizeFlagsStretchRatio="6" MinSize="0 100">
|
<PanelContainer VerticalExpand="True" SizeFlagsStretchRatio="1" MinSize="0 150">
|
||||||
<PanelContainer.PanelOverride>
|
<PanelContainer.PanelOverride>
|
||||||
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
|
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
|
||||||
</PanelContainer.PanelOverride>
|
</PanelContainer.PanelOverride>
|
||||||
@@ -66,47 +66,50 @@
|
|||||||
<PanelContainer.PanelOverride>
|
<PanelContainer.PanelOverride>
|
||||||
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
|
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
|
||||||
</PanelContainer.PanelOverride>
|
</PanelContainer.PanelOverride>
|
||||||
<!-- Packaging options -->
|
<!-- Packaging Info -->
|
||||||
<BoxContainer Orientation="Vertical"
|
<BoxContainer Orientation="Vertical"
|
||||||
HorizontalExpand="True">
|
HorizontalExpand="True"
|
||||||
<!-- Packaging Info -->
|
VerticalExpand="True"
|
||||||
<BoxContainer Orientation="Vertical"
|
SeparationOverride="5">
|
||||||
HorizontalExpand="True">
|
<!-- Label for output -->
|
||||||
<BoxContainer Orientation="Horizontal">
|
<BoxContainer Orientation="Horizontal">
|
||||||
<!-- Pills Type Buttons -->
|
<Label Text="{Loc 'chem-master-current-text-label'}" />
|
||||||
<Label Text="{Loc 'chem-master-window-pill-type-label'}"/>
|
<Control HorizontalExpand="True" MinSize="50 0"/>
|
||||||
<Control HorizontalExpand="True"
|
<LineEdit Name="LabelLineEdit" SetWidth="455"/>
|
||||||
MinSize="50 0"></Control>
|
</BoxContainer>
|
||||||
<GridContainer Name="Grid" Columns="10">
|
<!-- Pills Type Buttons -->
|
||||||
<!-- Pills type buttons are generated in the code -->
|
<BoxContainer Orientation="Horizontal">
|
||||||
</GridContainer>
|
<Label Text="{Loc 'chem-master-window-pill-type-label'}"/>
|
||||||
</BoxContainer>
|
<Control HorizontalExpand="True" MinSize="50 0"/>
|
||||||
<BoxContainer Orientation="Horizontal">
|
<GridContainer Name="Grid" Columns="10">
|
||||||
<Label Text="{Loc 'chem-master-window-pills-label'}" />
|
<!-- Pills type buttons are generated in the code -->
|
||||||
<Control HorizontalExpand="True"
|
</GridContainer>
|
||||||
MinSize="50 0" />
|
</BoxContainer>
|
||||||
<SpinBox Name="PillAmount"
|
<BoxContainer Orientation="Horizontal">
|
||||||
Access="Public"
|
<Label Text="{Loc 'chem-master-window-pills-label'}" />
|
||||||
Value="1" />
|
<Control HorizontalExpand="True"
|
||||||
<Button Name="CreatePillButton"
|
MinSize="50 0" />
|
||||||
|
<SpinBox Name="PillAmount"
|
||||||
Access="Public"
|
Access="Public"
|
||||||
Text="{Loc 'chem-master-window-create-pill-button'}" />
|
Value="1" />
|
||||||
<Label Text="{Loc 'chem-master-window-max-pills-volume-text'}"
|
<Button Name="CreatePillButton"
|
||||||
StyleClasses="LabelSecondaryColor" />
|
Access="Public"
|
||||||
</BoxContainer>
|
Text="{Loc 'chem-master-window-create-pill-button'}" />
|
||||||
<BoxContainer Orientation="Horizontal">
|
<Label Text="{Loc 'chem-master-window-max-pills-volume-text'}"
|
||||||
<Label Text="{Loc 'chem-master-window-bottles-label'}" />
|
StyleClasses="LabelSecondaryColor" />
|
||||||
<Control HorizontalExpand="True"
|
</BoxContainer>
|
||||||
MinSize="50 0" />
|
<BoxContainer Orientation="Horizontal">
|
||||||
<SpinBox Name="BottleAmount"
|
<Label Text="{Loc 'chem-master-window-bottles-label'}" />
|
||||||
Access="Public"
|
<Control HorizontalExpand="True"
|
||||||
Value="1" />
|
MinSize="50 0" />
|
||||||
<Button Name="CreateBottleButton"
|
<SpinBox Name="BottleAmount"
|
||||||
Access="Public"
|
Access="Public"
|
||||||
Text="{Loc 'chem-master-window-create-bottle-button'}" />
|
Value="1" />
|
||||||
<Label Text="{Loc 'chem-master-window-max-bottles-volume-text'}"
|
<Button Name="CreateBottleButton"
|
||||||
StyleClasses="LabelSecondaryColor" />
|
Access="Public"
|
||||||
</BoxContainer>
|
Text="{Loc 'chem-master-window-create-bottle-button'}" />
|
||||||
|
<Label Text="{Loc 'chem-master-window-max-bottles-volume-text'}"
|
||||||
|
StyleClasses="LabelSecondaryColor" />
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
</PanelContainer>
|
</PanelContainer>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace Content.Client.Chemistry.UI
|
|||||||
public partial class ChemMasterWindow : SS14Window
|
public partial class ChemMasterWindow : SS14Window
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
public event Action<string>? OnLabelEntered;
|
||||||
public event Action<BaseButton.ButtonEventArgs, ChemButton>? OnChemButtonPressed;
|
public event Action<BaseButton.ButtonEventArgs, ChemButton>? OnChemButtonPressed;
|
||||||
public readonly Button[] PillTypeButtons;
|
public readonly Button[] PillTypeButtons;
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ namespace Content.Client.Chemistry.UI
|
|||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
LabelLineEdit.OnTextEntered += e => OnLabelEntered?.Invoke(e.Text);
|
||||||
|
|
||||||
//Pill type selection buttons, in total there are 20 pills.
|
//Pill type selection buttons, in total there are 20 pills.
|
||||||
//Pill rsi file should have states named as pill1, pill2, and so on.
|
//Pill rsi file should have states named as pill1, pill2, and so on.
|
||||||
@@ -75,7 +77,6 @@ namespace Content.Client.Chemistry.UI
|
|||||||
Group = pillTypeGroup
|
Group = pillTypeGroup
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//Generate buttons textures
|
//Generate buttons textures
|
||||||
var specifier = new SpriteSpecifier.Rsi(resourcePath, "pill" + (i + 1));
|
var specifier = new SpriteSpecifier.Rsi(resourcePath, "pill" + (i + 1));
|
||||||
TextureRect pillTypeTexture = new TextureRect
|
TextureRect pillTypeTexture = new TextureRect
|
||||||
@@ -111,6 +112,7 @@ namespace Content.Client.Chemistry.UI
|
|||||||
{
|
{
|
||||||
var castState = (ChemMasterBoundUserInterfaceState) state;
|
var castState = (ChemMasterBoundUserInterfaceState) state;
|
||||||
Title = castState.DispenserName;
|
Title = castState.DispenserName;
|
||||||
|
LabelLine = castState.Label;
|
||||||
UpdatePanelInfo(castState);
|
UpdatePanelInfo(castState);
|
||||||
if (Contents.Children != null)
|
if (Contents.Children != null)
|
||||||
{
|
{
|
||||||
@@ -194,7 +196,8 @@ namespace Content.Client.Chemistry.UI
|
|||||||
|
|
||||||
if (!state.BufferReagents.Any())
|
if (!state.BufferReagents.Any())
|
||||||
{
|
{
|
||||||
BufferInfo.Children.Add(new Label {Text = Loc.GetString("chem-master-window-buffer-empty-text") });
|
BufferInfo.Children.Add(new Label { Text = Loc.GetString("chem-master-window-buffer-empty-text") });
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,6 +253,18 @@ namespace Content.Client.Chemistry.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String LabelLine
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return LabelLineEdit.Text;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
LabelLineEdit.Text = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ChemButton : Button
|
public class ChemButton : Button
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ using Robust.Shared.Localization;
|
|||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Shared.Log;
|
||||||
|
using Content.Server.Labels.Components;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.Components
|
namespace Content.Server.Chemistry.Components
|
||||||
{
|
{
|
||||||
@@ -41,6 +43,9 @@ namespace Content.Server.Chemistry.Components
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private uint _pillType = 1;
|
private uint _pillType = 1;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
private string _label = "";
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private bool _bufferModeTransfer = true;
|
private bool _bufferModeTransfer = true;
|
||||||
|
|
||||||
@@ -102,9 +107,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||||
{
|
{
|
||||||
if (obj.Session.AttachedEntity == null)
|
if (obj.Session.AttachedEntity == null)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
var msg = (UiActionMessage) obj.Message;
|
var msg = (UiActionMessage) obj.Message;
|
||||||
var needsPower = msg.Action switch
|
var needsPower = msg.Action switch
|
||||||
@@ -138,7 +141,8 @@ namespace Content.Server.Chemistry.Components
|
|||||||
break;
|
break;
|
||||||
case UiAction.CreatePills:
|
case UiAction.CreatePills:
|
||||||
case UiAction.CreateBottles:
|
case UiAction.CreateBottles:
|
||||||
TryCreatePackage(obj.Session.AttachedEntity, msg.Action, msg.PillAmount, msg.BottleAmount);
|
_label = msg.Label;
|
||||||
|
TryCreatePackage(obj.Session.AttachedEntity, msg.Action, msg.Label, msg.PillAmount, msg.BottleAmount);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
@@ -182,13 +186,13 @@ namespace Content.Server.Chemistry.Components
|
|||||||
!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker.Uid, fits.Solution, out var beakerSolution))
|
!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker.Uid, fits.Solution, out var beakerSolution))
|
||||||
{
|
{
|
||||||
return new ChemMasterBoundUserInterfaceState(Powered, false, FixedPoint2.New(0), FixedPoint2.New(0),
|
return new ChemMasterBoundUserInterfaceState(Powered, false, FixedPoint2.New(0), FixedPoint2.New(0),
|
||||||
"", Owner.Name, new List<Solution.ReagentQuantity>(), BufferSolution.Contents, _bufferModeTransfer,
|
"", _label, Owner.Name, new List<Solution.ReagentQuantity>(), BufferSolution.Contents, _bufferModeTransfer,
|
||||||
BufferSolution.TotalVolume, _pillType);
|
BufferSolution.TotalVolume, _pillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ChemMasterBoundUserInterfaceState(Powered, true, beakerSolution.CurrentVolume,
|
return new ChemMasterBoundUserInterfaceState(Powered, true, beakerSolution.CurrentVolume,
|
||||||
beakerSolution.MaxVolume,
|
beakerSolution.MaxVolume,
|
||||||
beaker.Name, Owner.Name, beakerSolution.Contents, BufferSolution.Contents, _bufferModeTransfer,
|
beaker.Name, _label, Owner.Name, beakerSolution.Contents, BufferSolution.Contents, _bufferModeTransfer,
|
||||||
BufferSolution.TotalVolume, _pillType);
|
BufferSolution.TotalVolume, _pillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,26 +264,51 @@ namespace Content.Server.Chemistry.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_label = GenerateLabel();
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryCreatePackage(IEntity user, UiAction action, int pillAmount, int bottleAmount)
|
/// <summary>
|
||||||
|
/// Handles label generation depending from solutions and their amount.
|
||||||
|
/// Label is generated by taking the most significant solution name.
|
||||||
|
/// </summary>
|
||||||
|
private string GenerateLabel()
|
||||||
|
{
|
||||||
|
if (_bufferSolution == null || _bufferSolution.Contents.Count == 0)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
_bufferSolution.Contents.Sort();
|
||||||
|
return _bufferSolution.Contents[_bufferSolution.Contents.Count - 1].ReagentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TryCreatePackage(IEntity user, UiAction action, string label, int pillAmount, int bottleAmount)
|
||||||
{
|
{
|
||||||
if (BufferSolution.TotalVolume == 0)
|
if (BufferSolution.TotalVolume == 0)
|
||||||
|
{
|
||||||
|
user.PopupMessageCursor(Loc.GetString("chem-master-window-buffer-empty-text"));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (action == UiAction.CreateBottles)
|
if (action == UiAction.CreateBottles)
|
||||||
{
|
{
|
||||||
var individualVolume = BufferSolution.TotalVolume / FixedPoint2.New(bottleAmount);
|
var individualVolume = BufferSolution.TotalVolume / FixedPoint2.New(bottleAmount);
|
||||||
if (individualVolume < FixedPoint2.New(1))
|
if (individualVolume < FixedPoint2.New(1))
|
||||||
|
{
|
||||||
|
user.PopupMessageCursor(Loc.GetString("chem-master-window-buffer-low-text"));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(30));
|
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(30));
|
||||||
for (int i = 0; i < bottleAmount; i++)
|
for (int i = 0; i < bottleAmount; i++)
|
||||||
{
|
{
|
||||||
var bottle = Owner.EntityManager.SpawnEntity("ChemistryEmptyBottle01", Owner.Transform.Coordinates);
|
var bottle = Owner.EntityManager.SpawnEntity("ChemistryEmptyBottle01", Owner.Transform.Coordinates);
|
||||||
|
|
||||||
|
//Adding label
|
||||||
|
LabelComponent labelComponent = bottle.EnsureComponent<LabelComponent>();
|
||||||
|
labelComponent.OriginalName = bottle.Name;
|
||||||
|
bottle.Name += $" ({label})";
|
||||||
|
labelComponent.CurrentLabel = label;
|
||||||
|
|
||||||
var bufferSolution = BufferSolution.SplitSolution(actualVolume);
|
var bufferSolution = BufferSolution.SplitSolution(actualVolume);
|
||||||
var bottleSolution = EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(bottle.Uid, "drink");
|
var bottleSolution = EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(bottle.Uid, "drink");
|
||||||
|
|
||||||
@@ -306,15 +335,23 @@ namespace Content.Server.Chemistry.Components
|
|||||||
{
|
{
|
||||||
var individualVolume = BufferSolution.TotalVolume / FixedPoint2.New(pillAmount);
|
var individualVolume = BufferSolution.TotalVolume / FixedPoint2.New(pillAmount);
|
||||||
if (individualVolume < FixedPoint2.New(1))
|
if (individualVolume < FixedPoint2.New(1))
|
||||||
|
{
|
||||||
|
user.PopupMessageCursor(Loc.GetString("chem-master-window-buffer-low-text"));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(50));
|
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(50));
|
||||||
for (int i = 0; i < pillAmount; i++)
|
for (int i = 0; i < pillAmount; i++)
|
||||||
{
|
{
|
||||||
var pill = Owner.EntityManager.SpawnEntity("pill", Owner.Transform.Coordinates);
|
var pill = Owner.EntityManager.SpawnEntity("pill", Owner.Transform.Coordinates);
|
||||||
|
|
||||||
var bufferSolution = BufferSolution.SplitSolution(actualVolume);
|
//Adding label
|
||||||
|
LabelComponent labelComponent = pill.EnsureComponent<LabelComponent>();
|
||||||
|
labelComponent.OriginalName = pill.Name;
|
||||||
|
pill.Name += $" ({label})";
|
||||||
|
labelComponent.CurrentLabel = label;
|
||||||
|
|
||||||
|
var bufferSolution = BufferSolution.SplitSolution(actualVolume);
|
||||||
var pillSolution = EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(pill.Uid, "food");
|
var pillSolution = EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(pill.Uid, "food");
|
||||||
EntitySystem.Get<SolutionContainerSystem>().TryAddSolution(pill.Uid, pillSolution, bufferSolution);
|
EntitySystem.Get<SolutionContainerSystem>().TryAddSolution(pill.Uid, pillSolution, bufferSolution);
|
||||||
|
|
||||||
@@ -343,6 +380,9 @@ namespace Content.Server.Chemistry.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_bufferSolution?.Contents.Count == 0)
|
||||||
|
_label = "";
|
||||||
|
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
public readonly FixedPoint2 BeakerCurrentVolume;
|
public readonly FixedPoint2 BeakerCurrentVolume;
|
||||||
public readonly FixedPoint2 BeakerMaxVolume;
|
public readonly FixedPoint2 BeakerMaxVolume;
|
||||||
public readonly string ContainerName;
|
public readonly string ContainerName;
|
||||||
|
public readonly string Label;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of the reagents and their amounts within the beaker/reagent container, if applicable.
|
/// A list of the reagents and their amounts within the beaker/reagent container, if applicable.
|
||||||
@@ -45,7 +46,7 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
public readonly FixedPoint2 BufferCurrentVolume;
|
public readonly FixedPoint2 BufferCurrentVolume;
|
||||||
public readonly uint SelectedPillType;
|
public readonly uint SelectedPillType;
|
||||||
|
|
||||||
public ChemMasterBoundUserInterfaceState(bool hasPower, bool hasBeaker, FixedPoint2 beakerCurrentVolume, FixedPoint2 beakerMaxVolume, string containerName,
|
public ChemMasterBoundUserInterfaceState(bool hasPower, bool hasBeaker, FixedPoint2 beakerCurrentVolume, FixedPoint2 beakerMaxVolume, string containerName, string label,
|
||||||
string dispenserName, IReadOnlyList<Solution.ReagentQuantity> containerReagents, IReadOnlyList<Solution.ReagentQuantity> bufferReagents, bool bufferModeTransfer, FixedPoint2 bufferCurrentVolume, uint selectedPillType)
|
string dispenserName, IReadOnlyList<Solution.ReagentQuantity> containerReagents, IReadOnlyList<Solution.ReagentQuantity> bufferReagents, bool bufferModeTransfer, FixedPoint2 bufferCurrentVolume, uint selectedPillType)
|
||||||
{
|
{
|
||||||
HasPower = hasPower;
|
HasPower = hasPower;
|
||||||
@@ -53,6 +54,7 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
BeakerCurrentVolume = beakerCurrentVolume;
|
BeakerCurrentVolume = beakerCurrentVolume;
|
||||||
BeakerMaxVolume = beakerMaxVolume;
|
BeakerMaxVolume = beakerMaxVolume;
|
||||||
ContainerName = containerName;
|
ContainerName = containerName;
|
||||||
|
Label = label;
|
||||||
DispenserName = dispenserName;
|
DispenserName = dispenserName;
|
||||||
ContainerReagents = containerReagents;
|
ContainerReagents = containerReagents;
|
||||||
BufferReagents = bufferReagents;
|
BufferReagents = bufferReagents;
|
||||||
@@ -72,11 +74,12 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
public readonly FixedPoint2 Amount;
|
public readonly FixedPoint2 Amount;
|
||||||
public readonly string Id = "";
|
public readonly string Id = "";
|
||||||
public readonly bool IsBuffer;
|
public readonly bool IsBuffer;
|
||||||
|
public readonly string Label = "";
|
||||||
public readonly uint PillType;
|
public readonly uint PillType;
|
||||||
public readonly int PillAmount;
|
public readonly int PillAmount;
|
||||||
public readonly int BottleAmount;
|
public readonly int BottleAmount;
|
||||||
|
|
||||||
public UiActionMessage(UiAction action, FixedPoint2? amount, string? id, bool? isBuffer, uint? pillType, int? pillAmount, int? bottleAmount)
|
public UiActionMessage(UiAction action, FixedPoint2? amount, string? id, bool? isBuffer, string? label, uint? pillType, int? pillAmount, int? bottleAmount)
|
||||||
{
|
{
|
||||||
Action = action;
|
Action = action;
|
||||||
if (Action == UiAction.ChemButton)
|
if (Action == UiAction.ChemButton)
|
||||||
@@ -91,13 +94,22 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
Id = id;
|
Id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
isBuffer = isBuffer.GetValueOrDefault();
|
IsBuffer = isBuffer.GetValueOrDefault();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PillAmount = pillAmount.GetValueOrDefault();
|
PillAmount = pillAmount.GetValueOrDefault();
|
||||||
PillType = pillType.GetValueOrDefault();
|
PillType = pillType.GetValueOrDefault();
|
||||||
BottleAmount = bottleAmount.GetValueOrDefault();
|
BottleAmount = bottleAmount.GetValueOrDefault();
|
||||||
|
|
||||||
|
if (label == null)
|
||||||
|
{
|
||||||
|
Label = "null";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Label = label;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ chem-master-window-buffer-text = Buffer
|
|||||||
chem-master-window-buffer-label = buffer:
|
chem-master-window-buffer-label = buffer:
|
||||||
chem-master-window-buffer-all-amount = All
|
chem-master-window-buffer-all-amount = All
|
||||||
chem-master-window-buffer-empty-text = Buffer empty.
|
chem-master-window-buffer-empty-text = Buffer empty.
|
||||||
|
chem-master-window-buffer-low-text = Not enough solution in buffer
|
||||||
chem-master-window-transfer-button = Transfer
|
chem-master-window-transfer-button = Transfer
|
||||||
chem-master-window-discard-button = Discard
|
chem-master-window-discard-button = Discard
|
||||||
chem-master-window-packaging-text = Packaging
|
chem-master-window-packaging-text = Packaging
|
||||||
|
chem-master-current-text-label = Label:
|
||||||
chem-master-window-pills-label = Pills:
|
chem-master-window-pills-label = Pills:
|
||||||
chem-master-window-pill-type-label = Pill type:
|
chem-master-window-pill-type-label = Pill type:
|
||||||
chem-master-window-max-pills-volume-text = max 50u/each
|
chem-master-window-max-pills-volume-text = max 50u/each
|
||||||
|
|||||||
Reference in New Issue
Block a user