From b5bc5a130548d9bf632f2c81d00df6f987ad245c Mon Sep 17 00:00:00 2001 From: DaXcess Date: Thu, 18 Apr 2024 10:18:43 +0200 Subject: [PATCH 1/3] Change the way VerifyGameVersion finds the Assembly --- Source/Plugin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Plugin.cs b/Source/Plugin.cs index f9c1a5af..f8d5ca3d 100644 --- a/Source/Plugin.cs +++ b/Source/Plugin.cs @@ -139,7 +139,7 @@ private void Awake() private bool VerifyGameVersion() { - var location = typeof(PlayerControllerB).Assembly.Location; + var location = Path.Combine(Paths.ManagedPath, "Assembly-CSharp.dll"); var shasum = BitConverter.ToString(Utils.ComputeHash(File.ReadAllBytes(location))).Replace("-", ""); return GAME_ASSEMBLY_HASHES.Contains(shasum); From 3f626efde17981918ce06b7d26ec3f863b99efe4 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Thu, 18 Apr 2024 10:19:55 +0200 Subject: [PATCH 2/3] Bump version --- LCVR.csproj | 2 +- Source/Plugin.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LCVR.csproj b/LCVR.csproj index 44d48558..ffaf1108 100644 --- a/LCVR.csproj +++ b/LCVR.csproj @@ -4,7 +4,7 @@ netstandard2.1 LCVR Collecting Scrap in VR - 1.2.2 + 1.2.3 true 12.0 LethalCompanyVR diff --git a/Source/Plugin.cs b/Source/Plugin.cs index f8d5ca3d..fc02a9cd 100644 --- a/Source/Plugin.cs +++ b/Source/Plugin.cs @@ -34,7 +34,7 @@ public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "io.daxcess.lcvr"; public const string PLUGIN_NAME = "LCVR"; - public const string PLUGIN_VERSION = "1.2.2"; + public const string PLUGIN_VERSION = "1.2.3"; private readonly string[] GAME_ASSEMBLY_HASHES = [ "7CFABBA203022CC46EF309B0E651276CB59217AF6D38C34E2085E67957DBBCBD", // V50 From 35ad84d034c47261a0a4f5897f9a29efb504c4c6 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Sun, 12 May 2024 12:08:29 +0200 Subject: [PATCH 3/3] Hotfix 1.2.3 - Fixed error spam with enemy AI collision - Added config option to hide the settings button on the main menu - Added debug symbols to the assembly --- CHANGELOG.md | 12 +++++++ LCVR.csproj | 6 +++- Source/Config.cs | 4 ++- Source/Input/FingerCurler.cs | 44 ++++++++++++++++---------- Source/Patches/Spectating/AIPatches.cs | 14 +++++--- Source/Patches/UIPatches.cs | 3 ++ Source/Player/VRPlayer.cs | 3 +- Source/Plugin.cs | 2 +- 8 files changed, 62 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a31a6f53..b40acfb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# 1.2.3 + +**Bug Fixes**: +- Fixed issues with enemy collision that was causing error spam and potential other issues +- Changed the way `VerifyGameVersion` finds the game assembly, fixing some mod compatibility issues + +**Additions**: +- Added configuration option to disable the settings button on the main menu + +**Development Changes**: +- Added debug symbols in the assembly output if the mod is compiled in debug, which helps with tracking down errors + # 1.2.2 **Game Version**: diff --git a/LCVR.csproj b/LCVR.csproj index 44d48558..f38c8bfc 100644 --- a/LCVR.csproj +++ b/LCVR.csproj @@ -4,7 +4,7 @@ netstandard2.1 LCVR Collecting Scrap in VR - 1.2.2 + 1.2.3 true 12.0 LethalCompanyVR @@ -19,6 +19,10 @@ none + + embedded + + diff --git a/Source/Config.cs b/Source/Config.cs index 711c9002..51ddc59f 100644 --- a/Source/Config.cs +++ b/Source/Config.cs @@ -68,7 +68,9 @@ public class Config(ConfigFile file) public ConfigEntry LastInternalControllerProfile { get; } = file.Bind("Internal", "LastInternalControllerProfile", "", "FOR INTERNAL USE ONLY, DO NOT EDIT"); public ConfigEntry OpenXRRuntimeFile { get; } = file.Bind("Internal", "OpenXRRuntimeFile", "", "FOR INTERNAL USE ONLY, DO NOT EDIT"); - + public ConfigEntry DisableSettingsButton { get; } = file.Bind("Internal", "DisableSettingsButton", false, + "Disables the settings button on the main menu screen"); + public enum TurnProviderOption { Snap, diff --git a/Source/Input/FingerCurler.cs b/Source/Input/FingerCurler.cs index b79fdf1f..09db6674 100644 --- a/Source/Input/FingerCurler.cs +++ b/Source/Input/FingerCurler.cs @@ -34,7 +34,9 @@ public class Thumb(Transform root, Vector3 firstRotation, Vector3 secondRotation public float curl; - private readonly Quaternion bone01Rotation = Quaternion.AngleAxis(-30f, Vector3.right) * Quaternion.Euler(firstRotation); + private readonly Quaternion bone01Rotation = + Quaternion.AngleAxis(-30f, Vector3.right) * Quaternion.Euler(firstRotation); + private readonly Quaternion bone02Rotation = Quaternion.Euler(secondRotation); public void Update() @@ -46,29 +48,37 @@ public void Update() } } - public Thumb thumbFinger; - public Finger indexFinger; - public Finger middleFinger; - public Finger ringFinger; - public Finger pinkyFinger; + public readonly Thumb thumbFinger; + public readonly Finger indexFinger; + public readonly Finger middleFinger; + public readonly Finger ringFinger; + public readonly Finger pinkyFinger; public FingerCurler(Transform hand, bool isLeft) { if (isLeft) { - thumbFinger = new Thumb(hand.Find($"finger1.L"), new Vector3(35f, -90f, 0f), new Vector3(-25f, 0f, 3f)); - indexFinger = new Finger(hand.Find($"finger2.L"), isLeft, new Vector3(5f, -90f, 0f), new Vector3(3f, -3f, 33f)); - middleFinger = new Finger(hand.Find($"finger3.L"), isLeft, new Vector3(-182f, 90f, -176f), new Vector3(1f, -5f, 22f)); - ringFinger = new Finger(hand.Find($"finger4.L"), isLeft, new Vector3(186f, 90f, 177f), new Vector3(6f, -3f, 29f)); - pinkyFinger = new Finger(hand.Find($"finger5.L"), isLeft, new Vector3(183f, 80f, 176f), new Vector3(-17f, 8f, 27f)); + thumbFinger = new Thumb(hand.Find("finger1.L"), new Vector3(35f, -90f, 0f), new Vector3(-25f, 0f, 3f)); + indexFinger = new Finger(hand.Find("finger2.L"), true, new Vector3(5f, -90f, 0f), + new Vector3(3f, -3f, 33f)); + middleFinger = new Finger(hand.Find("finger3.L"), true, new Vector3(-182f, 90f, -176f), + new Vector3(1f, -5f, 22f)); + ringFinger = new Finger(hand.Find("finger4.L"), true, new Vector3(186f, 90f, 177f), + new Vector3(6f, -3f, 29f)); + pinkyFinger = new Finger(hand.Find("finger5.L"), true, new Vector3(183f, 80f, 176f), + new Vector3(-17f, 8f, 27f)); } else { - thumbFinger = new Thumb(hand.Find($"finger1.R"), new Vector3(143f, -90f, -180f), new Vector3(-26f, 0f, -5f)); - indexFinger = new Finger(hand.Find($"finger2.R"), isLeft, new Vector3(-193f, -90f, 176f), new Vector3(-9f, 0f, -21f)); - middleFinger = new Finger(hand.Find($"finger3.R"), isLeft, new Vector3(-186f, -90f, 180f), new Vector3(-6f, 0f, -24f)); - ringFinger = new Finger(hand.Find($"finger4.R"), isLeft, new Vector3(180f, -90f, -177f), new Vector3(-9f, 0f, -25f)); - pinkyFinger = new Finger(hand.Find($"finger5.R"), isLeft, new Vector3(182f, -90f, -168f), new Vector3(-13f, 3f, -33f)); + thumbFinger = new Thumb(hand.Find("finger1.R"), new Vector3(143f, -90f, -180f), new Vector3(-26f, 0f, -5f)); + indexFinger = new Finger(hand.Find("finger2.R"), false, new Vector3(-193f, -90f, 176f), + new Vector3(-9f, 0f, -21f)); + middleFinger = new Finger(hand.Find("finger3.R"), false, new Vector3(-186f, -90f, 180f), + new Vector3(-6f, 0f, -24f)); + ringFinger = new Finger(hand.Find("finger4.R"), false, new Vector3(180f, -90f, -177f), + new Vector3(-9f, 0f, -25f)); + pinkyFinger = new Finger(hand.Find("finger5.R"), false, new Vector3(182f, -90f, -168f), + new Vector3(-13f, 3f, -33f)); } } @@ -158,4 +168,4 @@ public void ForceFist(bool enabled) { forceFist = enabled; } -} +} \ No newline at end of file diff --git a/Source/Patches/Spectating/AIPatches.cs b/Source/Patches/Spectating/AIPatches.cs index 212abe9b..9ff8b053 100644 --- a/Source/Patches/Spectating/AIPatches.cs +++ b/Source/Patches/Spectating/AIPatches.cs @@ -92,7 +92,7 @@ private static IEnumerable LineOfSightClosestPlayerIgnoreDeadPl /// /// Prevent collision detection on dead players /// - [HarmonyPatch(typeof(EnemyAICollisionDetect), "OnTriggerStay")] + [HarmonyPatch(typeof(EnemyAICollisionDetect), nameof(EnemyAICollisionDetect.OnTriggerStay))] [HarmonyTranspiler] private static IEnumerable OnCollidePlayerTranspiler(IEnumerable instructions, ILGenerator generator) { @@ -100,11 +100,15 @@ private static IEnumerable OnCollidePlayerTranspiler(IEnumerabl .MatchForward(false, new CodeMatch(OpCodes.Brfalse)) .Advance(1) .InsertAndAdvance(new CodeInstruction(OpCodes.Ldarg_1)) - .InsertAndAdvance(new CodeInstruction(OpCodes.Callvirt, PropertyGetter(typeof(Component), nameof(Component.gameObject)))) - .InsertAndAdvance(new CodeInstruction(OpCodes.Callvirt, Method(typeof(GameObject), nameof(GameObject.GetComponent)).MakeGenericMethod([typeof(PlayerControllerB)]))) - .InsertAndAdvance(new CodeInstruction(OpCodes.Ldfld, Field(typeof(PlayerControllerB), nameof(PlayerControllerB.isPlayerDead)))) - .InsertBranchAndAdvance(OpCodes.Brfalse_S, 8) + .InsertAndAdvance(new CodeInstruction(OpCodes.Call, Method(typeof(SpectatorAIPatches), nameof(IsPlayerDead)))) + .InsertBranchAndAdvance(OpCodes.Brfalse_S, 6) .InsertAndAdvance(new CodeInstruction(OpCodes.Ret)) .InstructionEnumeration(); } + + private static bool IsPlayerDead(Component other) + { + var player = other.GetComponent(); + return player && player.isPlayerDead; + } } \ No newline at end of file diff --git a/Source/Patches/UIPatches.cs b/Source/Patches/UIPatches.cs index dcaa5b20..d19c1090 100644 --- a/Source/Patches/UIPatches.cs +++ b/Source/Patches/UIPatches.cs @@ -320,6 +320,9 @@ private static void OnMainMenuShown(MenuManager __instance) private static void InjectSettingsScreen() { + if (Plugin.Config.DisableSettingsButton.Value) + return; + // Add button to main menu var container = GameObject.Find("Canvas/MenuContainer"); var mainButtons = container.Find("MainButtons"); diff --git a/Source/Player/VRPlayer.cs b/Source/Player/VRPlayer.cs index 708f61ae..f3e298e0 100644 --- a/Source/Player/VRPlayer.cs +++ b/Source/Player/VRPlayer.cs @@ -389,7 +389,8 @@ private void Update() var rotationOffset = playerController.jetpackControls switch { - true => Quaternion.Euler(playerController.jetpackTurnCompass.eulerAngles.x, TurningProvider.GetRotationOffset(), playerController.jetpackTurnCompass.eulerAngles.z), + true => Quaternion.Euler(playerController.jetpackTurnCompass.eulerAngles.x, + TurningProvider.GetRotationOffset(), playerController.jetpackTurnCompass.eulerAngles.z), false => Quaternion.Euler(0, TurningProvider.GetRotationOffset(), 0) }; diff --git a/Source/Plugin.cs b/Source/Plugin.cs index f9c1a5af..7b884080 100644 --- a/Source/Plugin.cs +++ b/Source/Plugin.cs @@ -34,7 +34,7 @@ public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "io.daxcess.lcvr"; public const string PLUGIN_NAME = "LCVR"; - public const string PLUGIN_VERSION = "1.2.2"; + public const string PLUGIN_VERSION = "1.2.3"; private readonly string[] GAME_ASSEMBLY_HASHES = [ "7CFABBA203022CC46EF309B0E651276CB59217AF6D38C34E2085E67957DBBCBD", // V50