Skip to content

Commit a46d1fe

Browse files
Banane9art0007i
andcommitted
Prevents Grab World locomotion moving the player when activated
Adds a fix for Yellow-Dog-Man/Resonite-Issues#86 Co-authored-by: art0007i <art0007i@gmail.com>
1 parent 790e7a3 commit a46d1fe

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

CommunityBugFixCollection/Locale/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"CommunityBugFixCollection.NonHDRColorClamping.Description": "Korrigiert, dass die nicht-HDR Varianten der Color(X) Kanal-Additionen die Werte nicht limitieren.",
2929
"CommunityBugFixCollection.PauseAnimatorUpdates.Description": "Verhindert, dass Animatoren jeden Frame in alle assoziierten Felder schreiben, obwohl sie nicht am animieren sind.",
3030
"CommunityBugFixCollection.SmoothDraggables.Description": "Umgeht, dass Slider und Joints in Headless-Sessions verrutschen.",
31+
"CommunityBugFixCollection.StationaryGrabWorldActivation.Description": "Verhindert, dass die Welt-Greifen Fortbewegung den Spieler bei jeder Aktivierung bewegt.",
3132
"CommunityBugFixCollection.UserInspectorAsNonHost.Description": "Sorgt dafür, dass Benutzer-Inspektoren bereits präsente Benutzer auch in Sessions anzeigen, in denen man nicht der Host ist."
3233
}
3334
}

CommunityBugFixCollection/Locale/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"CommunityBugFixCollection.NonHDRColorClamping.Description": "Fixes non-HDR variants of Color(X) channel addition not clamping.",
2929
"CommunityBugFixCollection.PauseAnimatorUpdates.Description": "Fixes animators updating all associated fields every frame while enabled but not playing.",
3030
"CommunityBugFixCollection.SmoothDraggables.Description": "Workaround for Sliders and Joints snapping in sessions hosted by a headless.",
31+
"CommunityBugFixCollection.StationaryGrabWorldActivation.Description": "Stops the Grab World Locomotion from moving the player with each activiation.",
3132
"CommunityBugFixCollection.UserInspectorAsNonHost.Description": "Fixes UserInspectors not listing existing users in the session for non-host users."
3233
}
3334
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using FrooxEngine;
2+
using HarmonyLib;
3+
using MonkeyLoader.Resonite;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Reflection;
7+
using System.Text;
8+
9+
// Originally released under MIT-0 here:
10+
// https://github.com/art0007i/FixGrabWorld
11+
12+
namespace CommunityBugFixCollection
13+
{
14+
[HarmonyPatchCategory(nameof(StationaryGrabWorldActivation))]
15+
[HarmonyPatch(typeof(GrabWorldLocomotion), nameof(GrabWorldLocomotion.TryActivate))]
16+
internal sealed class StationaryGrabWorldActivation : ResoniteMonkey<StationaryGrabWorldActivation>
17+
{
18+
public override IEnumerable<string> Authors => Contributors.Art0007i;
19+
20+
public override bool CanBeDisabled => true;
21+
22+
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codes)
23+
{
24+
var directionReferenceGetter = AccessTools.PropertyGetter(typeof(ILocomotionReference), nameof(ILocomotionReference.DirectionReference));
25+
26+
foreach (var code in codes)
27+
{
28+
if (Enabled && code.Calls(directionReferenceGetter))
29+
code.operand = AccessTools.PropertyGetter(typeof(ILocomotionReference), nameof(ILocomotionReference.GripReference));
30+
31+
yield return code;
32+
}
33+
}
34+
}
35+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The issues fixed by this mod will be linked in the following list.
2020
If any of them have been closed and not removed from the mod,
2121
just disable them in the settings in the meantime.
2222

23+
* Grab World Locomotion moving the user forward a little every time it's activated (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/86)
2324
* Duplicating Components breaking drives (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/92)
2425
* Pressing Duplicate on the Component in an Inspector
2526
* Using the Component Clone Tool to duplicate them onto a slot

0 commit comments

Comments
 (0)