Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions Content.Server/Kitchen/Components/MicrowaveComponent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared._DEN.Kitchen.Prototypes;
using Content.Shared.Construction.Prototypes;
using Content.Shared.DeviceLinking;
using Content.Shared.Item;
Expand Down Expand Up @@ -110,5 +111,18 @@ public sealed partial class MicrowaveComponent : Component
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool CanMicrowaveIdsSafely = true;

// DEN Start: Appliance cooking

/// <summary>
/// What kind of microwaveMealRecipes this appliance is capable of producing.
/// </summary>
/// <remarks>
/// If set to null, then this appliance can make any recipe - replicating the old behavior of microwaves.
/// </remarks>
[DataField]
public HashSet<ProtoId<CookingAppliancePrototype>>? RecipeTypes = null;

// DEN End
}
}
5 changes: 5 additions & 0 deletions Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,11 @@ public static (FoodRecipePrototype, int) CanSatisfyRecipe(MicrowaveComponent com
return (recipe, 0);
}

// DEN Start: Check if the appliance shares at least one valid appliance type with the recipe.
if (component.RecipeTypes != null && !component.RecipeTypes.Intersect(recipe.RecipeTypes).Any())
return (recipe, 0);
// DEN End

foreach (var solid in recipe.IngredientsSolids)
{
if (!solids.ContainsKey(solid.Key))
Expand Down
30 changes: 28 additions & 2 deletions Content.Shared/Kitchen/MicrowaveMealRecipePrototype.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
using Content.Shared.Chemistry.Reagent;
using Content.Shared._DEN.Kitchen.Prototypes;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Tag;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;

namespace Content.Shared.Kitchen
{
/// <summary>
/// A recipe for space microwaves.
/// </summary>
[Prototype("microwaveMealRecipe")]
public sealed partial class FoodRecipePrototype : IPrototype
public sealed partial class FoodRecipePrototype : IPrototype, IInheritingPrototype
{
[ViewVariables]
[IdDataField]
public string ID { get; private set; } = default!;

// DEN start: Make microwave recipes inheriting
[ParentDataField(typeof(AbstractPrototypeIdArraySerializer<FoodRecipePrototype>))]
public string[]? Parents { get; private set; }

[NeverPushInheritance]
[AbstractDataField]
public bool Abstract { get; private set; }
// DEN end

[DataField("name")]
private string _name = string.Empty;

Expand Down Expand Up @@ -46,6 +59,19 @@ public sealed partial class FoodRecipePrototype : IPrototype
[DataField]
public bool SecretRecipe = false;

// DEN start: Appliance coooking

/// <summary>
/// A set of valid appliances that can produce this recipe.
/// </summary>
/// <remarks>
/// For example, an appliance might be only capable of producing recipes with the "Microwave" type.
/// </remarks>
[DataField(required: true)]
public HashSet<ProtoId<CookingAppliancePrototype>> RecipeTypes = new();

// End DEN

/// <summary>
/// Count the number of ingredients in a recipe for sorting the recipe list.
/// This makes sure that where ingredient lists overlap, the more complex
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

namespace Content.Shared._DEN.Kitchen.Prototypes;

/// <summary>
/// Defines a type of appliance that can be used for cooking purposes.
/// Recipes only need the prototype ID, but this prototype also contains metadata such as name/icon
/// for the sake of guidebook entries.
/// </summary>
[Prototype]
public sealed partial class CookingAppliancePrototype : IPrototype
{
[ViewVariables]
[IdDataField]
public string ID { get; private set; } = default!;

/// <summary>
/// The display name of this appliance in the guidebook.
/// </summary>
[DataField]
public LocId Name = string.Empty;

/// <summary>
/// The icon for this appliance in the guidebook.
/// </summary>
[DataField]
public SpriteSpecifier? Icon = null;
}
4 changes: 4 additions & 0 deletions Resources/Locale/en-US/_DEN/appliances/cooking-appliances.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cooking-appliance-assembler-name = Assembler
cooking-appliance-medical-assembler-name = Medical assembler
cooking-appliance-microwave-name = Microwave
cooking-appliance-oven-name = Oven
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
- type: entity
id: KitchenMicrowave
id: KitchenMicrowaveUpstream # DEN: Update prototype ID
parent: [ BaseMachinePowered, SmallConstructibleMachine ]
name: microwave
description: It's magic.
suffix: Upstream # DEN: Add suffix
components:
- type: Microwave
capacity: 10
Expand Down
Loading