mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
[PhysicsGunMod] PhysGun test
This commit is contained in:
parent
7e1445912d
commit
d155ea546e
10 changed files with 862 additions and 0 deletions
43
PhysicsGunMod/Main.cs
Normal file
43
PhysicsGunMod/Main.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using ABI_RC.Core.Util.AssetFiltering;
|
||||
using MelonLoader;
|
||||
using NAK.PhysicsGunMod.Components;
|
||||
using NAK.PhysicsGunMod.HarmonyPatches;
|
||||
|
||||
namespace NAK.PhysicsGunMod;
|
||||
|
||||
public class PhysicsGunMod : MelonMod
|
||||
{
|
||||
internal static MelonLogger.Instance Logger;
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
Logger = LoggerInstance;
|
||||
|
||||
// add to prop whitelist
|
||||
SharedFilter._spawnableWhitelist.Add(typeof(PhysicsGunInteractionBehavior));
|
||||
|
||||
// add to event whitelist
|
||||
SharedFilter._allowedEventComponents.Add(typeof(PhysicsGunInteractionBehavior));
|
||||
SharedFilter._allowedEventFunctions.Add(typeof(PhysicsGunInteractionBehavior), new List<string>
|
||||
{
|
||||
"set_enabled",
|
||||
// TODO: expose more methods like release ?
|
||||
});
|
||||
|
||||
// apply patches
|
||||
ApplyPatches(typeof(CVRInputManagerPatches));
|
||||
}
|
||||
|
||||
private void ApplyPatches(Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
HarmonyInstance.PatchAll(type);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||
LoggerInstance.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue