forked from Pathoschild/StardewMods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecipe.cs
49 lines (42 loc) · 1.73 KB
/
Recipe.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using StardewValley;
using SObject = StardewValley.Object;
namespace Pathoschild.Stardew.Automate
{
/// <summary>Describes a generic recipe based on item input and output.</summary>
internal class Recipe
{
/*********
** Accessors
*********/
/// <summary>The input item or category ID.</summary>
public int InputID { get; }
/// <summary>The number of inputs needed.</summary>
public int InputCount { get; }
/// <summary>The output to generate (given an input).</summary>
public Func<Item, SObject> Output { get; }
/// <summary>The time needed to prepare an output.</summary>
public int Minutes { get; }
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="input">The input item or category ID.</param>
/// <param name="inputCount">The number of inputs needed.</param>
/// <param name="output">The output to generate (given an input).</param>
/// <param name="minutes">The time needed to prepare an output.</param>
public Recipe(int input, int inputCount, Func<Item, SObject> output, int minutes)
{
this.InputID = input;
this.InputCount = inputCount;
this.Output = output;
this.Minutes = minutes;
}
/// <summary>Get whether the recipe can accept a given item as input (regardless of stack size).</summary>
/// <param name="stack">The item to check.</param>
public bool AcceptsInput(ITrackedStack stack)
{
return stack.Sample.parentSheetIndex == this.InputID || stack.Sample.category == this.InputID;
}
}
}