Skip to content

Commit

Permalink
Fix car desync and build not working
Browse files Browse the repository at this point in the history
  • Loading branch information
DaXcess committed Jul 15, 2024
1 parent 1f89f5d commit ac3c725
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Source/Assets/AssetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal static class AssetManager
public static bool LoadAssets()
{
assetBundle = AssetBundle.LoadFromMemory(Properties.Resources.lethalcompanyvr);

if (assetBundle == null)
{
Logger.LogError("Failed to load asset bundle!");
Expand Down
2 changes: 0 additions & 2 deletions Source/OpenXR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using BepInEx.Logging;
using JetBrains.Annotations;
using Newtonsoft.Json.Linq;
using UnityEngine;
using UnityEngine.XR;
Expand Down
11 changes: 11 additions & 0 deletions Source/Patches/CarPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,15 @@ private static void OnRemoveDriver(VehicleController __instance)

__instance.NetworkObject.ChangeOwnership(alivePlayer.actualClientId);
}

/// <summary>
/// Make sure to take back ownership once we leave the level
/// </summary>
[HarmonyPatch(typeof(StartOfRound), nameof(StartOfRound.ShipHasLeft))]
[HarmonyPostfix]
private static void OnUnloadMap()
{
foreach (var vehicle in Object.FindObjectsOfType<VehicleController>())
vehicle.NetworkObject.ChangeOwnership(StartOfRound.Instance.localPlayerController.actualClientId);
}
}
10 changes: 10 additions & 0 deletions Source/Patches/PlayerControllerPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@ private static bool SetHoverTipAndCurrentInteractTriggerPrefix()
return false;
}

/// <summary>
/// Prevent LC's built in Interact handler as we're shipping our own
/// </summary>
[HarmonyPatch(typeof(PlayerControllerB), nameof(PlayerControllerB.Interact_performed))]
[HarmonyPrefix]
private static bool PreventBuiltinInteract()
{
return false;
}

/// <summary>
/// Prevent vanilla "hold interactable" code from running, as we have our own implementation
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions Source/Physics/Interactions/Car/EjectButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using LCVR.Assets;
using LCVR.Patches;
using LCVR.Player;
using System.Collections;
using TMPro;
using UnityEngine;

namespace LCVR.Physics.Interactions.Car;
Expand Down
3 changes: 1 addition & 2 deletions Source/Physics/Interactions/ChargeStation.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using HarmonyLib;
using LCVR.Assets;
using LCVR.Assets;
using LCVR.Networking;
using LCVR.Player;
using System.Collections;
Expand Down
1 change: 0 additions & 1 deletion Source/Player/VRSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using LCVR.UI;
using Microsoft.MixedReality.Toolkit.Experimental.UI;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using LCVR.Physics.Interactions.Car;
using UnityEngine;
Expand Down
4 changes: 3 additions & 1 deletion Source/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ private void Awake()
{
Logger.LogError("Error: Unsupported game version, or corrupted game detected!");
Logger.LogError("Aborting before we blow something up!");

Logger.LogWarning(
"To bypass this check, add the following flag to your launch options in Steam: --lcvr-skip-checksum");

return;
}
}
Expand Down

0 comments on commit ac3c725

Please sign in to comment.