[PhysicsGunMod] PhysGun test

This commit is contained in:
NotAKidoS 2024-01-22 21:53:03 -06:00
parent 7e1445912d
commit d155ea546e
10 changed files with 862 additions and 0 deletions

43
PhysicsGunMod/Main.cs Normal file
View 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);
}
}
}