-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cs
More file actions
97 lines (81 loc) · 2.72 KB
/
Main.cs
File metadata and controls
97 lines (81 loc) · 2.72 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using Il2CppSLZ.Marrow.Pool;
using WeatherElectric.RecursiveSelfImprovement.Utilities;
using HarmonyLib;
using Il2CppSLZ.Marrow.Warehouse;
namespace WeatherElectric.RecursiveSelfImprovement;
public class Main : MelonMod
{
internal const string Name = "RecursiveSelfImprovement";
internal const string Description = "A general quality of life/tools mod.";
internal const string Author = "FragileDeviations";
internal const string Company = "Weather Electric";
internal const string Version = "1.0.0";
internal const string DownloadLink = "https://thunderstore.io/c/bonelab/p/SoulWithMae/RecursiveSelfImprovement/";
internal static Page MenuCat { get; private set; }
internal static Assembly CurrAsm { get; } = Assembly.GetExecutingAssembly();
public override void OnInitializeMelon()
{
ModConsole.Setup(LoggerInstance);
Preferences.Setup();
CreateMenu();
SetupHooking();
Utility.Initialize();
}
public override void OnUpdate()
{
Utility.OnUpdate();
}
public override void OnLateUpdate()
{
Utility.OnLateUpdate();
}
public override void OnFixedUpdate()
{
Utility.OnFixedUpdate();
}
private static void SetupHooking()
{
Hooking.OnWarehouseReady += OnWarehouseLoaded;
Hooking.OnLevelLoaded += OnLevelLoad;
Hooking.OnLevelUnloaded += OnlevelUnload;
Hooking.OnUIRigCreated += OnPlayerReady;
}
private static void OnWarehouseLoaded()
{
var pallets = AssetWarehouse.Instance.GetPallets();
var crates = AssetWarehouse.Instance.GetCrates();
Utility.WarehouseLoaded(pallets, crates);
AssetWarehouse.Instance.OnPalletAdded += (Il2CppSystem.Action<Barcode>)OnPalletAdded;
}
private static void OnPalletAdded(Barcode barcode)
{
Utility.PalletAdded(barcode);
}
private static void OnLevelLoad(LevelInfo levelInfo)
{
Utility.LevelLoad(levelInfo);
}
private static void OnlevelUnload()
{
Utility.LevelUnload();
}
private static void OnPlayerReady()
{
Utility.PlayerReady();
}
private static void CreateMenu()
{
var mainCat = Page.Root.CreatePage("<color=#6FBDFF>Weather Electric</color>", Color.white);
MenuCat = mainCat.CreatePage("<color=#009dff>Marrow Utils</color>", Color.white);
}
[HarmonyPatch(typeof(Poolee))]
private static class PooleeStart
{
[HarmonyPostfix]
[HarmonyPatch(nameof(Poolee.OnInitialize))]
private static void Postfix(Poolee __instance, IPoolable poolable)
{
Utility.SpawnablePlaced(__instance, __instance.gameObject);
}
}
}