-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.cs
74 lines (53 loc) · 2.26 KB
/
Plugin.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
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using MetalPipeMod.Patches;
using LCSoundTool;
namespace MetalPipeMod;
[BepInPlugin(modGUID, modName, modVersion)]
[BepInDependency("LCSoundTool", BepInDependency.DependencyFlags.HardDependency)]
public class MetalPipeModBase : BaseUnityPlugin
{
private const string modGUID = "Eyasu.MetalPipeShovelMod";
private const string modName = "Metal Pipe Shovel Mod";
private const string modVersion = "1.0";
private readonly Harmony harmony = new Harmony(modGUID);
private static MetalPipeModBase Instance;
internal ManualLogSource mls;
public static Mesh newModel;
public static Material newMaterial;
void Awake() {
if (Instance == null) {
Instance = this;
}
mls = BepInEx.Logging.Logger.CreateLogSource(modGUID);
mls.LogInfo("Enabling Metal Pipe Shovel Mod...");
string location = ((BaseUnityPlugin)this).Info.Location;
string text = "MetalPipeShovelMod.dll";
string directory = location.TrimEnd(text.ToCharArray());
string modelFile = directory + "metalpipe";
//mls.LogInfo("Grabbing Asset Bundle...");
AssetBundle val = AssetBundle.LoadFromFile(modelFile);
//mls.LogInfo("Asset Bundle Grabbed!");
//mls.LogInfo("Loading metalpipe model...");
newModel = val.LoadAssetWithSubAssets<Mesh>("metalpipe.obj")[0];
//mls.LogInfo("Model Loaded!");
//mls.LogInfo("Loading metalpipe material...");
newMaterial = val.LoadAsset<Material>("Metalpipe.001");
//mls.LogInfo("Material Loaded!");
//mls.LogInfo("Replacing Sounds...");
AudioClip shovelhit;
//mls.LogInfo("Getting SOund File...");
//mls.LogInfo("Directory: " + directory.TrimEnd('\\'));
shovelhit = SoundTool.GetAudioClip(directory.TrimEnd('\\'), "sounds", "metalpipehit.mp3");
//mls.LogInfo("Replacing hit 1...");
SoundTool.ReplaceAudioClip("ShovelHitDefault", shovelhit);
//mls.LogInfo("Replacing hit 2...");
SoundTool.ReplaceAudioClip("ShovelHitDefault2", shovelhit);
//mls.LogInfo("Sounds Replaced!");
harmony.PatchAll(typeof(ShovelPatch));
mls.LogInfo("Metal Pipe Shovel Mod Loaded!");
}
}