Skip to content

Commit 27d7e02

Browse files
committed
Small 1.1.2 stuff
- Potential host hotswap fixes - VR prefix compat fix - Disable movement normalization
1 parent 70077a3 commit 27d7e02

File tree

8 files changed

+44
-5
lines changed

8 files changed

+44
-5
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# 1.1.2
2+
3+
**Changes**:
4+
- Disabled movement normalization (configurable in input settings)
5+
6+
**Fixes**:
7+
- Additional hotfixes with hotswapping as host
8+
- Fixed LobbyImprovements VR prefix issue
9+
110
# 1.1.1
211

312
**Additions**:

Preload/RepoXR.Preload.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netstandard2.1</TargetFramework>
55
<Description>RepoXR Preloader</Description>
66
<Authors>DaXcess</Authors>
7-
<Version>1.1.1</Version>
7+
<Version>1.1.2</Version>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
99
<LangVersion>latest</LangVersion>
1010
<Title>RepoXR.Preload</Title>

RepoXR.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>Collecting Valuables in VR</Description>
5-
<Version>1.1.1</Version>
5+
<Version>1.1.2</Version>
66
<Authors>DaXcess</Authors>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
88
<LangVersion>latest</LangVersion>

Source/Config.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ public class Config(string assemblyPath, ConfigFile file)
9393
"The amount of rotation that is applied when performing a snap turn. Requires turn provider to be set to snap.",
9494
new AcceptableValueRange<float>(10, 180)));
9595

96+
[ConfigDescriptor]
97+
public ConfigEntry<bool> NormalizeMovement { get; } = file.Bind("Input", nameof(NormalizeMovement), false,
98+
"When enabled, any direction you move in will always be at full speed, even when the stick is only pushed slightly.");
99+
96100
// Rendering configuration
97101

98102
[ConfigDescriptor(stepSize: 5f, suffix: "%")]

Source/Managers/HotswapManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ private static void RestartScene()
6767
}
6868

6969
if (SemiFunc.IsMultiplayer())
70-
RunManager.instance.gameOver = true;
70+
{
71+
NetworkManager.instance.DestroyAll();
72+
RunManager.instance.ChangeLevel(false, false, RunManager.ChangeLevelType.LobbyMenu);
73+
return;
74+
}
7175

7276
RunManager.instance.RestartScene();
7377
}

Source/Patches/Player/PlayerControllerPatches.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.Reflection.Emit;
34
using HarmonyLib;
45
using UnityEngine;
@@ -22,4 +23,24 @@ private static IEnumerable<CodeInstruction> ApplyCorrectWalkingForce(IEnumerable
2223
.SetOperandAndAdvance(PropertyGetter(typeof(Transform), nameof(Transform.rotation)))
2324
.InstructionEnumeration();
2425
}
26+
27+
/// <summary>
28+
/// Only apply movement normalization if it's configured to do so
29+
/// </summary>
30+
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.FixedUpdate))]
31+
[HarmonyTranspiler]
32+
private static IEnumerable<CodeInstruction> ConditionalApplyNormalizedMove(
33+
IEnumerable<CodeInstruction> instructions)
34+
{
35+
return new CodeMatcher(instructions)
36+
.MatchForward(false,
37+
new CodeMatch(OpCodes.Call, PropertyGetter(typeof(Vector3), nameof(Vector3.normalized))))
38+
.Set(OpCodes.Call, ((Func<Vector3, Vector3>)ConditionalNormalize).Method)
39+
.Advance(-2)
40+
.RemoveInstructions(2)
41+
.InstructionEnumeration();
42+
43+
static Vector3 ConditionalNormalize(Vector3 input) =>
44+
Plugin.Config.NormalizeMovement.Value ? input.normalized : input;
45+
}
2546
}

Source/Patches/UI/PlayerNamePrefixPatches.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static bool HostIsInVR(MenuPageLobby lobby) => lobby.lobbyPlayers.Any(player =>
6565
/// </summary>
6666
[HarmonyPatch(typeof(MenuPageLobby), nameof(MenuPageLobby.Update))]
6767
[HarmonyPostfix]
68+
[HarmonyPriority(Priority.Last)]
6869
private static void LobbyMenuShowPrefix(MenuPageLobby __instance)
6970
{
7071
foreach (var player in __instance.listObjects.Select(entry => entry.GetComponent<MenuPlayerListed>())

Source/Plugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class Plugin : BaseUnityPlugin
2020
{
2121
public const string PLUGIN_GUID = "io.daxcess.repoxr";
2222
public const string PLUGIN_NAME = "RepoXR";
23-
public const string PLUGIN_VERSION = "1.1.1";
23+
public const string PLUGIN_VERSION = "1.1.2";
2424

2525
#if DEBUG
2626
private const string SKIP_CHECKSUM_VAR = $"--repoxr-skip-checksum={PLUGIN_VERSION}-dev";

0 commit comments

Comments
 (0)