This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
forked from new-frontiers-14/frontier-station-14
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate microwave recipes into multiple machines (electric range, as…
…sembler, medical assembler) (new-frontiers-14#1935) * Oven, first pass * Fix oven range * Fix the oven range * EntityHeater: passive power draw * Add placeholder assembler * Microwave recipe types (machine restrictions) * Add canHeat/canIrradiate to Microwave * Port EE#783 (Thank you, Mnemotechnician) * Revert machine type changes to meal recipes * Unneeded dependencies, show search bar * Remove yet more microwave recipe machine types * Multiple devices per recipe * Food recipe guidebook: cleanup, style consistency * Frontier comment cleanup * Assembler UI proof of concept * Assembler UI rework, fix recipes, mediwave layer * Add machines to kitchen shuttles/POIs * NFSD POI microwave * Resolve GuideFoodSource merge conflicts * Assembler sounds * techs, "food-o-mat", minor fixes * Update mccargo.yml * Move this * Syndicate Oven Baseline * Donk co. range sprite * Syndicate Range * Update cove.yml * Update dungeon_items_kitchen.yml * Add syndicate texture --------- Co-authored-by: Dvir <[email protected]> Co-authored-by: Dvir <[email protected]>
- Loading branch information
1 parent
05da717
commit 2479231
Showing
94 changed files
with
2,163 additions
and
1,106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
Content.Client/_NF/Kitchen/UI/AssemblerBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
using Content.Shared._NF.Kitchen.Components; | ||
using Content.Shared.Chemistry.Reagent; | ||
using Content.Shared.Kitchen.Components; | ||
using JetBrains.Annotations; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client._NF.Kitchen.UI | ||
{ | ||
[UsedImplicitly] | ||
public sealed class AssemblerBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
private AssemblerMenu? _menu; | ||
|
||
[ViewVariables] | ||
private readonly Dictionary<int, EntityUid> _solids = new(); | ||
|
||
[ViewVariables] | ||
private readonly Dictionary<int, ReagentQuantity> _reagents = new(); | ||
|
||
private readonly string _menuTitle; | ||
private readonly string _leftFlavorText; | ||
|
||
public AssemblerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
if ((MicrowaveUiKey)uiKey == MicrowaveUiKey.MedicalAssemblerKey) | ||
{ | ||
_menuTitle = "assembler-menu-medical-title"; | ||
_leftFlavorText = "assembler-menu-medical-footer-flavor-left"; | ||
} | ||
else | ||
{ | ||
_menuTitle = "assembler-menu-title"; | ||
_leftFlavorText = "assembler-menu-footer-flavor-left"; | ||
} | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
_menu = this.CreateWindow<AssemblerMenu>(); | ||
_menu.StartButton.OnPressed += _ => SendPredictedMessage(new AssemblerStartCookMessage()); | ||
_menu.EjectButton.OnPressed += _ => SendPredictedMessage(new MicrowaveEjectMessage()); | ||
_menu.IngredientsList.OnItemSelected += args => | ||
{ | ||
SendPredictedMessage(new MicrowaveEjectSolidIndexedMessage(EntMan.GetNetEntity(_solids[args.ItemIndex]))); | ||
}; | ||
|
||
_menu.Title = Loc.GetString(_menuTitle); | ||
_menu.LeftFooter.Text = Loc.GetString(_leftFlavorText); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
if (state is not MicrowaveUpdateUserInterfaceState cState || _menu == null) | ||
{ | ||
return; | ||
} | ||
|
||
_menu.IsBusy = cState.IsMicrowaveBusy; | ||
_menu.CurrentCooktimeEnd = cState.CurrentCookTimeEnd; | ||
|
||
_menu.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy || cState.ContainedSolids.Length == 0); | ||
// TODO move this to a component state and ensure the net ids. | ||
RefreshContentsDisplay(EntMan.GetEntityArray(cState.ContainedSolids)); | ||
|
||
//Set the cook time info label | ||
var cookTime = cState.CurrentCookTime.ToString(); | ||
|
||
_menu.CookTimeInfoLabel.Text = Loc.GetString("assembler-bound-user-interface-insert-ingredients"); | ||
_menu.StartButton.Disabled = cState.IsMicrowaveBusy || cState.ContainedSolids.Length == 0; | ||
_menu.EjectButton.Disabled = cState.IsMicrowaveBusy || cState.ContainedSolids.Length == 0; | ||
|
||
//Set the "micowave light" ui color to indicate if the microwave is busy or not | ||
if (cState.IsMicrowaveBusy && cState.ContainedSolids.Length > 0) | ||
{ | ||
_menu.IngredientsPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#947300") }; | ||
} | ||
else | ||
{ | ||
_menu.IngredientsPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#1B1B1E") }; | ||
} | ||
} | ||
|
||
private void RefreshContentsDisplay(EntityUid[] containedSolids) | ||
{ | ||
_reagents.Clear(); | ||
|
||
if (_menu == null) return; | ||
|
||
_solids.Clear(); | ||
_menu.IngredientsList.Clear(); | ||
foreach (var entity in containedSolids) | ||
{ | ||
if (EntMan.Deleted(entity)) | ||
{ | ||
return; | ||
} | ||
|
||
// TODO just use sprite view | ||
|
||
Texture? texture; | ||
if (EntMan.TryGetComponent<IconComponent>(entity, out var iconComponent)) | ||
{ | ||
texture = EntMan.System<SpriteSystem>().GetIcon(iconComponent); | ||
} | ||
else if (EntMan.TryGetComponent<SpriteComponent>(entity, out var spriteComponent)) | ||
{ | ||
texture = spriteComponent.Icon?.Default; | ||
} | ||
else | ||
{ | ||
continue; | ||
} | ||
|
||
var solidItem = _menu.IngredientsList.AddItem(EntMan.GetComponent<MetaDataComponent>(entity).EntityName, texture); | ||
var solidIndex = _menu.IngredientsList.IndexOf(solidItem); | ||
_solids.Add(solidIndex, entity); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<controls:FancyWindow | ||
xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
xmlns:style="clr-namespace:Content.Client.Stylesheets" | ||
Title="{Loc 'assembler-menu-title'}" | ||
MinWidth="512" | ||
MinSize="512 256"> | ||
<BoxContainer Orientation="Vertical"> | ||
<BoxContainer Orientation="Horizontal" > | ||
<PanelContainer | ||
Name="IngredientsPanel" | ||
Access="Public" | ||
MinSize="300 128" | ||
Margin="5 5"> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" /> | ||
</PanelContainer.PanelOverride> | ||
<ItemList | ||
Name="IngredientsList" | ||
Access="Public" | ||
Margin="5 5" | ||
VerticalExpand="True" | ||
HorizontalExpand="True" | ||
StyleClasses="transparentBackgroundItemList" | ||
SelectMode="Button" | ||
SizeFlagsStretchRatio="3" | ||
ItemSeparation="5" | ||
MinSize="100 128"> | ||
<!-- Ingredients are added here by code --> | ||
</ItemList> | ||
</PanelContainer> | ||
<BoxContainer | ||
Orientation="Vertical" | ||
MinWidth="170" | ||
Margin="10 10" | ||
VerticalExpand="True" | ||
HorizontalExpand="True"> | ||
<PanelContainer | ||
VerticalExpand="True" | ||
HorizontalExpand="True"> | ||
<PanelContainer | ||
VerticalExpand="True" | ||
ModulateSelfOverride="#FF0000" | ||
MinSize="100 256"> | ||
<BoxContainer Orientation="Vertical"> | ||
<Label | ||
Name="CookTimeInfoLabel" | ||
Access="Public" | ||
Align="Center" | ||
Modulate="#FFFFFF" | ||
VAlign="Center" /> | ||
<BoxContainer Orientation="Vertical"> | ||
<BoxContainer | ||
Orientation="Vertical" | ||
Align="Center" | ||
SizeFlagsStretchRatio="3"> | ||
<Control MinSize="0 15" /> | ||
<Button | ||
Name="StartButton" | ||
Access="Public" | ||
Text="{Loc 'assembler-menu-start-button'}" | ||
StyleClasses="ButtonColorGreen" | ||
TextAlign="Center" /> | ||
<Button | ||
Name="EjectButton" | ||
Access="Public" | ||
Text="{Loc 'microwave-menu-eject-all-text'}" | ||
ToolTip="{Loc 'microwave-menu-eject-all-tooltip'}" | ||
StyleClasses="ButtonColorRed" | ||
TextAlign="Center" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</PanelContainer> | ||
</PanelContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
<!-- Footer --> | ||
<BoxContainer Orientation="Vertical"> | ||
<PanelContainer StyleClasses="LowDivider" /> | ||
<BoxContainer Orientation="Horizontal" Margin="10 2 5 0" VerticalAlignment="Bottom"> | ||
<Label Text="{Loc 'assembler-menu-footer-flavor-left'}" StyleClasses="WindowFooterText" Name="LeftFooter" Access="Public"/> | ||
<Label Text="{Loc 'assembler-menu-footer-flavor-right'}" StyleClasses="WindowFooterText" | ||
HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 5 0" /> | ||
<TextureRect StyleClasses="NTLogoDark" Stretch="KeepAspectCentered" VerticalAlignment="Center" HorizontalAlignment="Right" SetSize="19 19"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
<PanelContainer Name="DisableCookingPanelOverlay" MouseFilter="Stop"> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E66" /> | ||
</PanelContainer.PanelOverride> | ||
</PanelContainer> | ||
</controls:FancyWindow> |
Oops, something went wrong.