]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add Donk Co. microwave board to Combat Bakery Kit (#31239)
authorthemias <89101928+themias@users.noreply.github.com>
Mon, 2 Sep 2024 13:49:00 +0000 (09:49 -0400)
committerGitHub <noreply@github.com>
Mon, 2 Sep 2024 13:49:00 +0000 (15:49 +0200)
* Add special microwave board to Combat Bakery Kit

* use event instead of trycomp

* make the board sus

* add instructions note

* embarrassing typo

* Add functionality to Donk Co. microwave instead

* update note

12 files changed:
Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs
Content.Shared/Kitchen/Components/RecipeProviderComponent.cs [new file with mode: 0644]
Content.Shared/Kitchen/GetSecretRecipesEvent.cs [new file with mode: 0644]
Content.Shared/Kitchen/MicrowaveMealRecipePrototype.cs
Content.Shared/Kitchen/RecipeManager.cs
Resources/Locale/en-US/paper/paper-misc.ftl
Resources/Locale/en-US/store/uplink-catalog.ftl
Resources/Prototypes/Catalog/Fills/Boxes/syndicate.yml
Resources/Prototypes/Catalog/Fills/Paper/manuals.yml
Resources/Prototypes/Catalog/uplink_catalog.yml
Resources/Prototypes/Entities/Structures/Machines/microwave.yml
Resources/Prototypes/Recipes/Cooking/meal_recipes.yml

index ab57abf2fb922041a0b915050ea6b410af987685..9f43f760185fbe2337f930c06bd3380b86e0beb0 100644 (file)
@@ -40,6 +40,7 @@ using Content.Shared.Stacks;
 using Content.Server.Construction.Components;
 using Content.Shared.Chat;
 using Content.Shared.Damage;
+using Robust.Shared.Utility;
 
 namespace Content.Server.Kitchen.EntitySystems
 {
@@ -100,6 +101,8 @@ namespace Content.Server.Kitchen.EntitySystems
             SubscribeLocalEvent<ActiveMicrowaveComponent, EntRemovedFromContainerMessage>(OnActiveMicrowaveRemove);
 
             SubscribeLocalEvent<ActivelyMicrowavedComponent, OnConstructionTemperatureEvent>(OnConstructionTemp);
+
+            SubscribeLocalEvent<FoodRecipeProviderComponent, GetSecretRecipesEvent>(OnGetSecretRecipes);
         }
 
         private void OnCookStart(Entity<ActiveMicrowaveComponent> ent, ref ComponentStartup args)
@@ -588,7 +591,12 @@ namespace Content.Server.Kitchen.EntitySystems
             }
 
             // Check recipes
-            var portionedRecipe = _recipeManager.Recipes.Select(r =>
+            var getRecipesEv = new GetSecretRecipesEvent();
+            RaiseLocalEvent(uid, ref getRecipesEv);
+
+            List<FoodRecipePrototype> recipes = getRecipesEv.Recipes;
+            recipes.AddRange(_recipeManager.Recipes);
+            var portionedRecipe = recipes.Select(r =>
                 CanSatisfyRecipe(component, r, solidsDict, reagentDict)).FirstOrDefault(r => r.Item2 > 0);
 
             _audio.PlayPvs(component.StartCookingSound, uid);
@@ -693,6 +701,21 @@ namespace Content.Server.Kitchen.EntitySystems
             }
         }
 
