Recipes
csharp
Content.Recipe("taco")
.Name("Taco")
.Icon("icons/taco.png")
.Part("tortilla", "toasted")
.Part("Meat", "fried")
.Part("Lettuce", "chopped")
.Score(40)
.Time(70);A level that lists swofty.taco-stand/taco among its recipes gets Taco orders: plated in any order, scored, tipped and timed like the game's own, with the icon on the order card and each part's icon under it.
RecipeBuilder
csharp
public sealed class RecipeBuilder
{
public RecipeBuilder Name(string name);
public RecipeBuilder Icon(string png);
public RecipeBuilder Container(string container); // "plate" (default), "glass", "mug"
public RecipeBuilder Part(string ingredient, string prep = null);
public RecipeBuilder Score(int points); // 0 to 1000, 20 by default
public RecipeBuilder Time(int seconds); // 10 to 600, 60 by default
public RecipeSpec Spec { get; }
}Container: a kitchen without that container serves the recipe on a plate. On the dish, each part shows its own model, laid out like the kitchen's own dishes on that container: the widest part at the bottom, the others on top. A plate takes the parts one at a time in any order.Part: one to six parts.prepisnullor"raw"for the food as it comes from the crate.Time: seconds before the order runs out.
RecipeSpec
A level's own custom recipes, made in the editor's recipe builder, are the same RecipeSpec.
csharp
public sealed class RecipeSpec
{
public const int MaxParts = 6;
public const string DefaultContainer = "plate";
public string Id { get; set; }
public string Name { get; set; }
public string Container { get; set; }
public int Score { get; set; }
public int Time { get; set; }
public List<RecipePart> Parts { get; }
public IList<string> Problems();
public RecipeSpec Clone();
}
public sealed class RecipePart
{
public string Ingredient { get; set; }
public string Prep { get; set; }
}Problems() lists what is wrong with the spec on its own: no parts, more than six, an unknown container or ingredient, a score or time out of range.
What a kitchen can make
csharp
KitchenStock stock = new KitchenStock();
stock.Ingredients.Add("swofty.taco-stand/tortilla");
stock.Ingredients.Add("Meat");
stock.Preps.Add("fried");
stock.Preps.Add("swofty.taco-stand/toasted");
IList<string> problems = RecipeCheck.Problems(spec, stock);
// ["no crate gives Lettuce", "no station in the kitchen makes Lettuce chopped"]KitchenStock: the ingredients a kitchen's crates give (built-in names or content ids) and the preps its stations give ("raw"is always there). ItsContainersaren't checked: a kitchen without a recipe's container serves it on a plate.RecipeCheck.Problems: the spec's own problems and what the kitchen lacks for it, as the editor shows them.RecipeCheck.StationFor(prep): the content station that gives a prep, ornull.RecipeCheck.NameOf(id): a content item's name, or the id for a built-in.
A level whose recipe can't be built in its kitchen leaves that recipe out and logs why.