Chef update (#11189)

* Sort recipes based on total ingredient count

Fix the recipe sort function so that recipes with more ingredients are
matched first. This fixes vegetable pizzas and allows more complex
recipes in the future.

* Chef update

* Pet linter
This commit is contained in:
Kevin Zheng
2022-09-10 18:47:37 -07:00
committed by GitHub
parent 9c5b9f4fec
commit c723d54a51
11 changed files with 780 additions and 175 deletions

View File

@@ -35,5 +35,21 @@ namespace Content.Shared.Kitchen
public IReadOnlyDictionary<string, FixedPoint2> IngredientsReagents => _ingsReagents;
public IReadOnlyDictionary<string, FixedPoint2> IngredientsSolids => _ingsSolids;
/// <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
/// recipe is picked first.
/// </summary>
public FixedPoint2 IngredientCount()
{
FixedPoint2 n = 0;
n += _ingsReagents.Count; // number of distinct reagents
foreach (FixedPoint2 i in _ingsSolids.Values) // sum the number of solid ingredients
{
n += i;
}
return n;
}
}
}

View File

@@ -45,7 +45,9 @@ namespace Content.Shared.Kitchen
return 0;
}
return -x.IngredientsReagents.Count.CompareTo(y.IngredientsReagents.Count);
var nx = x.IngredientCount();
var ny = y.IngredientCount();
return -nx.CompareTo(ny);
}
}
}

View File

@@ -85,9 +85,9 @@
amount: 1
- id: SugarcaneSeeds
amount: 1
# - id: LemonSeeds No recipes, limejuice in reagent dispenser
# amount: 1
# - id: OatSeeds No recipes, nothing uses oatmilk
# amount: 1
- id: LemonSeeds
amount: 1
- id: OatSeeds
amount: 1
- id: OnionSeeds
amount: 1

View File

@@ -26,15 +26,26 @@
contents:
- id: ReagentContainerFlour
amount: 3
- id: ReagentContainerRice
amount: 1
- id: ReagentContainerMilk
amount: 4
- id: ReagentContainerMilkSoy
amount: 1
- id: ReagentContainerSugar
amount: 1
- id: FoodCondimentPacketSalt
amount: 3
- id: FoodCondimentBottleEnzyme
amount: 1
- id: FoodBowlBig
amount: 3
- id: FoodPlate
amount: 3
- id: FoodPlateSmall
amount: 3
- id: FoodContainerEgg
- id: FoodKebabSkewer
amount: 3
- id: KitchenKnife
amount: 1

View File

@@ -36,6 +36,8 @@
- id: ReagentContainerFlour
amount: 2
- id: ReagentContainerSugar
- id: FoodCondimentPacketSalt
amount: 3
- id: FoodCondimentBottleEnzyme
# really, milk should go in the fridge. Unfortunately saltern only has freezers.
# yes, I'm using this as an excuse to not have to do extra work.

View File

@@ -3,7 +3,11 @@
startingInventory:
ButchCleaver: 1
KitchenKnife: 5
FoodBowlBig: 5
FoodBowlBig: 10
FoodPlate: 10
FoodPlateSmall: 10
FoodPlateTin: 5
FoodKebabSkewer: 5
DrinkGlass: 10
DrinkMug: 5
DrinkMugBlack: 2

View File

@@ -11,9 +11,9 @@
CornSeeds: 5
EggplantSeeds: 5
GalaxythistleSeeds: 3
# LemonSeeds: 5 No recipes
LemonSeeds: 5
LingzhiSeeds: 3
# OatSeeds: 5 No recipes
OatSeeds: 5
OnionSeeds: 5
PoppySeeds: 3
PotatoSeeds: 5

View File

@@ -799,7 +799,7 @@
Quantity: 50
- type: Butcherable
spawned:
- id: FoodMeat
- id: FoodMeatRat
amount: 1
- type: ReplacementAccent
accent: mouse
@@ -932,7 +932,7 @@
Base: dead
- type: Butcherable
spawned:
- id: FoodMeat
- id: FoodMeatLizard
amount: 1
- type: InteractionPopup
successChance: 0.3

View File

@@ -12,6 +12,8 @@
- type: Sprite
sprite: Objects/Consumable/Food/meat.rsi
netsync: false
- type: Extractable
grindableSolutionName: food
- type: SolutionContainerManager
solutions:
food:
@@ -274,6 +276,24 @@
- ReagentId: Ichor
Quantity: 2
- type: entity
name: raw rat meat
parent: FoodMeatBase
id: FoodMeatRat
description: Prime meat from maintenance!
components:
- type: Tag
tags:
- Raw
- type: Sprite
state: plain
- type: SolutionContainerManager
solutions:
food:
reagents:
- ReagentId: UncookedAnimalProteins
Quantity: 3
- type: entity
name: raw lizard meat
parent: FoodMeatBase

File diff suppressed because it is too large Load Diff

View File

@@ -40,6 +40,35 @@
- !type:CreateEntityReactionEffect
entity: FoodCakeBatter
- type: reaction
id: CreateButter
impact: Low
quantized: true
reactants:
Milk:
amount: 30
TableSalt:
amount: 5
catalyst: true
effects:
- !type:CreateEntityReactionEffect
entity: FoodButter
- type: reaction
id: CreatePieDough
impact: Low
quantized: true
reactants:
Flour:
amount: 15
Egg:
amount: 12
TableSalt:
amount: 5
effects:
- !type:CreateEntityReactionEffect
entity: FoodDoughPie
# TG has a cake recipe that uses soy milk instead of eggs.
# but afaik it spawns the exact same cake batter entity.
# Maybe change this if you want to do allergies or something
@@ -93,3 +122,18 @@
amount: 5
products:
Hotsauce: 15
- type: reaction
id: CreateMeatball
impact: Low
quantized: true
reactants:
UncookedAnimalProteins:
amount: 5
Flour:
amount: 5
Egg:
amount: 6
effects:
- !type:CreateEntityReactionEffect
entity: FoodMeatMeatball