+        /// <summary>
+        /// This event tries to get secret recipes that the microwave might be capable of.
+        /// Currently, we only check the microwave itself, but in the future, the user might be able to learn recipes.
+        /// </summary>
+        private void OnGetSecretRecipes(Entity<FoodRecipeProviderComponent> ent, ref GetSecretRecipesEvent args)
+        {
+            foreach (ProtoId<FoodRecipePrototype> recipeId in ent.Comp.ProvidedRecipes)
+            {
+                if (_prototype.TryIndex(recipeId, out var recipeProto))
+                {
+                    args.Recipes.Add(recipeProto);
+                }
+            }
+        }
+
         #region ui
         private void OnEjectMessage(Entity<MicrowaveComponent> ent, ref MicrowaveEjectMessage args)
         {
diff --git a/Content.Shared/Kitchen/Components/RecipeProviderComponent.cs b/Content.Shared/Kitchen/Components/RecipeProviderComponent.cs
new file mode 100644 (file)
index 0000000..d677e42
--- /dev/null
@@ -0,0 +1,13 @@
+using Robust.Shared.Prototypes;
+
+namespace Content.Shared.Kitchen.Components;
+
+[RegisterComponent]
+public sealed partial class FoodRecipeProviderComponent : Component
+{
+    /// <summary>
+    /// These are additional recipes that the entity is capable of cooking.
+    /// </summary>
+    [DataField, ViewVariables]
+    public List<ProtoId<FoodRecipePrototype>> ProvidedRecipes = new();
+}
diff --git a/Content.Shared/Kitchen/GetSecretRecipesEvent.cs b/Content.Shared/Kitchen/GetSecretRecipesEvent.cs
new file mode 100644 (file)
index 0000000..cf5416d
--- /dev/null
@@ -0,0 +1,10 @@
+namespace Content.Shared.Kitchen;
+
+/// <summary>
+/// This returns a list of recipes not found in the main list of available recipes.
+/// </summary>
+[ByRefEvent]
+public struct GetSecretRecipesEvent()
+{
+    public List<FoodRecipePrototype> Recipes = new();
+}
index b0991b54605dbe9101b3b2f93fc89fde0f1ac1a1..65a7b9ed045a715b23f7de1f4c4bbd529b422c62 100644 (file)
@@ -37,6 +37,12 @@ namespace Content.Shared.Kitchen
         public IReadOnlyDictionary<string, FixedPoint2> IngredientsReagents => _ingsReagents;
         public IReadOnlyDictionary<string, FixedPoint2> IngredientsSolids => _ingsSolids;
 
+        /// <summary>
+        /// Is this recipe unavailable in normal circumstances?
+        /// </summary>
+        [DataField]
+        public bool SecretRecipe = false;
+
         /// <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
index 0b120db26dae9ad1b02be58cd00ff5b8d56d9c19..79c169b754bde40ed0edca9e9a851853c80d3a49 100644 (file)
@@ -14,7 +14,8 @@ namespace Content.Shared.Kitchen
             Recipes = new List<FoodRecipePrototype>();
             foreach (var item in _prototypeManager.EnumeratePrototypes<FoodRecipePrototype>())
             {
-                Recipes.Add(item);
+                if (!item.SecretRecipe)
+                    Recipes.Add(item);
             }
 
             Recipes.Sort(new RecipeComparer());
index 587701a9274a8683196c32a9dfab0524ff56e6f5..c7c3a5e42ee8013627f8e45657ae6d838c0daeaf 100644 (file)
@@ -26,3 +26,21 @@ book-text-ame-scribbles = I don't know if you're trained already, so I hope this
       The golden rule is 2 injection for every 1 core. You can go lower to save fuel.
       Higher will burn the engine out and eventually make it explode. Don't.
       Don't forget to refuel it, it tends to stop at the worst possible time.
+
+book-text-combat-bakery-kit = Thank you for choosing our combat bakery kit!
+      Enclosed are two (2) CyberSun patented Throwing Croissants, and one (1) patent-pending Baguette Sword.
+      The included Donk Co. microwave board can construct a microwave capable of baking more weapons.
+      Just like the baked weapons, be sure to eat this note after use. Good luck, agent.
+
+      Baguette Sword Recipe:
+      Dough x 1
+      Salt 5u
+      Pepper 5u
+      Metal Rod x 1
+      Cook Time: 15 seconds
+
+      Throwing Croissant Recipe:
+      Raw Croissant x 1
+      Butter Slice x 1
+      Glass Shard x 1
+      Cook Time: 5 seconds
\ No newline at end of file
index b84202a29106433ba3fb6ec86c619267a1462c05..65fee9d2cc75a36449473fb460ef782f831843b1 100644 (file)
@@ -441,4 +441,4 @@ uplink-backpack-syndicate-name = Syndicate backpack
 uplink-backpack-syndicate-desc = Lightweight explosion-proof a backpack for holding various traitor goods
 
 uplink-combat-bakery-name = Combat Bakery Kit
-uplink-combat-bakery-desc = A kit of clandestine baked weapons. Contains a baguette which a skilled mime could use as a sword and a pair of throwing croissants. Once the job is done, eat the evidence.
+uplink-combat-bakery-desc = A kit of clandestine baked weapons. Contains a baguette sword, a pair of throwing croissants, and a syndicate microwave board for making more. Once the job is done, eat the evidence.
index 27df984f25d7472f6917fda1ee3425ddc6292cb5..0f99ae77d47fced85e556b0eb786d1159e1b0503 100644 (file)
@@ -82,4 +82,6 @@
     contents:
       - id: WeaponCroissant
         amount: 2
-      - id: WeaponBaguette
\ No newline at end of file
+      - id: WeaponBaguette
+      - id: SyndicateMicrowaveMachineCircuitboard
+      - id: PaperWrittenCombatBakeryKit
\ No newline at end of file
index 4893fa2557f6b35e7c1f49b39ed2c764c7f466d1..7f2268953bf8dcc6c57a62969baec69c3af31811 100644 (file)
         type: PaperBoundUserInterface
   - type: Paper
     content: book-text-holoparasite-info
+
+- type: entity
+  id: PaperWrittenCombatBakeryKit
+  name: "combat bakery kit instructions"
+  description: "Eat note after reading."
+  parent: Paper
+  components:
+  - type: Paper
+    content: book-text-combat-bakery-kit
\ No newline at end of file
index 613b7bcdedb99e976352cb9147a1398532cd7279..8954325eb14c1c58e8549ea58b6dee3e863fac0d 100644 (file)
   icon: { sprite:  Objects/Consumable/Food/Baked/bread.rsi, state: baguette}
   productEntity: CombatBakeryKit
   cost:
-    Telecrystal: 3
+    Telecrystal: 6
   categories:
   - UplinkJob
   conditions:
index 18174455121d46be0ef86861f36e23b0b4b1e29e..b415551ad2b87b37efc2de6feaeab9f66811ab3f 100644 (file)
     snapCardinals: true
   - type: Machine
     board: SyndicateMicrowaveMachineCircuitboard
+  - type: FoodRecipeProvider
+    providedRecipes:
+    - RecipeBaguetteSword
+    - RecipeThrowingCroissant
index 4c1080c135c5e2face1c40821e2b6cdabf28d26d..bf39e1487bb7942063df96cdcce7247ec258e25f 100644 (file)
   solids:
     FoodDough: 1
 
+- type: microwaveMealRecipe
+  id: RecipeBaguetteSword
+  name: baguette sword recipe
+  result: WeaponBaguette
+  secretRecipe: true
+  time: 15
+  reagents:
+    TableSalt: 5
+    Blackpepper: 5
+  solids:
+    FoodDough: 1
+    PartRodMetal1: 1
+
 - type: microwaveMealRecipe
   id: RecipeButteredToast
   name: buttered toast recipe
   solids:
     FoodCroissantRaw: 1
     FoodButterSlice: 1
+
+- type: microwaveMealRecipe
+  id: RecipeThrowingCroissant
+  name: throwing croissant recipe
+  result: WeaponCroissant
+  secretRecipe: true
+  time: 5
+  solids:
+    FoodCroissantRaw: 1
+    FoodButterSlice: 1
+    ShardGlass: 1
\ No newline at end of file