From 3416f9adc441a720f16d538a9f1a74b9ff43558a Mon Sep 17 00:00:00 2001 From: DaXcess Date: Tue, 17 Sep 2024 09:36:47 +0200 Subject: [PATCH 01/12] Fix player animation execution order errors --- Source/Networking/VRNetPlayer.cs | 41 +++++++++++++++++------ Source/Patches/PlayerControllerPatches.cs | 23 +------------ Source/Player/VRPlayer.cs | 4 ++- Source/Plugin.cs | 2 +- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/Source/Networking/VRNetPlayer.cs b/Source/Networking/VRNetPlayer.cs index 869df166..2d147d0d 100644 --- a/Source/Networking/VRNetPlayer.cs +++ b/Source/Networking/VRNetPlayer.cs @@ -15,7 +15,6 @@ namespace LCVR.Networking; /// /// A behaviour that is attached to other VR players /// -[DefaultExecutionOrder(-100)] public class VRNetPlayer : MonoBehaviour { private GameObject playerGhost; @@ -171,6 +170,9 @@ private void Awake() else component.enabled = true; } + + // Create a "prefix" script that runs before other game scripts + gameObject.AddComponent(); } private void BuildVRRig() @@ -247,6 +249,8 @@ private void BuildVRRig() private void Update() { + UpdateIKWeights(); + // Apply crouch offset crouchOffset = Mathf.Lerp(crouchOffset, crouchState switch { @@ -295,8 +299,6 @@ private void Update() private void LateUpdate() { - UpdateBones(); - var positionOffset = new Vector3(0, crouchState switch { CrouchState.Roomscale => 0.1f, @@ -370,14 +372,8 @@ private void LateUpdate() if (StartOfRound.Instance.localPlayerController.localVisorTargetPoint is not null) usernameBillboard.LookAt(StartOfRound.Instance.localPlayerController.localVisorTargetPoint); } - - private void UpdateBones() - { - Bones.ServerItemHolder.localPosition = new Vector3(0.002f, 0.056f, -0.046f); - Bones.ServerItemHolder.localRotation = Quaternion.identity; - } - public void UpdateIKWeights() + private void UpdateIKWeights() { // Constants PlayerController.cameraLookRig1.weight = 0.45f; @@ -566,6 +562,31 @@ public class PlayerData { public bool DisableSteeringWheel { get; set; } } + + /// + /// A script for remote VR players that runs before other scripts in the game + /// + [DefaultExecutionOrder(-100)] + private class VRNetPlayerEarly : MonoBehaviour + { + private VRNetPlayer player; + + private void Awake() + { + player = GetComponent(); + } + + private void LateUpdate() + { + UpdateBones(); + } + + private void UpdateBones() + { + player.Bones.ServerItemHolder.localPosition = new Vector3(0.002f, 0.056f, -0.046f); + player.Bones.ServerItemHolder.localRotation = Quaternion.identity; + } + } } [Serialize] diff --git a/Source/Patches/PlayerControllerPatches.cs b/Source/Patches/PlayerControllerPatches.cs index dc63a687..d33ae2f6 100644 --- a/Source/Patches/PlayerControllerPatches.cs +++ b/Source/Patches/PlayerControllerPatches.cs @@ -357,7 +357,7 @@ static Vector3 GetClampedCameraPosition(PlayerControllerB player) } /// - /// Allow interacting with items even when we're inside of a special menu + /// Allow interacting with items even when we're inside a special menu /// [HarmonyPatch(typeof(PlayerControllerB), nameof(PlayerControllerB.ActivateItem_performed))] [HarmonyTranspiler] @@ -377,27 +377,6 @@ private static IEnumerable AllowActivateDuringMenu(IEnumerable< [HarmonyPatch] internal static class UniversalPlayerControllerPatches { - /// - /// Prevent the use of the secondary arm rigs, so that VR arms still freely move when inside the Company Cruiser - /// - [HarmonyPatch(typeof(PlayerControllerB), nameof(PlayerControllerB.Update))] - [HarmonyPostfix] - private static void KeepRigConstraints(PlayerControllerB __instance) - { - // Handle IK for local player - if (VRSession.InVR && __instance.IsLocalPlayer() && VRSession.Instance is {} session) - { - session.LocalPlayer.UpdateIKWeights(); - return; - } - - // Handle IK for remote player - if (NetworkSystem.Instance.TryGetPlayer((ushort)__instance.playerClientId, out var player)) - { - player.UpdateIKWeights(); - } - } - /// /// Disable the EnterLadder animation to fix some clunkyness with holding items /// diff --git a/Source/Player/VRPlayer.cs b/Source/Player/VRPlayer.cs index 7b34cd5b..aa6e98b2 100644 --- a/Source/Player/VRPlayer.cs +++ b/Source/Player/VRPlayer.cs @@ -482,6 +482,8 @@ private void ResetHeight_performed(InputAction.CallbackContext obj) private void Update() { + UpdateIKWeights(); + // Make sure the XR Origin has the same parent as the player if (xrOrigin.parent != transform.parent) { @@ -720,7 +722,7 @@ private void OnDestroy() Actions.Instance["Reset Height"].performed -= ResetHeight_performed; } - public void UpdateIKWeights() + private void UpdateIKWeights() { // Constants PlayerController.cameraLookRig1.weight = 0.45f; diff --git a/Source/Plugin.cs b/Source/Plugin.cs index 58ba3d0a..7e0dcbff 100644 --- a/Source/Plugin.cs +++ b/Source/Plugin.cs @@ -25,7 +25,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.3.3"; + public const string PLUGIN_VERSION = "1.3.4"; #if DEBUG private const string SKIP_CHECKSUM_VAR = $"--lcvr-skip-checksum={PLUGIN_VERSION}-dev"; From 8d75508369b2799dccb47fe27fbd9fae80bdf961 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Mon, 23 Sep 2024 11:05:29 +0200 Subject: [PATCH 02/12] Apply turn provider rotations to player instantly --- README.md | 1 + Source/Input/SmoothTurningProvider.cs | 6 ++++-- Source/Input/SnapTurningProvider.cs | 17 ++++++++++------- Source/Input/TurningProvider.cs | 5 +++-- Source/Player/VRPlayer.cs | 2 +- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 34a8725a..6a0ca05a 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ Here is a list of LCVR versions and which version(s) of Lethal Company it suppor | LCVR | Lethal Company | |-------------------|-------------------| +| v1.3.4 *(BETA)* | V64 and V64.1 | | v1.3.3 *(LATEST)* | V64 and V64.1 | | v1.3.2 | V64 | | v1.3.1 | V62 | diff --git a/Source/Input/SmoothTurningProvider.cs b/Source/Input/SmoothTurningProvider.cs index a1128a70..29e529dc 100644 --- a/Source/Input/SmoothTurningProvider.cs +++ b/Source/Input/SmoothTurningProvider.cs @@ -7,17 +7,19 @@ internal class SmoothTurningProvider : TurningProvider { private float offset; - public void Update() + public float Update() { var value = Actions.Instance["Turn"].ReadValue(); var shouldExecute = MathF.Abs(value) > 0.75; if (!shouldExecute) - return; + return 0; var totalRotation = (value > 0 ? 180 : -180) * Time.deltaTime * Plugin.Config.SmoothTurnSpeedModifier.Value; offset += totalRotation; + + return totalRotation; } public void SetOffset(float offset) diff --git a/Source/Input/SnapTurningProvider.cs b/Source/Input/SnapTurningProvider.cs index 91d0362b..3c688aba 100644 --- a/Source/Input/SnapTurningProvider.cs +++ b/Source/Input/SnapTurningProvider.cs @@ -7,7 +7,7 @@ internal class SnapTurningProvider : TurningProvider private bool turnedLastInput; private float offset; - public void Update() + public float Update() { var value = Actions.Instance["Turn"].ReadValue(); var shouldExecute = MathF.Abs(value) > 0.75; @@ -15,15 +15,18 @@ public void Update() if (shouldExecute) { var turnAmount = Plugin.Config.SnapTurnSize.Value; - if (turnedLastInput) return; + if (turnedLastInput) return 0; + turnAmount = value > 0 ? turnAmount : -turnAmount; turnedLastInput = true; - offset += value > 0 ? turnAmount : -turnAmount; - } - else - { - turnedLastInput = false; + offset += turnAmount; + + return turnAmount; } + + turnedLastInput = false; + + return 0; } public void SetOffset(float offset) diff --git a/Source/Input/TurningProvider.cs b/Source/Input/TurningProvider.cs index 8a24dd67..91ea478f 100644 --- a/Source/Input/TurningProvider.cs +++ b/Source/Input/TurningProvider.cs @@ -2,7 +2,7 @@ public interface TurningProvider { - void Update(); + float Update(); void SetOffset(float offset); @@ -20,7 +20,8 @@ public void SetOffset(float _) { } - public void Update() + public float Update() { + return 0; } } diff --git a/Source/Player/VRPlayer.cs b/Source/Player/VRPlayer.cs index aa6e98b2..a549ac7d 100644 --- a/Source/Player/VRPlayer.cs +++ b/Source/Player/VRPlayer.cs @@ -564,7 +564,7 @@ PlayerController.currentTriggerInAnimationWith is not null && // Update rotation offset after adding movement from frame (if not in build mode) if (!ShipBuildModeManager.Instance.InBuildMode && !PlayerController.inSpecialInteractAnimation) - TurningProvider.Update(); + transform.localEulerAngles += TurningProvider.Update() * Vector3.up; // If we are in special animation allow 6 DOF but don't update player position if (!PlayerController.inSpecialInteractAnimation) From 98f65f0080e809edca565209b55d7517dc6e22b6 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Mon, 23 Sep 2024 11:15:33 +0200 Subject: [PATCH 03/12] Remove car ownership patches --- Source/Patches/CarPatches.cs | 45 ---------------------------- Source/Patches/Spectating/Patches.cs | 18 ----------- Source/Plugin.cs | 14 ++++----- 3 files changed, 6 insertions(+), 71 deletions(-) diff --git a/Source/Patches/CarPatches.cs b/Source/Patches/CarPatches.cs index d22539de..10f54a5b 100644 --- a/Source/Patches/CarPatches.cs +++ b/Source/Patches/CarPatches.cs @@ -59,49 +59,4 @@ private static IEnumerable RemovePlayerAnimations(IEnumerable - /// If we are the host, and we're dead, move the ownership to the first alive player to not interfere with the collision - /// - [HarmonyPatch(typeof(VehicleController), nameof(VehicleController.RemovePlayerControlOfVehicleServerRpc))] - [HarmonyPostfix] - private static void OnRemoveDriver(VehicleController __instance) - { - if (Plugin.Flags.HasFlag(Flags.ExperimentalDisableCarOwnershipPatch)) - return; - - if (!NetworkManager.Singleton.IsHost) - return; - - if (!VRSession.Instance.LocalPlayer.PlayerController.isPlayerDead) - return; - - var alivePlayer = StartOfRound.Instance.allPlayerScripts.FirstOrDefault(player => !player.isPlayerDead); - if (!alivePlayer) - return; - - __instance.syncCarPositionInterval = 1f; - __instance.syncedPosition = Vector3.zero; - __instance.syncedRotation = Quaternion.identity; - __instance.SyncCarPhysicsToOtherClients(); - - __instance.NetworkObject.ChangeOwnership(alivePlayer.actualClientId); - } - - /// - /// Make sure to take back ownership once we leave the level - /// - [HarmonyPatch(typeof(StartOfRound), nameof(StartOfRound.ShipHasLeft))] - [HarmonyPostfix] - private static void OnUnloadMap() - { - if (Plugin.Flags.HasFlag(Flags.ExperimentalDisableCarOwnershipPatch)) - return; - - if (!NetworkManager.Singleton.IsServer) - return; - - foreach (var vehicle in Object.FindObjectsOfType()) - vehicle.NetworkObject.ChangeOwnership(StartOfRound.Instance.localPlayerController.actualClientId); - } } diff --git a/Source/Patches/Spectating/Patches.cs b/Source/Patches/Spectating/Patches.cs index bd6904fe..e93af03b 100644 --- a/Source/Patches/Spectating/Patches.cs +++ b/Source/Patches/Spectating/Patches.cs @@ -125,24 +125,6 @@ private static void OnPlayerDeath(PlayerControllerB __instance) shipDoorLeft.GetComponent().isTrigger = true; shipDoorRight.GetComponent().isTrigger = true; shipDoorWall.GetComponent().isTrigger = true; - - // Make sure any cars are not owned by us if we're the host - if (NetworkManager.Singleton.IsHost && !Plugin.Flags.HasFlag(Flags.ExperimentalDisableCarOwnershipPatch)) - { - var alivePlayer = StartOfRound.Instance.allPlayerScripts.FirstOrDefault(player => !player.isPlayerDead); - if (alivePlayer) - { - foreach (var car in Object.FindObjectsOfType().Where(car => car.IsOwner)) - { - car.syncCarPositionInterval = 1f; - car.syncedPosition = Vector3.zero; - car.syncedRotation = Quaternion.identity; - car.SyncCarPhysicsToOtherClients(); - - car.NetworkObject.ChangeOwnership(alivePlayer.actualClientId); - } - } - } // Of course, Nutcracker with special AI behavior var nutcrackers = Object.FindObjectsOfType(); diff --git a/Source/Plugin.cs b/Source/Plugin.cs index 7e0dcbff..838bf5ce 100644 --- a/Source/Plugin.cs +++ b/Source/Plugin.cs @@ -91,9 +91,6 @@ private void Awake() if (args.Contains("--lcvr-item-offset-editor")) Flags |= Flags.ItemOffsetEditor; - if (args.Contains("--lcvr-disable-car-ownership-patch")) - Flags |= Flags.ExperimentalDisableCarOwnershipPatch; - // Verify game assembly to detect compatible version var allowUnverified = Environment.GetCommandLineArgs().Contains(SKIP_CHECKSUM_VAR); @@ -154,18 +151,18 @@ private static string GetCommitHash() catch { LCVR.Logger.LogWarning( - "Failed to retrieve commit hash (compiled outside of git repo?). Using placeholder."); + "Failed to retrieve commit hash (compiled outside of git repo?)."); - return "badbeef"; + return "unknown"; } } private bool VerifyGameVersion() { var location = Path.Combine(Paths.ManagedPath, "Assembly-CSharp.dll"); - var shasum = BitConverter.ToString(Utils.ComputeHash(File.ReadAllBytes(location))).Replace("-", ""); + var hash = BitConverter.ToString(Utils.ComputeHash(File.ReadAllBytes(location))).Replace("-", ""); - return GAME_ASSEMBLY_HASHES.Contains(shasum); + return GAME_ASSEMBLY_HASHES.Contains(hash); } private bool LoadEarlyRuntimeDependencies() @@ -254,6 +251,8 @@ private bool InitializeVR() return true; } + // ReSharper disable Unity.PerformanceAnalysis + /// /// Modify the splash screen logo /// @@ -285,5 +284,4 @@ public enum Flags InvalidGameAssembly = 1 << 1, InteractableDebug = 1 << 2, ItemOffsetEditor = 1 << 3, - ExperimentalDisableCarOwnershipPatch = 1 << 4, } From 6f11c6c7a7540678316094ef5f994767cb530b18 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Mon, 23 Sep 2024 15:36:09 +0200 Subject: [PATCH 04/12] Docs --- CHANGELOG.md | 9 +++++++++ Docs/Thunderstore/README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fefb1822..d3493e69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# 1.3.4 + +**Changes**: +- Stick-turning will now instantly apply rotation to the player body +- Removed car ownership patches, which potentially fixes the car exploding at random times + +**Bug fixes**: +- Fixed player head rotation being applied in the wrong order + # 1.3.3 **Additions**: diff --git a/Docs/Thunderstore/README.md b/Docs/Thunderstore/README.md index 9bea13ea..fe97f0be 100644 --- a/Docs/Thunderstore/README.md +++ b/Docs/Thunderstore/README.md @@ -59,7 +59,8 @@ Here is a list of LCVR versions and which version(s) of Lethal Company it suppor | LCVR | Lethal Company | |-------------------|-------------------| -| v1.3.3 *(LATEST)* | V64 and V64.1 | +| v1.3.4 *(LATEST)* | V64 and V64.1 | +| v1.3.3 | V64 and V64.1 | | v1.3.2 | V64 | | v1.3.1 | V62 | | v1.3.0 | V56 | From 30b5e984baca931b8226e0f35ad9255d1aa95fd9 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Tue, 24 Sep 2024 11:19:52 +0200 Subject: [PATCH 05/12] Fix CullFactory timing issue --- CHANGELOG.md | 1 + Source/Compatibility/CullFactory/Patches.cs | 35 +++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3493e69..c2f33aa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ **Bug fixes**: - Fixed player head rotation being applied in the wrong order +- Fixed CullFactory breaking item rendering when traversing an entrance # 1.3.3 diff --git a/Source/Compatibility/CullFactory/Patches.cs b/Source/Compatibility/CullFactory/Patches.cs index e6644d0a..9bb8bbaf 100644 --- a/Source/Compatibility/CullFactory/Patches.cs +++ b/Source/Compatibility/CullFactory/Patches.cs @@ -1,8 +1,15 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection.Emit; using CullFactory.Data; +using CullFactory.Extenders; +using GameNetcodeStuff; using HarmonyLib; using LCVR.Patches; using LCVR.Player; using UnityEngine; +using static HarmonyLib.AccessTools; namespace LCVR.Compatibility.CullFactory; @@ -26,4 +33,32 @@ private static void OnCollectAllPlayerLights() DynamicObjects.allPlayerLights[clientId] = [..lights, ..cameraLights]; } + + /// + /// Rather interesting patch that delays the player teleport code in CullFactory by a single frame + /// + /// Fixes items turning invisible due to CullFactory thinking they're inside/outside the factory whilst we are not + /// + [HarmonyPatch(typeof(TeleportExtender), nameof(TeleportExtender.OnPlayerTeleported))] + [HarmonyTranspiler] + private static IEnumerable DelayPlayerTeleport(IEnumerable instructions) + { + return new CodeMatcher(instructions) + .MatchForward(false, new CodeMatch(OpCodes.Call, + Method(typeof(DynamicObjects), nameof(DynamicObjects.OnPlayerTeleported)))) + .SetOperandAndAdvance(((Action)OnPlayerTeleport).Method) + .InstructionEnumeration(); + + static void OnPlayerTeleport(PlayerControllerB player) + { + StartOfRound.Instance.StartCoroutine(OnPlayerTeleportedCoroutine(player)); + } + + static IEnumerator OnPlayerTeleportedCoroutine(PlayerControllerB player) + { + yield return null; + + DynamicObjects.OnPlayerTeleported(player); + } + } } From 298b9526c4fb91bae84a87be58f474ec39e8b134 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Tue, 24 Sep 2024 15:02:27 +0200 Subject: [PATCH 06/12] Many fixes - Fix arm syncing - Fix hand snapping - Fix some BS crash --- CHANGELOG.md | 3 + Source/Networking/VRNetPlayer.cs | 65 +++++++++++-------- Source/Patches/GameNetworkManagerPatches.cs | 32 +++++++++ Source/Patches/QuickMenuManagerPatches.cs | 4 +- .../Physics/Interactions/Car/SteeringWheel.cs | 25 ++++--- Source/Player/VRPlayer.cs | 27 ++++---- 6 files changed, 106 insertions(+), 50 deletions(-) create mode 100644 Source/Patches/GameNetworkManagerPatches.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index c2f33aa7..304ecc2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,14 @@ **Changes**: - Stick-turning will now instantly apply rotation to the player body +- Improved tracking accuracy for remote VR players - Removed car ownership patches, which potentially fixes the car exploding at random times **Bug fixes**: - Fixed player head rotation being applied in the wrong order - Fixed CullFactory breaking item rendering when traversing an entrance +- Fixed a crash when leaving the game while on top of a car (?) +- Fixed snap points not working for remote VR players # 1.3.3 diff --git a/Source/Networking/VRNetPlayer.cs b/Source/Networking/VRNetPlayer.cs index 2d147d0d..f7b76b8d 100644 --- a/Source/Networking/VRNetPlayer.cs +++ b/Source/Networking/VRNetPlayer.cs @@ -29,6 +29,8 @@ public class VRNetPlayer : MonoBehaviour private Transform rightController; private Transform leftHandVRTarget; private Transform rightHandVRTarget; + private Transform leftArmRigTarget; + private Transform rightArmRigTarget; private TwoBoneIKConstraint leftArmVRRig; private TwoBoneIKConstraint rightArmVRRig; @@ -39,7 +41,7 @@ public class VRNetPlayer : MonoBehaviour private Transform camera; private float cameraFloorOffset; - private float rotationOffset; + private Vector3 rotationOffset; private Vector3 cameraEulers; private Vector3 cameraPosAccounted; @@ -77,19 +79,24 @@ private void Awake() xrOrigin = new GameObject("XR Origin").transform; xrOrigin.localPosition = Vector3.zero; xrOrigin.localEulerAngles = Vector3.zero; - xrOrigin.localScale = Vector3.one; + xrOrigin.localScale = Vector3.one * VRPlayer.SCALE_FACTOR; // Create controller objects & VR targets leftController = new GameObject("Left Controller").transform; rightController = new GameObject("Right Controller").transform; leftHandVRTarget = new GameObject("Left Hand VR Target").transform; rightHandVRTarget = new GameObject("Right Hand VR Target").transform; + leftArmRigTarget = new GameObject("Left Hand Rig Target").transform; + rightArmRigTarget = new GameObject("Right Hand Rig Target").transform; leftController.SetParent(xrOrigin, false); rightController.SetParent(xrOrigin, false); leftHandVRTarget.SetParent(leftController, false); rightHandVRTarget.SetParent(rightController, false); + + leftArmRigTarget.SetParent(xrOrigin, false); + rightArmRigTarget.SetParent(xrOrigin, false); rightHandVRTarget.localPosition = new Vector3(0.0279f, 0.0353f, -0.0044f); rightHandVRTarget.localEulerAngles = new Vector3(0, 90, 168); @@ -113,6 +120,7 @@ private void Awake() RightItemHolder.localPosition = new Vector3(-0.002f, 0.036f, -0.042f); RightItemHolder.localEulerAngles = new Vector3(356.3837f, 357.6979f, 0.1453f); + cleanupPool.Add(xrOrigin.gameObject); cleanupPool.Add(LeftItemHolder.gameObject); cleanupPool.Add(RightItemHolder.gameObject); @@ -205,7 +213,7 @@ private void BuildVRRig() leftArmVRRig.data.root = Bones.LeftUpperArm; leftArmVRRig.data.mid = Bones.LeftLowerArm; leftArmVRRig.data.tip = Bones.LeftHand; - leftArmVRRig.data.target = leftHandVRTarget; + leftArmVRRig.data.target = leftArmRigTarget; leftArmVRRig.data.hint = leftArmRigHint; leftArmVRRig.data.hintWeight = 1; leftArmVRRig.data.targetRotationWeight = 1; @@ -237,7 +245,7 @@ private void BuildVRRig() rightArmVRRig.data.root = Bones.RightUpperArm; rightArmVRRig.data.mid = Bones.RightLowerArm; rightArmVRRig.data.tip = Bones.RightHand; - rightArmVRRig.data.target = rightHandVRTarget; + rightArmVRRig.data.target = rightArmRigTarget; rightArmVRRig.data.hint = rightArmRigHint; rightArmVRRig.data.hintWeight = 1; rightArmVRRig.data.targetRotationWeight = 1; @@ -259,15 +267,18 @@ private void Update() }, 0.2f); // Apply origin transforms - xrOrigin.position = transform.position; - + if (xrOrigin.parent != transform.parent) + xrOrigin.parent = transform.parent; + // If we are in special animation allow 6 DOF but don't update player position if (!PlayerController.inSpecialInteractAnimation) { - xrOrigin.position = new Vector3( - transform.position.x + (modelOffset.x * 1.5f) - (cameraPosAccounted.x * 1.5f), - transform.position.y, - transform.position.z + (modelOffset.z * 1.5f) - (cameraPosAccounted.z * 1.5f) + xrOrigin.localPosition = new Vector3( + transform.localPosition.x + modelOffset.x * VRPlayer.SCALE_FACTOR - + cameraPosAccounted.x * VRPlayer.SCALE_FACTOR * transform.localScale.x, + transform.localPosition.y, + transform.localPosition.z + modelOffset.z * VRPlayer.SCALE_FACTOR - + cameraPosAccounted.z * VRPlayer.SCALE_FACTOR * transform.localScale.z ); Bones.Model.localPosition = transform.InverseTransformPoint(transform.position + modelOffset) + @@ -275,22 +286,23 @@ private void Update() } else { - xrOrigin.position = transform.position + specialAnimationPositionOffset; + xrOrigin.localPosition = transform.localPosition + specialAnimationPositionOffset; Bones.Model.localPosition = Vector3.zero; } // Apply car animation offset var carOffset = PlayerController.inVehicleAnimation ? -0.5f : 0f; - xrOrigin.position += new Vector3(0, - cameraFloorOffset + crouchOffset - PlayerController.sinkingValue * 2.5f + carOffset, 0); - xrOrigin.eulerAngles = new Vector3(0, rotationOffset, 0); - xrOrigin.localScale = Vector3.one * 1.5f; + xrOrigin.localPosition += new Vector3(0, + cameraFloorOffset + crouchOffset - PlayerController.sinkingValue * 2.5f + + carOffset, 0) * + transform.localScale.y; + xrOrigin.localEulerAngles = rotationOffset; // Arms need to be moved forward when crouched if (crouchState != CrouchState.None) - xrOrigin.position += transform.forward * 0.55f; - + xrOrigin.localPosition += transform.forward * 0.2f; + usernameAlpha.alpha -= Time.deltaTime; // Set camera (head) rotation @@ -324,14 +336,14 @@ private void LateUpdate() return; } - Bones.LeftArmRigTarget.position = leftOverride.transform.TransformPoint(leftOverride.positionOffset); - Bones.LeftArmRigTarget.rotation = + leftArmRigTarget.position = leftOverride.transform.TransformPoint(leftOverride.positionOffset); + leftArmRigTarget.rotation = leftOverride.transform.rotation * Quaternion.Euler(leftOverride.rotationOffset); } else { - Bones.LeftArmRigTarget.position = leftHandVRTarget.position + positionOffset; - Bones.LeftArmRigTarget.rotation = leftHandVRTarget.rotation; + leftArmRigTarget.position = leftHandVRTarget.position + positionOffset; + leftArmRigTarget.rotation = leftHandVRTarget.rotation; } if (rightHandTargetOverride is {} rightOverride) @@ -352,14 +364,14 @@ private void LateUpdate() return; } - Bones.RightArmRigTarget.position = rightOverride.transform.TransformPoint(rightOverride.positionOffset); - Bones.RightArmRigTarget.rotation = + rightArmRigTarget.position = rightOverride.transform.TransformPoint(rightOverride.positionOffset); + rightArmRigTarget.rotation = rightOverride.transform.rotation * Quaternion.Euler(rightOverride.rotationOffset); } else { - Bones.RightArmRigTarget.position = rightHandVRTarget.position + positionOffset; - Bones.RightArmRigTarget.rotation = rightHandVRTarget.rotation; + rightArmRigTarget.position = rightHandVRTarget.position + positionOffset; + rightArmRigTarget.rotation = rightHandVRTarget.rotation; } // Update tracked finger curls after animator update @@ -479,7 +491,6 @@ private void OnDestroy() GetComponentInChildren().Build(); Destroy(playerGhost); - Destroy(xrOrigin.gameObject); foreach (var el in cleanupPool) Destroy(el); @@ -606,7 +617,7 @@ public struct Rig public Vector3 specialAnimationPositionOffset; public CrouchState crouchState; - public float rotationOffset; + public Vector3 rotationOffset; public float cameraFloorOffset; public enum CrouchState : byte diff --git a/Source/Patches/GameNetworkManagerPatches.cs b/Source/Patches/GameNetworkManagerPatches.cs new file mode 100644 index 00000000..da8fa5cd --- /dev/null +++ b/Source/Patches/GameNetworkManagerPatches.cs @@ -0,0 +1,32 @@ +using HarmonyLib; +using LCVR.Networking; +using LCVR.Player; +using UnityEngine; +using UnityEngine.Animations.Rigging; + +namespace LCVR.Patches; + +[LCVRPatch(LCVRPatchTarget.Universal)] +[HarmonyPatch] +internal static class GameNetworkManagerPatches +{ + /// + /// Fix some bogus crashes + /// + [HarmonyPatch(typeof(GameNetworkManager), nameof(GameNetworkManager.StartDisconnect))] + [HarmonyPrefix] + private static void OnLeaveGame() + { + if (!VRSession.Instance) + return; + + if (VRSession.InVR) + Object.DestroyImmediate(VRSession.Instance.LocalPlayer); + + if (!NetworkSystem.Instance) + return; + + foreach (var player in NetworkSystem.Instance.Players) + player.GetComponent().enabled = false; + } +} diff --git a/Source/Patches/QuickMenuManagerPatches.cs b/Source/Patches/QuickMenuManagerPatches.cs index 48ca9b5d..79a44a71 100644 --- a/Source/Patches/QuickMenuManagerPatches.cs +++ b/Source/Patches/QuickMenuManagerPatches.cs @@ -8,7 +8,7 @@ namespace LCVR.Patches; internal static class QuickMenuManagerPatches { /// - /// Detech when the pause menu opens + /// Detect when the pause menu opens /// [HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.OpenQuickMenu))] [HarmonyPostfix] @@ -18,7 +18,7 @@ private static void AfterOpenPauseMenu() } /// - /// Detech when the pause menu closes + /// Detect when the pause menu closes /// [HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.CloseQuickMenu))] [HarmonyPostfix] diff --git a/Source/Physics/Interactions/Car/SteeringWheel.cs b/Source/Physics/Interactions/Car/SteeringWheel.cs index 36e33d71..a7355bbc 100644 --- a/Source/Physics/Interactions/Car/SteeringWheel.cs +++ b/Source/Physics/Interactions/Car/SteeringWheel.cs @@ -247,7 +247,7 @@ public class SteeringWheelSnapPoint : MonoBehaviour, VRInteractable private Transform handTransform; internal int pointIndex; - + public InteractableFlags Flags => InteractableFlags.BothHands; private void Awake() @@ -268,10 +268,10 @@ public bool OnButtonPress(VRInteractor interactor) { if (Plugin.Config.DisableCarSteeringWheelInteraction.Value) return false; - + if (vehicle.carDestroyed || !vehicle.localPlayerInControl || !vehicle.ignitionStarted) return false; - + interactor.FingerCurler.ForceFist(true); interactor.SnapTo(transform.parent, new Vector3(0, -0.4f, -0.1f), new Vector3(0, 180, 0)); handTransform = interactor.IsRightHand @@ -282,7 +282,7 @@ public bool OnButtonPress(VRInteractor interactor) VRSession.Instance.LocalPlayer.PrimaryController.enabled = false; steeringWheel.HandAttachedToWheel(interactor.IsRightHand, pointIndex); - + return true; } @@ -291,15 +291,20 @@ public void OnButtonRelease(VRInteractor interactor) interactor.FingerCurler.ForceFist(false); interactor.SnapTo(null); handTransform = null; - + if (interactor.IsRightHand) VRSession.Instance.LocalPlayer.PrimaryController.enabled = true; - + steeringWheel.HandDetachedFromWheel(interactor.IsRightHand); } - - public void OnColliderEnter(VRInteractor _) { } - public void OnColliderExit(VRInteractor _) { } + + public void OnColliderEnter(VRInteractor _) + { + } + + public void OnColliderExit(VRInteractor _) + { + } } [LCVRPatch(LCVRPatchTarget.Universal)] @@ -319,7 +324,7 @@ private static void OnCarCreated(VehicleController __instance) { var snapPoint = point.gameObject.AddComponent(); snapPoint.pointIndex = i; - + return snapPoint; }).ToArray(); diff --git a/Source/Player/VRPlayer.cs b/Source/Player/VRPlayer.cs index a549ac7d..f398ade0 100644 --- a/Source/Player/VRPlayer.cs +++ b/Source/Player/VRPlayer.cs @@ -10,6 +10,7 @@ using LCVR.Patches; using UnityEngine.Animations.Rigging; using System.Linq; +using HarmonyLib; using Unity.XR.CoreUtils; using CrouchState = LCVR.Networking.Rig.CrouchState; using Rig = LCVR.Networking.Rig; @@ -18,7 +19,8 @@ namespace LCVR.Player; public class VRPlayer : MonoBehaviour { - private const float SCALE_FACTOR = 1.5f; + public const float SCALE_FACTOR = 1.5f; + private const int CAMERA_CLIP_MASK = 1 << 8 | 1 << 26; private const float SQR_MOVE_THRESHOLD = 0.001f; @@ -178,15 +180,6 @@ private void Awake() rightControllerRayInteractor.transform.localPosition = new Vector3(-0.01f, 0, 0); rightControllerRayInteractor.transform.localRotation = Quaternion.Euler(80, 0, 0); - // Add turning provider - ReloadTurningProvider(); - - // Input actions - Actions.Instance["Reset Height"].performed += ResetHeight_performed; - Actions.Instance["Sprint"].performed += Sprint_performed; - - ResetHeight(); - // Set up item holders var leftHolder = new GameObject("Left Hand Item Holder"); var rightHolder = new GameObject("Right Hand Item Holder"); @@ -216,6 +209,15 @@ private void Awake() spectatorRigChannel = networkSystem.CreateChannel(ChannelType.SpectatorRig, PlayerController.playerClientId); StartCoroutine(UpdatePlayerPrefs()); + + // Add turning provider + ReloadTurningProvider(); + + // Input actions + Actions.Instance["Reset Height"].performed += ResetHeight_performed; + Actions.Instance["Sprint"].performed += Sprint_performed; + + ResetHeight(); // Settings changes listener Plugin.Config.TurnProvider.SettingChanged += (_, _) => ReloadTurningProvider(); @@ -660,7 +662,7 @@ PlayerController.currentTriggerInAnimationWith is not null && (true, false) => CrouchState.Button, (false, _) => CrouchState.None }, - rotationOffset = rotationOffset.eulerAngles.y, + rotationOffset = rotationOffset.eulerAngles, cameraFloorOffset = cameraFloorOffset, })); else @@ -716,6 +718,9 @@ private void LateUpdate() private void OnDestroy() { + // Disable rig because burst crashes due to "invalid transform" + GetComponentInChildren().enabled = false; + prefsChannel.Dispose(); Actions.Instance["Sprint"].performed -= Sprint_performed; From 0e8850ba50f337bdfb62fcc29d39f928da29a104 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Fri, 27 Sep 2024 22:16:51 +0200 Subject: [PATCH 07/12] Zed dog offset fix --- CHANGELOG.md | 1 + Source/Player/Items.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 304ecc2a..0388f042 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fixed CullFactory breaking item rendering when traversing an entrance - Fixed a crash when leaving the game while on top of a car (?) - Fixed snap points not working for remote VR players +- Fix item holding offset on the Zed Dog item # 1.3.3 diff --git a/Source/Player/Items.cs b/Source/Player/Items.cs index 00bed3c2..4df52a6f 100644 --- a/Source/Player/Items.cs +++ b/Source/Player/Items.cs @@ -38,6 +38,7 @@ internal static class Items { "Hive", (new Vector3(0.04f, 0.32f, -0.38f), Vector3.zero) }, { "Plastic fish", (new Vector3(0, 0.12f, -0.06f), new Vector3(0, 80, 165)) }, { "Belt bag", (new Vector3(0.02f, 0.09f, -0.18f), new Vector3(0, 90, 0)) }, - { "Maneater", (new Vector3(-0.07f, 0.02f, -0.11f), new Vector3(6, 218, 85)) } + { "Maneater", (new Vector3(-0.07f, 0.02f, -0.11f), new Vector3(6, 218, 85)) }, + { "Zed Dog", (new Vector3(-0.14f, 0.1f, -0.22f), new Vector3(0, 315, 270)) } }; } From cb90cf9260162d945802cbe5465f1f55a33c4181 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Sat, 28 Sep 2024 18:49:06 +0200 Subject: [PATCH 08/12] Bump assembly version --- LCVR.csproj | 2 +- Source/Patches/CarPatches.cs | 3 --- Source/Patches/Spectating/Patches.cs | 2 -- Source/Player/VRPlayer.cs | 1 - 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/LCVR.csproj b/LCVR.csproj index 13dc04e0..6cb404b6 100644 --- a/LCVR.csproj +++ b/LCVR.csproj @@ -4,7 +4,7 @@ netstandard2.1 LCVR Collecting Scrap in VR - 1.3.3 + 1.3.4 DaXcess true 12.0 diff --git a/Source/Patches/CarPatches.cs b/Source/Patches/CarPatches.cs index 10f54a5b..7ccf83ce 100644 --- a/Source/Patches/CarPatches.cs +++ b/Source/Patches/CarPatches.cs @@ -1,10 +1,7 @@ using System.Collections.Generic; -using System.Linq; using System.Reflection.Emit; using HarmonyLib; using LCVR.Player; -using Unity.Netcode; -using UnityEngine; namespace LCVR.Patches; diff --git a/Source/Patches/Spectating/Patches.cs b/Source/Patches/Spectating/Patches.cs index e93af03b..95670064 100644 --- a/Source/Patches/Spectating/Patches.cs +++ b/Source/Patches/Spectating/Patches.cs @@ -1,9 +1,7 @@ using System.Collections; -using System.Linq; using GameNetcodeStuff; using HarmonyLib; using LCVR.Player; -using Unity.Netcode; using UnityEngine; namespace LCVR.Patches.Spectating; diff --git a/Source/Player/VRPlayer.cs b/Source/Player/VRPlayer.cs index f398ade0..cb182605 100644 --- a/Source/Player/VRPlayer.cs +++ b/Source/Player/VRPlayer.cs @@ -10,7 +10,6 @@ using LCVR.Patches; using UnityEngine.Animations.Rigging; using System.Linq; -using HarmonyLib; using Unity.XR.CoreUtils; using CrouchState = LCVR.Networking.Rig.CrouchState; using Rig = LCVR.Networking.Rig; From 92f6f8c37c6f52e8c6ba9ab51ed763ec4b5eca12 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Sat, 28 Sep 2024 21:57:02 +0200 Subject: [PATCH 09/12] Fix leaving hang, fix vanilla DunGen issue --- Source/Patches/DunGenPatches.cs | 30 +++++++++++++++++++++ Source/Patches/GameNetworkManagerPatches.cs | 3 ++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Source/Patches/DunGenPatches.cs diff --git a/Source/Patches/DunGenPatches.cs b/Source/Patches/DunGenPatches.cs new file mode 100644 index 00000000..15b7499e --- /dev/null +++ b/Source/Patches/DunGenPatches.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using System.Reflection.Emit; +using DunGen; +using HarmonyLib; +using UnityEngine; +using static HarmonyLib.AccessTools; + +namespace LCVR.Patches; + +/// +/// This is a patch that fixes a problem in DunGen that should actually be done in a separate mod. +/// +/// But it is affected debug builds in the VR mod and I am too lazy to make another separate mod to fix it. +/// +[LCVRPatch(LCVRPatchTarget.Universal)] +[HarmonyPatch] +internal static class DunGenPatches +{ + [HarmonyPatch(typeof(DungeonGenerator), nameof(DungeonGenerator.InnerGenerate), MethodType.Enumerator)] + [HarmonyTranspiler] + [HarmonyDebug] + private static IEnumerable DunGenAllowInfiniteRetries(IEnumerable instructions) + { + return new CodeMatcher(instructions) + .MatchForward(false, + new CodeMatch(OpCodes.Call, PropertyGetter(typeof(Application), nameof(Application.isEditor)))) + .SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldc_I4_0)) + .InstructionEnumeration(); + } +} diff --git a/Source/Patches/GameNetworkManagerPatches.cs b/Source/Patches/GameNetworkManagerPatches.cs index da8fa5cd..ad10975e 100644 --- a/Source/Patches/GameNetworkManagerPatches.cs +++ b/Source/Patches/GameNetworkManagerPatches.cs @@ -27,6 +27,7 @@ private static void OnLeaveGame() return; foreach (var player in NetworkSystem.Instance.Players) - player.GetComponent().enabled = false; + if (player.TryGetComponent(out var rb)) + rb.enabled = false; } } From b2023828439ddb1f65c8236e35e4e6bc42f95804 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Sat, 28 Sep 2024 22:00:04 +0200 Subject: [PATCH 10/12] Bump NetworkSystem protocol version --- Source/Networking/NetworkSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Networking/NetworkSystem.cs b/Source/Networking/NetworkSystem.cs index d1d309dd..d3e4a61b 100644 --- a/Source/Networking/NetworkSystem.cs +++ b/Source/Networking/NetworkSystem.cs @@ -19,7 +19,7 @@ namespace LCVR.Networking; public class NetworkSystem : MonoBehaviour { /// Protocol Version, increase this every time a change is made that is not compatible with older versions - private const ushort PROTOCOL_VERSION = 7; + private const ushort PROTOCOL_VERSION = 8; /// Packet size limit to prevent denial-of-service attacks private const uint PACKET_MAX_SIZE = 4 * 1024; From 999750529e543970127bbc203526c9de748751e8 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Sun, 29 Sep 2024 12:15:19 +0200 Subject: [PATCH 11/12] Replaced DunGen patch - Removed the DunGen bandaid fix - Replaced the debug menu patch with patching the game code instead of patching Unity code, which trips up DunGen with modded moons --- Source/Experiments/Experiments.cs | 96 ++++++++++++++++++++++++++++--- Source/Patches/DunGenPatches.cs | 30 ---------- 2 files changed, 87 insertions(+), 39 deletions(-) delete mode 100644 Source/Patches/DunGenPatches.cs diff --git a/Source/Experiments/Experiments.cs b/Source/Experiments/Experiments.cs index ad05770e..ff581d71 100644 --- a/Source/Experiments/Experiments.cs +++ b/Source/Experiments/Experiments.cs @@ -2,9 +2,11 @@ using LCVR.Patches; using System.Collections.Generic; using System.Linq; +using System.Reflection.Emit; using LCVR.Assets; using Unity.Netcode; using UnityEngine; +using static HarmonyLib.AccessTools; namespace LCVR.Experiments; @@ -131,18 +133,94 @@ private static LineRenderer CreateRenderer() #if DEBUG [LCVRPatch(LCVRPatchTarget.Universal)] [HarmonyPatch] -internal static class ExperimentalPatches +internal static class ExperimentalPatches; + +/// +/// All the patches in this class will enable the debug menu in Lethal Company +/// +[LCVRPatch(LCVRPatchTarget.Universal)] +[HarmonyPatch] +internal static class DebugMenuPatches { - /// - /// Enables the game's built in debug mode - /// - [HarmonyPatch(typeof(Application), nameof(Application.isEditor), MethodType.Getter)] - [HarmonyPrefix] - private static bool DeveloperMode(ref bool __result) + private static IEnumerable PatchIsEditor(IEnumerable instructions) { - __result = true; + return new CodeMatcher(instructions) + .MatchForward(false, + new CodeMatch(OpCodes.Call, PropertyGetter(typeof(Application), nameof(Application.isEditor)))) + .SetOpcodeAndAdvance(OpCodes.Ldc_I4_1) + .InstructionEnumeration(); + } - return false; + [HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.CanEnableDebugMenu))] + [HarmonyTranspiler] + private static IEnumerable CanEnableDebugMenu(IEnumerable instructions) + { + return PatchIsEditor(instructions); + } + + [HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.Debug_KillLocalPlayer))] + [HarmonyTranspiler] + private static IEnumerable Debug_KillLocalPlayer(IEnumerable instructions) + { + return PatchIsEditor(instructions); + } + + [HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.Debug_SpawnEnemy))] + [HarmonyTranspiler] + private static IEnumerable Debug_SpawnEnemy(IEnumerable instructions) + { + return PatchIsEditor(instructions); + } + + [HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.Debug_SpawnItem))] + [HarmonyTranspiler] + private static IEnumerable Debug_SpawnItem(IEnumerable instructions) + { + return PatchIsEditor(instructions); + } + + [HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.Debug_SpawnTruck))] + [HarmonyTranspiler] + private static IEnumerable Debug_SpawnTruck(IEnumerable instructions) + { + return PatchIsEditor(instructions); + } + + [HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.Debug_ToggleAllowDeath))] + [HarmonyTranspiler] + private static IEnumerable Debug_ToggleAllowDeath(IEnumerable instructions) + { + return PatchIsEditor(instructions); + } + + [HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.Debug_ToggleTestRoom))] + [HarmonyTranspiler] + private static IEnumerable Debug_ToggleTestRoom(IEnumerable instructions) + { + return PatchIsEditor(instructions); + } + + [HarmonyPatch(typeof(StartOfRound), nameof(StartOfRound.Debug_EnableTestRoomServerRpc))] + [HarmonyTranspiler] + private static IEnumerable Debug_EnableTestRoomServerRpc(IEnumerable instructions) + { + return PatchIsEditor(instructions); + } + + [HarmonyPatch(typeof(StartOfRound), nameof(StartOfRound.Debug_ReviveAllPlayersServerRpc))] + [HarmonyTranspiler] + private static IEnumerable Debug_ReviveAllPlayersServerRpc( + IEnumerable instructions) + { + return PatchIsEditor(instructions); + } + + [HarmonyPatch(typeof(StartOfRound), nameof(StartOfRound.Debug_ToggleAllowDeathServerRpc))] + [HarmonyTranspiler] + private static IEnumerable Debug_ToggleAllowDeathServerRpc( + IEnumerable instructions) + { + return PatchIsEditor(instructions); } } #endif diff --git a/Source/Patches/DunGenPatches.cs b/Source/Patches/DunGenPatches.cs deleted file mode 100644 index 15b7499e..00000000 --- a/Source/Patches/DunGenPatches.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using System.Reflection.Emit; -using DunGen; -using HarmonyLib; -using UnityEngine; -using static HarmonyLib.AccessTools; - -namespace LCVR.Patches; - -/// -/// This is a patch that fixes a problem in DunGen that should actually be done in a separate mod. -/// -/// But it is affected debug builds in the VR mod and I am too lazy to make another separate mod to fix it. -/// -[LCVRPatch(LCVRPatchTarget.Universal)] -[HarmonyPatch] -internal static class DunGenPatches -{ - [HarmonyPatch(typeof(DungeonGenerator), nameof(DungeonGenerator.InnerGenerate), MethodType.Enumerator)] - [HarmonyTranspiler] - [HarmonyDebug] - private static IEnumerable DunGenAllowInfiniteRetries(IEnumerable instructions) - { - return new CodeMatcher(instructions) - .MatchForward(false, - new CodeMatch(OpCodes.Call, PropertyGetter(typeof(Application), nameof(Application.isEditor)))) - .SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldc_I4_0)) - .InstructionEnumeration(); - } -} From 406f9096c67a92c6c9c7b9ea320ef526a97ab33c Mon Sep 17 00:00:00 2001 From: DaXcess Date: Sun, 29 Sep 2024 12:47:16 +0200 Subject: [PATCH 12/12] Update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6a0ca05a..99fb2f21 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ Here is a list of LCVR versions and which version(s) of Lethal Company it suppor | LCVR | Lethal Company | |-------------------|-------------------| -| v1.3.4 *(BETA)* | V64 and V64.1 | -| v1.3.3 *(LATEST)* | V64 and V64.1 | +| v1.3.4 *(LATEST)* | V64 and V64.1 | +| v1.3.3 | V64 and V64.1 | | v1.3.2 | V64 | | v1.3.1 | V62 | | v1.3.0 | V56 |