From f4b4706d3bf67e44278f8a7bcdbf2343e68079ec Mon Sep 17 00:00:00 2001 From: 989onan Date: Wed, 2 Jul 2025 17:31:23 -0400 Subject: [PATCH 1/5] Animator no longer broke I took personal offense that my mantis blade that was driven didn't work with this mod, so I fixed it. --- .../PauseAnimatorUpdates.cs | 25 ++++++++++++++++++- Directory.Build.props | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CommunityBugFixCollection/PauseAnimatorUpdates.cs b/CommunityBugFixCollection/PauseAnimatorUpdates.cs index 8cb4a09..411c8b3 100644 --- a/CommunityBugFixCollection/PauseAnimatorUpdates.cs +++ b/CommunityBugFixCollection/PauseAnimatorUpdates.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.Runtime.CompilerServices; namespace CommunityBugFixCollection { @@ -12,6 +13,24 @@ internal sealed class PauseAnimatorUpdates : ResoniteBugFixMonkey Authors => Contributors.Banane9; + private class Float + { + public float Value; + + public Float(float value) + { + Value = value; + } + + public Float() + { + Value = 0f; + } + } + + + private static readonly ConditionalWeakTable _hasChangedPlayhead = new(); + private static bool Prefix(Animator __instance) { if (!Enabled) @@ -22,9 +41,11 @@ private static bool Prefix(Animator __instance) if (!__instance._fieldMappersValid) __instance.GenerateFieldMappers(); - if (__instance.IsPlaying) + + if (_hasChangedPlayhead.GetOrCreateValue(__instance).Value != __instance._playback.Position) { var position = __instance.Position; + _hasChangedPlayhead.GetOrCreateValue(__instance).Value = __instance.Position; foreach (var fieldMapper in __instance._fieldMappers) fieldMapper.Set(position); @@ -33,4 +54,6 @@ private static bool Prefix(Animator __instance) return false; } } + + } \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index b011017..55ce0c4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -39,6 +39,7 @@ C:\Program Files (x86)\Steam\steamapps\common\Resonite $(HOME)/.steam/steam/steamapps/common/Resonite D:/Files/Games/Resonite/app + D:\SteamLibrary\\steamapps\common\Resonite\ G:\SteamLibrary\steamapps\common\Resonite From 529fd3f91a9fe745b14b543dab58f19f1b440595 Mon Sep 17 00:00:00 2001 From: 989onan Date: Fri, 4 Jul 2025 23:07:10 -0400 Subject: [PATCH 2/5] stap --- .../PauseAnimatorUpdates.cs | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/CommunityBugFixCollection/PauseAnimatorUpdates.cs b/CommunityBugFixCollection/PauseAnimatorUpdates.cs index 5b276e6..4cd57be 100644 --- a/CommunityBugFixCollection/PauseAnimatorUpdates.cs +++ b/CommunityBugFixCollection/PauseAnimatorUpdates.cs @@ -15,24 +15,6 @@ internal sealed class PauseAnimatorUpdates : ResoniteBugFixMonkey Authors { get; } = [.. Contributors.Banane9, .. Contributors.Onan]; - private class Float - { - public float Value; - - public Float(float value) - { - Value = value; - } - - public Float() - { - Value = 0f; - } - } - - - private static readonly ConditionalWeakTable _hasChangedPlayhead = new(); - private static bool Prefix(Animator __instance) { if (!Enabled) @@ -62,6 +44,4 @@ private static bool Prefix(Animator __instance) return false; } } - - } \ No newline at end of file From e7e18deae133f71e09fc790e72e1d9d148d6bfa2 Mon Sep 17 00:00:00 2001 From: 989onan Date: Sat, 5 Jul 2025 01:39:01 -0400 Subject: [PATCH 3/5] well I tried this does what I asked it to do (first try actually!) But it doesn't do what I want. I just want objects when being grabbed not yoinking users into them if they have character parenters. I am too lazy to make a github issue it takes YDMS ages to fix litterally anything like this. --- .../FixGrabberYoinkingUsers.cs | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 CommunityBugFixCollection/FixGrabberYoinkingUsers.cs diff --git a/CommunityBugFixCollection/FixGrabberYoinkingUsers.cs b/CommunityBugFixCollection/FixGrabberYoinkingUsers.cs new file mode 100644 index 0000000..042fc48 --- /dev/null +++ b/CommunityBugFixCollection/FixGrabberYoinkingUsers.cs @@ -0,0 +1,110 @@ +using FrooxEngine; +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.CompilerServices; +using System.Reflection.Emit; +using Elements.Core; +using MonkeyLoader.Logging; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; + +namespace CommunityBugFixCollection +{ + [HarmonyPatchCategory(nameof(FixGrabberYoinkingUsers))] + [HarmonyPatch(typeof(Grabber))] + + internal sealed class FixGrabberYoinkingUsers : ResoniteBugFixMonkey + { + public override IEnumerable Authors => Contributors.Onan; + + private static IEnumerable Transpiler(IEnumerable Instructions) + { + Logger.Debug(() => $"Patching IL instructions!"); + Logger.Debug(() => $"Patching IL instructions!"); + Logger.Debug(() => $"Patching IL instructions!"); + Logger.Debug(() => $"Patching IL instructions!"); + Logger.Debug(() => $"Patching IL instructions!"); + Logger.Debug(() => $"Patching IL instructions!"); + Logger.Debug(() => $"Patching IL instructions!"); + Logger.Debug(() => $"Patching IL instructions!"); + List Instructions2 = new(Instructions); + + + object loadfield = Instructions2.Find((o) => + { + return o.opcode == OpCodes.Ldfld && o.operand.ToString().Contains("_grabbedObjects"); + }).operand; + + int injectLocation = Instructions2.FindIndex((o) => + { + return o.opcode == OpCodes.Call && o.operand.ToString().Contains("EndUndoBatch"); + }); + + Instructions2.InsertRange(injectLocation + 1, new CodeInstruction[]{ + new CodeInstruction(OpCodes.Ldarg_0), + new CodeInstruction(OpCodes.Ldarg_0), + new CodeInstruction(OpCodes.Ldfld, loadfield), + new CodeInstruction(OpCodes.Callvirt, AccessTools.DeclaredMethod(typeof(FixGrabberYoinkingUsers), nameof(CorrectGrabberPositionLaser)))} + ); + + + return Instructions2; + } + + private static IEnumerable TargetMethods() + { + Logger.Debug(() => $"Finding valid methods!"); + Logger.Debug(() => $"Finding valid methods!"); + Logger.Debug(() => $"Finding valid methods!"); + Logger.Debug(() => $"Finding valid methods!"); + Logger.Debug(() => $"Finding valid methods!"); + Logger.Debug(() => $"Finding valid methods!"); + Logger.Debug(() => $"Finding valid methods!"); + Logger.Debug(() => $"Finding valid methods!"); + Logger.Debug(() => $"Finding valid methods!"); + + var methodNames = new[] + { + AccessTools.DeclaredMethod(typeof(Grabber), nameof(Grabber.Grab), new Type[]{ typeof(List), typeof(bool)}) + }; + + return methodNames; + } + + public static void CorrectGrabberPositionLaser(Grabber __instance, List _grabbedObjects) + { + if (!Enabled) + return; + + float3 position = float3.Zero; + + float3[] positions_original = new float3[_grabbedObjects.Count]; + + for (int i = 0; i < positions_original.Length; i++) + { + position += _grabbedObjects[i].Slot.GlobalPosition; + positions_original[i] = _grabbedObjects[i].Slot.GlobalPosition; + } + + + position /= _grabbedObjects.Count; + + + + __instance.HolderSlot.GlobalPosition = position; + + for (int i = 0; i < positions_original.Length; i++) + { + _grabbedObjects[i].Slot.GlobalPosition = positions_original[i]; + } + + + Logger.Debug(() => $"Correcting grab position!"); + } + } + + +} \ No newline at end of file From 753d706a03ce9ef337380e8b1fefe2da66eaa15c Mon Sep 17 00:00:00 2001 From: 989onan Date: Wed, 10 Dec 2025 21:07:08 -0500 Subject: [PATCH 4/5] fix raycasts hitting gizmos I don't like the implementation, but it will do --- .../DontRaycastDeveloper.cs | 87 +++++++++++++++++++ Directory.Build.props | 1 - 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 CommunityBugFixCollection/DontRaycastDeveloper.cs diff --git a/CommunityBugFixCollection/DontRaycastDeveloper.cs b/CommunityBugFixCollection/DontRaycastDeveloper.cs new file mode 100644 index 0000000..98aca5a --- /dev/null +++ b/CommunityBugFixCollection/DontRaycastDeveloper.cs @@ -0,0 +1,87 @@ +using FrooxEngine; +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Text; + +namespace CommunityBugFixCollection +{ + [HarmonyPatchCategory(nameof(DontRaycastDeveloper))] + [HarmonyPatch(typeof(FrooxEngine.RaycastDriver), nameof(FrooxEngine.RaycastDriver.OnCommonUpdate))] + internal sealed class DontRaycastDeveloper : ResoniteBugFixMonkey + { + + public override IEnumerable Authors { get; } = [.. Contributors.Onan]; + + public static IEnumerable Transpiler(IEnumerable instructions) + { + //Debugger.Launch(); + List instructionList = [.. instructions]; + + + int index = 0; + int start = 0; + int stop = 0; + CodeInstruction Filter = new CodeInstruction(OpCodes.Nop); + foreach (CodeInstruction inst in instructionList) + { + + if (inst.operand?.ToString()?.Contains("IgnoreHierarchy") == true) + { + if(start == 0) + { + start = index; + } + + } + if (inst.operand?.ToString()?.ToLower()?.Contains("icollider") == true && inst.operand?.ToString()?.ToLower()?.Contains("bool") == true && inst.operand?.ToString()?.ToLower()?.Contains("invoke") == true) + { + if (stop == 0) + { + stop = index; + } + } + if (inst.opcode == OpCodes.Ldfld && inst.operand?.ToString()?.Contains("Filter") == true) + { + Filter = inst; + } + index++; + } + + + //note to self, loading "this" before trying to load a "this" variable on the stack is important - @989onan + List newinstructions = + [ + new CodeInstruction(OpCodes.Ldarg_0), + instructionList[start], + new CodeInstruction(OpCodes.Ldloc_S,8), + new CodeInstruction(OpCodes.Ldarg_0), + Filter, + new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(DontRaycastDeveloper), "DontRaycastDeveloperFilter")), + ]; + instructionList.RemoveRange(start-1, (stop+2) - start); + + + + instructionList.InsertRange(start - 1/*this is needed since start lands on "ignore hiearchy" which is at the beginning*/, newinstructions); + + + return instructionList; + + } + + + //recreates the if statement, allowing for full control over this check on raycasts and doing whatever we want. + public static bool DontRaycastDeveloperFilter(SyncRef IgnoreHierarchy, RaycastHit hit, SyncDelegate> Filter) { + if (!Enabled) + { + return (IgnoreHierarchy.Target == null || !hit.Collider.Slot.IsChildOf(IgnoreHierarchy.Target, true)) && (Filter.Target == null || Filter.Target(hit.Collider)); //this is where we use the default behavior. + } + return (IgnoreHierarchy.Target == null || !hit.Collider.Slot.IsChildOf(IgnoreHierarchy.Target, true)) && (Filter.Target == null || Filter.Target(hit.Collider)) && hit.Collider.Slot.FindParent(o=>o.Name == "Gizmo")?.GetComponent() == null; //this is where we can specify "STOP RAYCASTING DEVELOPER!!!" + } + } +} diff --git a/Directory.Build.props b/Directory.Build.props index 1c51a82..0ebc8dd 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,7 +13,6 @@ true - https://pkg.munally.com/MonkeyModdingTroop/index.json; https://nuget.pkg.github.com/ResoniteModdingGroup/index.json From 79ab9f55d8f03dad57e912588339471bdfddea6c Mon Sep 17 00:00:00 2001 From: 989onan Date: Wed, 10 Dec 2025 21:07:55 -0500 Subject: [PATCH 5/5] Revert "Merge branch 'master' of https://github.com/989onan/ResoniteCommunityBugFixCollection" This reverts commit 0ec1919e50fc78784fbadc6a66abf94b3537f77d, reversing changes made to 753d706a03ce9ef337380e8b1fefe2da66eaa15c. --- .../FixGrabberYoinkingUsers.cs | 110 ------------------ 1 file changed, 110 deletions(-) delete mode 100644 CommunityBugFixCollection/FixGrabberYoinkingUsers.cs diff --git a/CommunityBugFixCollection/FixGrabberYoinkingUsers.cs b/CommunityBugFixCollection/FixGrabberYoinkingUsers.cs deleted file mode 100644 index 042fc48..0000000 --- a/CommunityBugFixCollection/FixGrabberYoinkingUsers.cs +++ /dev/null @@ -1,110 +0,0 @@ -using FrooxEngine; -using HarmonyLib; -using System; -using System.Collections.Generic; -using System.Text; -using System.Runtime.CompilerServices; -using System.Reflection.Emit; -using Elements.Core; -using MonkeyLoader.Logging; -using System.Linq; -using System.Reflection; -using System.Xml.Linq; - -namespace CommunityBugFixCollection -{ - [HarmonyPatchCategory(nameof(FixGrabberYoinkingUsers))] - [HarmonyPatch(typeof(Grabber))] - - internal sealed class FixGrabberYoinkingUsers : ResoniteBugFixMonkey - { - public override IEnumerable Authors => Contributors.Onan; - - private static IEnumerable Transpiler(IEnumerable Instructions) - { - Logger.Debug(() => $"Patching IL instructions!"); - Logger.Debug(() => $"Patching IL instructions!"); - Logger.Debug(() => $"Patching IL instructions!"); - Logger.Debug(() => $"Patching IL instructions!"); - Logger.Debug(() => $"Patching IL instructions!"); - Logger.Debug(() => $"Patching IL instructions!"); - Logger.Debug(() => $"Patching IL instructions!"); - Logger.Debug(() => $"Patching IL instructions!"); - List Instructions2 = new(Instructions); - - - object loadfield = Instructions2.Find((o) => - { - return o.opcode == OpCodes.Ldfld && o.operand.ToString().Contains("_grabbedObjects"); - }).operand; - - int injectLocation = Instructions2.FindIndex((o) => - { - return o.opcode == OpCodes.Call && o.operand.ToString().Contains("EndUndoBatch"); - }); - - Instructions2.InsertRange(injectLocation + 1, new CodeInstruction[]{ - new CodeInstruction(OpCodes.Ldarg_0), - new CodeInstruction(OpCodes.Ldarg_0), - new CodeInstruction(OpCodes.Ldfld, loadfield), - new CodeInstruction(OpCodes.Callvirt, AccessTools.DeclaredMethod(typeof(FixGrabberYoinkingUsers), nameof(CorrectGrabberPositionLaser)))} - ); - - - return Instructions2; - } - - private static IEnumerable TargetMethods() - { - Logger.Debug(() => $"Finding valid methods!"); - Logger.Debug(() => $"Finding valid methods!"); - Logger.Debug(() => $"Finding valid methods!"); - Logger.Debug(() => $"Finding valid methods!"); - Logger.Debug(() => $"Finding valid methods!"); - Logger.Debug(() => $"Finding valid methods!"); - Logger.Debug(() => $"Finding valid methods!"); - Logger.Debug(() => $"Finding valid methods!"); - Logger.Debug(() => $"Finding valid methods!"); - - var methodNames = new[] - { - AccessTools.DeclaredMethod(typeof(Grabber), nameof(Grabber.Grab), new Type[]{ typeof(List), typeof(bool)}) - }; - - return methodNames; - } - - public static void CorrectGrabberPositionLaser(Grabber __instance, List _grabbedObjects) - { - if (!Enabled) - return; - - float3 position = float3.Zero; - - float3[] positions_original = new float3[_grabbedObjects.Count]; - - for (int i = 0; i < positions_original.Length; i++) - { - position += _grabbedObjects[i].Slot.GlobalPosition; - positions_original[i] = _grabbedObjects[i].Slot.GlobalPosition; - } - - - position /= _grabbedObjects.Count; - - - - __instance.HolderSlot.GlobalPosition = position; - - for (int i = 0; i < positions_original.Length; i++) - { - _grabbedObjects[i].Slot.GlobalPosition = positions_original[i]; - } - - - Logger.Debug(() => $"Correcting grab position!"); - } - } - - -} \ No newline at end of file