-
Notifications
You must be signed in to change notification settings - Fork 39
/
SmelterConversionConfig.cs
57 lines (51 loc) · 1.95 KB
/
SmelterConversionConfig.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
50
51
52
53
54
55
56
57
using System.Collections.Generic;
using Jotunn.Entities;
namespace Jotunn.Configs
{
/// <summary>
/// Used to add new ItemConversions to the Smelter
/// </summary>
public class SmelterConversionConfig : ConversionConfig
{
/// <summary>
/// The name of the station prefab this conversion is added to. Defaults to <see cref="Smelters.Smelter"/>.
/// </summary>
public override string Station
{
get => station;
set => station = Smelters.GetInternalName(value);
}
private string station = Smelters.Smelter;
/// <summary>
/// Turns the SmelterConversionConfig into a Valheim Smelter.ItemConversion item.
/// </summary>
/// <returns>The Valheim Smelter.ItemConversion</returns>
public Smelter.ItemConversion GetItemConversion()
{
Smelter.ItemConversion conv = new Smelter.ItemConversion()
{
m_from = Mock<ItemDrop>.Create(FromItem),
m_to = Mock<ItemDrop>.Create(ToItem),
};
return conv;
}
/// <summary>
/// Loads a single SmelterConversionConfig from a JSON string
/// </summary>
/// <param name="json">JSON text</param>
/// <returns>Loaded SmelterConversionConfig</returns>
public static SmelterConversionConfig FromJson(string json)
{
return SimpleJson.SimpleJson.DeserializeObject<SmelterConversionConfig>(json);
}
/// <summary>
/// Loads a list of SmelterConversionConfigs from a JSON string
/// </summary>
/// <param name="json">JSON text</param>
/// <returns>Loaded list of SmelterConversionConfigs</returns>
public static List<SmelterConversionConfig> ListFromJson(string json)
{
return SimpleJson.SimpleJson.DeserializeObject<List<SmelterConversionConfig>>(json);
}
}
}