Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Work In Progress] Kitchen lite #748

Draft
wants to merge 52 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
3c13f9d
Add instrument type and recipe prototypes
TheArturZh Aug 28, 2023
a3bfad7
Added test recipe
TheArturZh Aug 28, 2023
1a76c04
Cooking machine implementation start
TheArturZh Aug 28, 2023
43001e8
Kitchen development
TheArturZh Aug 28, 2023
fdc1393
kitchen dev
TheArturZh Aug 29, 2023
2fd3583
kitchen dev 2
TheArturZh Aug 29, 2023
c634715
Implemented generic cooking machine
TheArturZh Aug 29, 2023
619d7e9
Add CLA
TheArturZh Aug 29, 2023
6225ca3
Fix microwave yml
TheArturZh Aug 30, 2023
23fc7cc
Add microwave-specific functionality to new one
TheArturZh Aug 30, 2023
b1b35c9
Added new machines
TheArturZh Aug 30, 2023
ba91543
Fix yml
TheArturZh Aug 30, 2023
acc26aa
Port all recipes
TheArturZh Aug 30, 2023
56ef45e
Today I shit myself, to see if I still REEEEEEEEEEEEEEEE
TheArturZh Aug 30, 2023
3ed958a
Machines now heat stuff up & grill can cook meat
TheArturZh Aug 31, 2023
db0a3e1
Added autogenerated cookbook
TheArturZh Aug 31, 2023
8d4173f
Added different sounds to new machines
TheArturZh Sep 1, 2023
bfbdda5
Update kitchen to master
TheArturZh Sep 16, 2023
5032f28
Fix build
TheArturZh Oct 9, 2023
78007c2
fix build
TheArturZh Nov 7, 2023
2b5c171
forgetti about tacos for now
TheArturZh Nov 26, 2023
d74fa97
new oven sprite
TheArturZh Nov 26, 2023
ecec2af
Oven functions like closet
TheArturZh Nov 26, 2023
f91b957
Oven fixes
TheArturZh Nov 26, 2023
728a6c9
fix oven board
TheArturZh Nov 26, 2023
3956ca7
fix tests
TheArturZh Nov 26, 2023
e67f291
minor fixes
TheArturZh Nov 28, 2023
9e85123
build fixes
TheArturZh Feb 17, 2024
5fc2938
fix construction
TheArturZh Feb 17, 2024
1c8b34e
Revert "Remove gondola donkpocket & change berry box description (#24…
TheArturZh Feb 17, 2024
b8e20fb
Merge remote-tracking branch 'upstream/master' into pr/748
Kirus59 Oct 18, 2024
2b6576d
Merge branch 'master' into kitchen-lite
Kirus59 Oct 18, 2024
6090995
fix-checks
Kirus59 Oct 18, 2024
ceaa454
UI-component-fixes
Kirus59 Oct 18, 2024
0296e7c
fix-MachineBoards-and-Recipes
Kirus59 Oct 18, 2024
1ca98b0
containers-fixes
Kirus59 Oct 18, 2024
baedce5
remove-default-microwave
Kirus59 Oct 18, 2024
19d5a54
Merge branch 'master' into pr/748
Kirus59 Jan 4, 2025
2f25690
Add new recipes
Kirus59 Jan 4, 2025
065be24
Add secret recipes
Kirus59 Jan 4, 2025
76c3695
ui & fixture fixes
Kirus59 Jan 4, 2025
561b845
add cooking by signal
Kirus59 Jan 4, 2025
d27f721
fix obsolete code
Kirus59 Jan 4, 2025
c2c1aa2
...
Kirus59 Jan 4, 2025
7401a35
....
Kirus59 Jan 4, 2025
70c3609
add ent sprites into recipe guidebook
Kirus59 Jan 4, 2025
e441330
Add recipes groups
Kirus59 Jan 5, 2025
842c6e0
Merge remote-tracking branch 'upstream/master' into pr/748
Kirus59 Jan 5, 2025
f3fa383
Destruction fixes
Kirus59 Jan 5, 2025
17c9108
add oven name
Kirus59 Jan 5, 2025
5094de6
destruction fix
Kirus59 Jan 5, 2025
8a03d76
change oven
Kirus59 Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Shared.SS220.SupaKitchen.Components;

namespace Content.Client.SS220.SupaKitchen.Components;

[RegisterComponent]
public sealed partial class CookingConstantlyComponent : SharedCookingConstantlyComponent
{
[DataField]
public string ActiveState = "oven_on";
[DataField]
public string NonActiveState = "oven_off";
}
126 changes: 126 additions & 0 deletions Content.Client/SS220/SupaKitchen/CookingMachineBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Shared.Chemistry.Reagent;
using Content.Shared.SS220.SupaKitchen;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;

namespace Content.Client.SS220.SupaKitchen.UI
{
[UsedImplicitly]
public sealed class CookingMachineBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private CookingMachineWindow? _menu;

[ViewVariables]
private readonly Dictionary<int, EntityUid> _solids = new();

[ViewVariables]
private readonly Dictionary<int, ReagentQuantity> _reagents = new();

private IEntityManager _entManager;

public CookingMachineBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
_entManager = IoCManager.Resolve<IEntityManager>();
}

