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 66 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 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
8ef1d27
Merge branch 'master' into pr/748
Kirus59 Jan 26, 2025
1483806
add recipe assembler
Kirus59 Jan 26, 2025
d3042a6
fix SubtractContents
Kirus59 Jan 26, 2025
b3ecc22
cooking instrument changes & components renaming
Kirus59 Feb 9, 2025
0dac93c
csproj fix
Kirus59 Feb 9, 2025
28d8a7b
Merge branch 'master' into pr/748
Kirus59 Feb 16, 2025
aac8649
Update old microwave
Kirus59 Feb 16, 2025
2154aca
Supa microwave changes (UI & system cleaning)
Kirus59 Feb 16, 2025
6e98b08
Add microwave explosion & sparks
Kirus59 Feb 16, 2025
f73a93f
Merge branch 'master' into pr/748
Kirus59 Feb 22, 2025
ddbcb31
add id card microwave mechanic
Kirus59 Feb 22, 2025
59603a8
some cleaning
Kirus59 Feb 22, 2025
e882d69
rework chopping board
Kirus59 Feb 22, 2025
bac4f3e
Add raw food
Kirus59 Feb 22, 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
13 changes: 13 additions & 0 deletions Content.Client/SS220/SupaKitchen/Components/OvenComponent.cs
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 OvenComponent : SharedOvenComponent
{
[DataField]
public string ActiveState = "oven_on";
[DataField]
public string NonActiveState = "oven_off";
}
8 changes: 8 additions & 0 deletions Content.Client/SS220/SupaKitchen/SupaMicrowaveVIsual.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 SupaMicrowaveVisualizerLayers : byte
{
Base,
BaseUnlit
}
50 changes: 50 additions & 0 deletions Content.Client/SS220/SupaKitchen/Systems/OvenSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// © 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 OvenSystem : SharedOvenSystem
{
[Dependency] private readonly AppearanceSystem _appearance = default!;

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

SubscribeLocalEvent<OvenComponent, ComponentHandleState>(OnHandleState);

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

SubscribeLocalEvent<OvenComponent, AppearanceChangeEvent>(OnAppearanceChange);
}

private void OnHandleState(Entity<OvenComponent> entity, ref ComponentHandleState args)
{
if (args.Current is not OvenComponentState state)
return;

entity.Comp.LastState = state.LastState;
entity.Comp.CurrentState = state.CurrentState;
entity.Comp.PlayingStream = state.PlayingStream;
}

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

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

var state = isActive ? entity.Comp.ActiveState : entity.Comp.NonActiveState;
args.Sprite.LayerSetState(OvenVisuals.Active, state);
args.Sprite.LayerSetVisible(OvenVisuals.ActiveUnshaded, isActive);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Content.Shared.SS220.SupaKitchen.Systems;

namespace Content.Client.SS220.SupaKitchen.Systems;

public sealed partial class RecipeAssemblerSystem : SharedRecipeAssemblerSystem
{
}
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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;
using Content.Client.Guidebook.Controls;
using Content.Client.Guidebook.Richtext;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Content.Shared.SS220.SupaKitchen;
using Content.Client.Message;
using Robust.Shared.Utility;
using Content.Shared.Chemistry.Reagent;
using Robust.Client.GameObjects;
using Content.Shared.FixedPoint;

namespace Content.Client.SS220.SupaKitchen.UI.Controls;

/// <summary>
/// Control for embedding a reagent into a guidebook.
/// </summary>
[UsedImplicitly, GenerateTypedNameReferences]
public sealed partial class GuideCookingRecipeEmbed : BoxContainer, IDocumentTag, ISearchableControl
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IEntitySystemManager _entSysmMan = default!;

private readonly SpriteSystem _spriteSystem;

private HashSet<string> _nameSearchCache;

private readonly ISawmill _sawmill;

public GuideCookingRecipeEmbed()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_spriteSystem = _entSysmMan.GetEntitySystem<SpriteSystem>();

MouseFilter = MouseFilterMode.Stop;
_sawmill = Logger.GetSawmill("KitchenCookbook");

_nameSearchCache = new();
}

public GuideCookingRecipeEmbed(CookingRecipePrototype recipe) : this()
{
GenerateControl(recipe);
}

// uhhh shit i'm not sure about the performance
public bool CheckMatchesSearch(string query)
{
foreach (var match in _nameSearchCache)
{
if (match.Contains(query))
return true;
}

return false;
}

public void SetHiddenState(bool state, string query)
{
this.Visible = CheckMatchesSearch(query) ? state : !state;
}

public bool TryParseTag(Dictionary<string, string> args, [NotNullWhen(true)] out Control? control)
{
control = null;
if (!args.TryGetValue("Recipe", out var id))
{
_sawmill.Error("Recipe embed tag is missing reagent prototype argument");
return false;
}

if (!_prototype.TryIndex<CookingRecipePrototype>(id, out var recipe))
{
_sawmill.Error($"Specified CookingRecipe prototype \"{id}\" is not a valid CookingRecipe prototype");
return false;
}

GenerateControl(recipe);

control = this;
return true;
}

