-
Notifications
You must be signed in to change notification settings - Fork 0
/
DingusThings.cs
87 lines (73 loc) · 2.63 KB
/
DingusThings.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
81
82
83
84
85
86
87
using BepInEx;
using BepInEx.Logging;
using DingusThings.Behaviours;
using DingusThings.CustomScriptableObject;
using DingusThings.Patches;
using HarmonyLib;
using System.IO;
using System.Reflection;
using UnityEngine;
namespace DingusThings
{
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInDependency(LethalLib.Plugin.ModGUID)]
public class DingusThings : BaseUnityPlugin
{
public static DingusThings Instance { get; private set; } = null!;
internal new static ManualLogSource Logger { get; private set; } = null!;
internal static Harmony? Harmony { get; set; }
public static AssetBundle? Bundle;
public static string PluginString = $"{MyPluginInfo.PLUGIN_NAME} v{MyPluginInfo.PLUGIN_VERSION}";
private static Terminal? terminalInstance;
private static int randomMapSeed = 0;
public static Terminal? GetTerminalInstance()
{
if (terminalInstance != null)
{
return terminalInstance;
}
else
{
return null;
}
}
public static void SetTerminalInstance(Terminal terminal)
{
terminalInstance = terminal;
}
public static int GetRandomMapSeed()
{
return randomMapSeed;
}
public static void SetRandomMapSeed(int s)
{
randomMapSeed = s;
// update keyboard physics prop seed
KeyboardPhysicsProp.OnSeedUpdate();
}
private void Awake()
{
Logger = base.Logger;
Instance = this;
string sAssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
// load assets
Bundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "dingus"));
if (Bundle == null)
{
Logger.LogError($"{PluginString}: Failed to load custom assets.");
return;
}
// load patches
Harmony.CreateAndPatchAll(typeof(TerminalPatch));
Harmony.CreateAndPatchAll(typeof(SeedPatch));
// register custom scrap
MyHeartItem.Register();
SteamGiftCardItem.Register();
LifebuoyBarSoapItem.Register();
InstantNoodlePackItem.Register();
KeyboardItem.Register();
NerdItem.Register();
Logger.LogInfo($"{PluginString} has loaded!");
}
}
}