-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.cs
More file actions
58 lines (49 loc) · 2.02 KB
/
Copy pathPlugin.cs
File metadata and controls
58 lines (49 loc) · 2.02 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
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetpackPocket.Patches;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Unity.Netcode;
namespace JetpackPocket
{
[BepInPlugin(ModInfo.modGUID, ModInfo.modName, ModInfo.modVersion)]
[BepInDependency("ainavt.lc.lethalconfig")]
[BepInDependency("LethalNetworkAPI")]
public class JetpackPocketPatchBase : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony(ModInfo.modGUID);
public static JetpackPocketPatchBase instance;
public ConfigEntry<bool> JetpackPocketConfigEntry;
internal static ManualLogSource logSource;
void Awake()
{
if (instance == null)
{
instance = this;
}
logSource = BepInEx.Logging.Logger.CreateLogSource(ModInfo.modGUID);
JetpackPocketConfigEntry = Config.Bind("General", "Carry multiple two-handed items", false, "Enables carrying multiple two-handed items at the same time while having a jetpack.");
JetpackPocketConfigEntry.SettingChanged += (sender, args) =>
{
if (NetworkManager.Singleton != null && NetworkManager.Singleton.IsHost)
{
ConfigSync.SendToClients(JetpackPocketConfigEntry.Value);
}
JetpackHelper.UpdateHUD();
};
var checkbox = new BoolCheckBoxConfigItem(JetpackPocketConfigEntry, new BoolCheckBoxOptions
{
RequiresRestart = false
});
LethalConfigManager.AddConfigItem(checkbox);
harmony.PatchAll(typeof(JetpackPocketPatchBase));
harmony.PatchAll(typeof(PlayerControllerBPatch));
harmony.PatchAll(typeof(NetworkPatch));
ConfigSync.SetNetworkMessage();
logSource.LogInfo(ModInfo.modName + " (version - " + ModInfo.modVersion + ")" + ": patches applied successfully");
}
}
}