mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
[LazyPrune] Fixed binding flags
This commit is contained in:
parent
a2f184e7ca
commit
431780461c
1 changed files with 9 additions and 5 deletions
|
@ -30,28 +30,31 @@ public class LazyPrune : MelonMod
|
||||||
|
|
||||||
// listen for local avatar load/clear events
|
// listen for local avatar load/clear events
|
||||||
HarmonyInstance.Patch(
|
HarmonyInstance.Patch(
|
||||||
typeof(CVRAvatar).GetMethod(nameof(CVRAvatar.Awake)), // earliest callback
|
typeof(CVRAvatar).GetMethod(nameof(CVRAvatar.Awake),
|
||||||
|
BindingFlags.NonPublic | BindingFlags.Instance), // earliest callback
|
||||||
prefix: new HarmonyMethod(typeof(LazyPrune).GetMethod(nameof(OnObjectCreated),
|
prefix: new HarmonyMethod(typeof(LazyPrune).GetMethod(nameof(OnObjectCreated),
|
||||||
BindingFlags.NonPublic | BindingFlags.Static))
|
BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
);
|
);
|
||||||
HarmonyInstance.Patch(
|
HarmonyInstance.Patch(
|
||||||
typeof(CVRAvatar).GetMethod(nameof(CVRAvatar.OnDestroy)),
|
typeof(CVRAvatar).GetMethod(nameof(CVRAvatar.OnDestroy),
|
||||||
|
BindingFlags.NonPublic | BindingFlags.Instance), // earliest callback
|
||||||
prefix: new HarmonyMethod(typeof(LazyPrune).GetMethod(nameof(OnObjectDestroyed),
|
prefix: new HarmonyMethod(typeof(LazyPrune).GetMethod(nameof(OnObjectDestroyed),
|
||||||
BindingFlags.NonPublic | BindingFlags.Static))
|
BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
);
|
);
|
||||||
|
|
||||||
// listen for prop load/clear events
|
// listen for prop load/clear events
|
||||||
HarmonyInstance.Patch(
|
HarmonyInstance.Patch(
|
||||||
typeof(CVRSpawnable).GetMethod(nameof(CVRSpawnable.OnEnable)), // earliest callback
|
typeof(CVRSpawnable).GetMethod(nameof(CVRSpawnable.OnEnable),
|
||||||
|
BindingFlags.NonPublic | BindingFlags.Instance), // earliest callback
|
||||||
prefix: new HarmonyMethod(typeof(LazyPrune).GetMethod(nameof(OnObjectCreated),
|
prefix: new HarmonyMethod(typeof(LazyPrune).GetMethod(nameof(OnObjectCreated),
|
||||||
BindingFlags.NonPublic | BindingFlags.Static))
|
BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
);
|
);
|
||||||
HarmonyInstance.Patch(
|
HarmonyInstance.Patch(
|
||||||
typeof(CVRSpawnable).GetMethod(nameof(CVRSpawnable.OnDestroy)),
|
typeof(CVRSpawnable).GetMethod(nameof(CVRSpawnable.OnDestroy),
|
||||||
|
BindingFlags.Public | BindingFlags.Instance), // earliest callback (why is this public?)
|
||||||
prefix: new HarmonyMethod(typeof(LazyPrune).GetMethod(nameof(OnObjectDestroyed),
|
prefix: new HarmonyMethod(typeof(LazyPrune).GetMethod(nameof(OnObjectDestroyed),
|
||||||
BindingFlags.NonPublic | BindingFlags.Static))
|
BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Game Events
|
#region Game Events
|
||||||
|
@ -61,6 +64,7 @@ public class LazyPrune : MelonMod
|
||||||
if (_lastLoadedWorld != guid)
|
if (_lastLoadedWorld != guid)
|
||||||
ForcePrunePendingObjects();
|
ForcePrunePendingObjects();
|
||||||
|
|
||||||
|
// did you know worlds can spam OnEnabled :)
|
||||||
_lastLoadedWorld = guid;
|
_lastLoadedWorld = guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue