Microwave rework (#6470)

This commit is contained in:
mirrorcult
2022-02-12 17:53:54 -07:00
committed by GitHub
parent be853b2529
commit 9adfde9ee3
16 changed files with 243 additions and 196 deletions

View File

@@ -42,11 +42,6 @@ namespace Content.Client.Kitchen.UI
SendMessage(new MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex]));
};
_menu.IngredientsListReagents.OnItemSelected += args =>
{
SendMessage(new MicrowaveVaporizeReagentIndexedMessage(_reagents[args.ItemIndex]));
};
_menu.OnCookTimeSelected += (args,buttonIndex) =>
{
var actualButton = (MicrowaveMenu.MicrowaveCookTimeButton) args.Button ;
@@ -77,7 +72,7 @@ namespace Content.Client.Kitchen.UI
}
_menu?.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy);
RefreshContentsDisplay(cState.ReagentQuantities, cState.ContainedSolids);
RefreshContentsDisplay(cState.ContainedSolids);
if (_menu == null) return;
@@ -90,22 +85,12 @@ namespace Content.Client.Kitchen.UI
("time", cookTime));
}
private void RefreshContentsDisplay(Solution.ReagentQuantity[] reagents, EntityUid[] containedSolids)
private void RefreshContentsDisplay(EntityUid[] containedSolids)
{
_reagents.Clear();
if (_menu == null) return;
_menu.IngredientsListReagents.Clear();
for (var i = 0; i < reagents.Length; i++)
{
if (!_prototypeManager.TryIndex(reagents[i].ReagentId, out ReagentPrototype? proto)) continue;
var reagentAdded = _menu.IngredientsListReagents.AddItem($"{reagents[i].Quantity} {proto.Name}");
var reagentIndex = _menu.IngredientsListReagents.IndexOf(reagentAdded);
_reagents.Add(reagentIndex, reagents[i]);
}
_solids.Clear();
_menu.IngredientsList.Clear();
foreach (var entity in containedSolids)