protected override void Open()
{
base.Open();
_menu = new CookingMachineWindow(this);
_menu.OpenCentered();
_menu.OnClose += Close;
_menu.StartButton.OnPressed += _ => SendMessage(new CookingMachineStartCookMessage());
_menu.EjectButton.OnPressed += _ => SendMessage(new CookingMachineEjectMessage());
_menu.IngredientsList.OnItemSelected += args =>
{
SendMessage(new CookingMachineEjectSolidIndexedMessage(_entManager.GetNetEntity(_solids[args.ItemIndex])));
};

_menu.OnCookTimeSelected += (args, buttonIndex) =>
{
var actualButton = (CookingMachineWindow.MicrowaveCookTimeButton) args.Button;
SendMessage(new CookingMachineSelectCookTimeMessage(buttonIndex, actualButton.CookTime));
};
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

if (!disposing)
return;

_solids.Clear();
_menu?.Dispose();
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not CookingMachineUpdateUserInterfaceState cState)
{
return;
}

if (cState.MachineState is CookingMachineState.Idle)
_menu?.ToggleBusyDisableOverlayPanel(false);
else
_menu?.ToggleBusyDisableOverlayPanel(true);

RefreshContentsDisplay(_entManager.GetEntityArray(cState.ContainedSolids));

if (_menu == null) return;

var currentlySelectedTimeButton = (Button) _menu.CookTimeButtonVbox.GetChild(cState.ActiveButtonIndex);
currentlySelectedTimeButton.Pressed = true;
var cookTime = cState.ActiveButtonIndex == 0
? Loc.GetString("cooking-machine-menu-instant-button")
: cState.CurrentCookTime.ToString();
_menu.CookTimeInfoLabel.Text = Loc.GetString("cooking-machine-bound-user-interface-cook-time-label",
("time", cookTime));

_menu.EjectButton.Visible = !cState.EjectUnavailable;
}

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);
}
}
}
}
8 changes: 8 additions & 0 deletions Content.Client/SS220/SupaKitchen/CookingMachineVIsual.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
namespace Content.Client.SS220.SupaKitchen;

public enum CookingMachineVisualizerLayers : byte
{
Base,
BaseUnlit
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Client.SS220.SupaKitchen.Components;
using Content.Shared.SS220.SupaKitchen.Components;
using Content.Shared.SS220.SupaKitchen.Systems;
using Content.Shared.Storage.Components;
using Robust.Client.GameObjects;
using Robust.Shared.GameStates;

namespace Content.Client.SS220.SupaKitchen.Systems;

public sealed partial class CookingConstantlySystem : SharedCookingConstantlySystem
{
[Dependency] private readonly AppearanceSystem _appearance = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<CookingConstantlyComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<CookingConstantlyComponent, ComponentHandleState>(OnHandleState);

SubscribeLocalEvent<CookingConstantlyComponent, StorageOpenAttemptEvent>(OnStorageOpenAttempt);
SubscribeLocalEvent<CookingConstantlyComponent, StorageCloseAttemptEvent>(OnStorageCloseAttempt);
SubscribeLocalEvent<CookingConstantlyComponent, StorageAfterOpenEvent>(OnStorageOpen);

SubscribeLocalEvent<CookingConstantlyComponent, AppearanceChangeEvent>(OnAppearanceChange);
}

private void OnAppearanceChange(Entity<CookingConstantlyComponent> entity, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;

if (!_appearance.TryGetData<bool>(entity, CookingConstantlyVisuals.Active, out var isActive))
return;

var state = isActive ? entity.Comp.ActiveState : entity.Comp.NonActiveState;
args.Sprite.LayerSetState(CookingConstantlyVisuals.Active, state);
args.Sprite.LayerSetVisible(CookingConstantlyVisuals.ActiveUnshaded, isActive);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!-- © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt -->
<BoxContainer xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Orientation="Vertical"
Margin="5 5 5 5">
<PanelContainer HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="1.5" BorderColor="#777777"/>
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical">
<PanelContainer Name="NameBackground" HorizontalExpand="True" VerticalExpand="False">
<RichTextLabel Name="RecipeLabelTitle" HorizontalAlignment="Center"/>
</PanelContainer>

<BoxContainer Name="RecipeContainer" HorizontalExpand="True" Orientation="Vertical">
<!-- <Label Name="RecipeName" Text="{Loc 'guidebook-reagent-recipes-header'}"/> -->
<BoxContainer Name="RecipesDescriptionContainer"
Margin="10 0 10 0"
Orientation="Horizontal"
HorizontalAlignment="Stretch"
HorizontalExpand="True">
<BoxContainer Name="IngredientsContainer" Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
</BoxContainer>
<BoxContainer Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10 0">
<TextureRect
Name="InstrumentIcon"
TexturePath="/Textures/Interface/Misc/beakerlarge.png"
Stretch="KeepCentered"/>
<RichTextLabel Name="InstrumentName"
HorizontalAlignment="Center"/>
</BoxContainer>
<BoxContainer Name="ProductsContainer" Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
</BoxContainer>
</BoxContainer>
</BoxContainer>

</BoxContainer>
</PanelContainer>
</BoxContainer>
Loading
Loading