private void GenerateControl(CookingRecipePrototype recipe)
{
if (!_prototype.TryIndex<EntityPrototype>(recipe.Result, out var product))
return;

_nameSearchCache.Add(product.Name);
RecipeLabelTitle.SetMarkup(product.Name);
//RecipeLabelTitle.SetMarkup(recipe.Name);

// reagents
var reagentsMsg = new FormattedMessage();
var reagentIngredientsCount = recipe.IngredientsReagents.Count;
var u = 0;
var reagentsLabel = new RichTextLabel()
{
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
foreach (var (ingredientId, ingredientAmount) in recipe.IngredientsReagents)
{
if (!_prototype.TryIndex<ReagentPrototype>(ingredientId, out var ingredientProto))
{
reagentIngredientsCount--;
continue;
}

var ingredientName = ingredientProto.LocalizedName;
_nameSearchCache.Add(ingredientName);

reagentsMsg.AddMarkupOrThrow(Loc.GetString("guidebook-cooking-recipes-ingredient-display",
("reagent", ingredientName), ("ratio", ingredientAmount)));

u++;
if (u < reagentIngredientsCount)
reagentsMsg.PushNewline();
}

if (!reagentsMsg.IsEmpty)
{
reagentsMsg.Pop();
reagentsLabel.SetMessage(reagentsMsg);
IngredientsContainer.AddChild(reagentsLabel);
}

// solid ingredients
foreach (var (ingredientId, ingredientAmount) in recipe.IngredientsSolids)
{
if (!_prototype.TryIndex<EntityPrototype>(ingredientId, out var ingredientProto))
continue;

var ingredientName = ingredientProto.Name;
_nameSearchCache.Add(ingredientName);

IngredientsContainer.AddChild(GetEntContainer(ingredientProto, ingredientAmount));
}

// output
ProductsContainer.AddChild(GetEntContainer(product, 1));

if (!_prototype.TryIndex<CookingInstrumentTypePrototype>(recipe.InstrumentType, out var instrumentProto))
return;

var instrumentMsg = new FormattedMessage();
instrumentMsg.AddMarkupOrThrow(instrumentProto.Name);
instrumentMsg.PushNewline();
instrumentMsg.AddMarkupOrThrow(Loc.GetString("guidebook-cooking-recipes-timer-display", ("time", recipe.CookTime)));
instrumentMsg.Pop();
InstrumentName.SetMessage(instrumentMsg);

if (instrumentProto.IconPath is not null)
InstrumentIcon.TexturePath = instrumentProto.IconPath;
}

private BoxContainer GetEntContainer(EntityPrototype prototype, FixedPoint2 amount)
{
var entContainer = new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
HorizontalExpand = true,
HorizontalAlignment = HAlignment.Center,
};

var entView = new EntityPrototypeView();
entView.SetPrototype(prototype);
entContainer.AddChild(entView);

var entMsg = new FormattedMessage();
entMsg.AddMarkupOrThrow(Loc.GetString("guidebook-cooking-recipes-ingredient-display",
("reagent", prototype.Name), ("ratio", amount)));
entMsg.Pop();

var entLabel = new RichTextLabel();
entLabel.SetMessage(entMsg);
entContainer.AddChild(entLabel);

return entContainer;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- © 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"
Orientation="Vertical">
<BoxContainer Name="GroupContainer" Orientation="Vertical"/>
</BoxContainer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Client.Guidebook.Richtext;
using Content.Shared.SS220.SupaKitchen;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;

namespace Content.Client.SS220.SupaKitchen.UI.Controls;

/// <summary>
/// Control for embedding a group of recipes into a guidebook.
/// </summary>
[UsedImplicitly, GenerateTypedNameReferences]
public sealed partial class GuideCookingRecipeGroupEmbed : BoxContainer, IDocumentTag
{
[Dependency] private readonly IPrototypeManager _prototype = default!;

public GuideCookingRecipeGroupEmbed()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
MouseFilter = MouseFilterMode.Stop;
}

public GuideCookingRecipeGroupEmbed(string? recipeGroup, ProtoId<CookingInstrumentTypePrototype>? instrumentType) : this()
{
AddCookingRecipes(recipeGroup, instrumentType);
}

public bool TryParseTag(Dictionary<string, string> args, [NotNullWhen(true)] out Control? control)
{
args.TryGetValue("RecipeGroup", out var recipeGroup);
args.TryGetValue("InstrumentType", out var instrumentType);

AddCookingRecipes(recipeGroup, instrumentType);

control = this;
return true;
}

private void AddCookingRecipes(string? recipeGroup, ProtoId<CookingInstrumentTypePrototype>? instrumentType)
{
var prototypes = _prototype.EnumeratePrototypes<CookingRecipePrototype>().Where(r => !r.SecretRecipe);

if (recipeGroup != null)
prototypes = prototypes.Where(r => r.RecipeGroup == recipeGroup);

if (instrumentType != null)
prototypes = prototypes.Where(r => r.InstrumentType == instrumentType);

foreach (var recipe in prototypes)
{
var embed = new GuideCookingRecipeEmbed(recipe);
GroupContainer.AddChild(embed);
}
}
}
Loading
Loading