-
Notifications
You must be signed in to change notification settings - Fork 2
/
WallPumps.cs
80 lines (73 loc) · 2.76 KB
/
WallPumps.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using FairONI;
using HarmonyLib;
namespace WallPumps
{
public class WallPumps : KMod.UserMod2
{
public static readonly Tag WallMachineRefinedMetals = TagManager.Create("WallMachineRefinedMetals");
public static readonly Tag WallMachineMetals = TagManager.Create("WallMachineMetals");
public override void OnLoad(Harmony harmony)
{
Debug.Log(" === WallPumps v. 2.6 OnLoad === ");
harmony.PatchAll();
}
}
[HarmonyPatch(typeof(Db))]
[HarmonyPatch("Initialize")]
public static class Db_Initialize_Patch
{
public static void Prefix()
{
Debug.Log(" === WallPumps v. 2.6 Db_Initialize Prefix === ");
AddTags.AddStrings(WallPumps.WallMachineRefinedMetals, "Wall Machine Refined Metals");
AddTags.AddStrings(WallPumps.WallMachineMetals, "Wall Machine Metals");
WallPumpsConfig config = WallPumpsConfig.GetConfig();
}
public static void Postfix()
{
Debug.Log(" === WallPumps v. 2.6 Db_Initialize Postfix === ");
// Add buildings
GasWallPump.Setup();
LiquidWallPump.Setup();
GasWallVent.Setup();
GasWallVentHighPressure.Setup();
LiquidWallVent.Setup();
// Add tech tree/building menu entries
GasWallPump.AddToMenus();
LiquidWallPump.AddToMenus();
GasWallVent.AddToMenus();
GasWallVentHighPressure.AddToMenus();
LiquidWallVent.AddToMenus();
}
}
[HarmonyPatch(typeof(ElementLoader))]
[HarmonyPatch("FinaliseElementsTable")]
public static class ElementLoader_FinaliseElementsTable_Patch
{
public static void Postfix()
{
// Add new material it to all refined metals + insulation
foreach (Element e in ElementLoader.elementTable.Values)
{
if (e.HasTag(GameTags.RefinedMetal))
{
ElementUtils.AddOreTag(e, WallPumps.WallMachineRefinedMetals);
}
if (e.HasTag(GameTags.Metal))
{
ElementUtils.AddOreTag(e, WallPumps.WallMachineMetals);
}
}
ElementUtils.AddOreTag(ElementLoader.FindElementByHash(SimHashes.SuperInsulator), WallPumps.WallMachineRefinedMetals);
ElementUtils.AddOreTag(ElementLoader.FindElementByHash(SimHashes.SuperInsulator), WallPumps.WallMachineMetals);
}
}
//[HarmonyPatch(typeof(Game), "OnPrefabInit")]
//public static class Game_OnPrefabInit_Patch
//{
// public static void Postfix(Game __instance)
// {
// Debug.Log(" === WallPumps v. 2.6 OnPrefabInit === ");
// }
//}
}