-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCraftingState.cs
33 lines (30 loc) · 968 Bytes
/
CraftingState.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
using System.Collections.Generic;
using System.Linq;
using Terraria;
namespace RecursiveCraft
{
public class CraftingState
{
public int Depth;
public Dictionary<int, int> Inventory;
public Dictionary<Recipe, int> RecipeUsed;
public Dictionary<int, int> TrueInventory;
public CraftingState(Dictionary<int, int> inventory)
{
Inventory = inventory;
TrueInventory = inventory;
RecipeUsed = new Dictionary<Recipe, int>();
Depth = -1;
}
public CraftingState(CraftingState oldCraftingState)
{
Inventory = oldCraftingState.Inventory.ToDictionary(keyValuePair => keyValuePair.Key,
keyValuePair => keyValuePair.Value);
TrueInventory = oldCraftingState.TrueInventory.ToDictionary(keyValuePair => keyValuePair.Key,
keyValuePair => keyValuePair.Value);
RecipeUsed = oldCraftingState.RecipeUsed.ToDictionary(keyValuePair => keyValuePair.Key,
keyValuePair => keyValuePair.Value);
Depth = oldCraftingState.Depth + 1;
}
}
}