Skip to content

Commit

Permalink
Small patches
Browse files Browse the repository at this point in the history
- New enemy no longer picks up dead players
- Moved some files around
- Removed forced cutscene
- Added V50 beta hash
  • Loading branch information
DaXcess committed Apr 13, 2024
1 parent 16c8830 commit c1d54a2
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 28 deletions.
4 changes: 2 additions & 2 deletions LCVR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="DissonanceVoip" Version="1.0.0-lc" />
<PackageReference Include="DissonanceVoip" Version="1.50.0-lc.1" />
<PackageReference Include="Diversity" Version="2.0.3" />
<PackageReference Include="LethalCompany" Version="1.50.0-a" />
<PackageReference Include="LethalCompany" Version="1.50.0-beta.1" />
<PackageReference Include="Mimics" Version="2.4.1" />
<PackageReference Include="MoreCompany" Version="1.8.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
Expand Down
8 changes: 0 additions & 8 deletions Source/Experiments/Experiments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,5 @@ private static bool DeveloperMode(ref bool __result)

return false;
}

// TODO: Remove
[HarmonyPatch(typeof(InitializeGame), nameof(InitializeGame.Awake))]
[HarmonyPostfix]
private static void AlwaysCutscene(InitializeGame __instance)
{
__instance.playColdOpenCinematic = true;
}
}
#endif
19 changes: 19 additions & 0 deletions Source/Patches/InitializeGamePatches.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using HarmonyLib;

namespace LCVR.Patches;

[LCVRPatch]
[HarmonyPatch]
internal static class InitializeGamePatches
{
/// <summary>
/// Show the cold open cinematic if this is the first time playing VR
/// </summary>
[HarmonyPatch(typeof(InitializeGame), nameof(InitializeGame.Awake))]
[HarmonyPostfix]
private static void AlwaysCutscene(InitializeGame __instance)
{
if (!__instance.playColdOpenCinematic)
__instance.playColdOpenCinematic = !Plugin.Config.IntroScreenSeen.Value;
}
}
4 changes: 1 addition & 3 deletions Source/Patches/Spectating/AIPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
using System.Reflection.Emit;
using GameNetcodeStuff;
using HarmonyLib;
using LCVR.Patches;
using UnityEngine;

using static HarmonyLib.AccessTools;

namespace LCVR.Player.Spectating;
namespace LCVR.Patches.Spectating;

/// <summary>
/// Generic AI patches for the free roam spectator functionality
Expand Down
34 changes: 31 additions & 3 deletions Source/Patches/Spectating/EnemyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
using System.Reflection.Emit;
using GameNetcodeStuff;
using HarmonyLib;
using LCVR.Patches;
using Unity.Netcode;
using static HarmonyLib.AccessTools;

namespace LCVR.Player.Spectating;
namespace LCVR.Patches.Spectating;

/// <summary>
/// Enemy specific patches for the free roam spectator functionality
Expand All @@ -29,7 +28,6 @@ private static bool NutcrackerCheckForLocalPlayer(ref bool __result)

__result = false;
return false;

}

/// <summary>
Expand Down Expand Up @@ -71,4 +69,34 @@ private static IEnumerable<CodeInstruction> DressGirlTargetDeadPlayerFix(IEnumer
.InsertBranch(OpCodes.Brfalse, 21)
.InstructionEnumeration();
}

/// <summary>
/// Fix for the Old Bird enemies to not try to grab dead players
/// </summary>
[HarmonyPatch(typeof(RadMechAI), nameof(RadMechAI.AttemptGrabIfClose))]
[HarmonyDebug]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> RadMechDontGrabDeadPlayers(IEnumerable<CodeInstruction> instructions,
ILGenerator generator)
{
return new CodeMatcher(instructions, generator)
.MatchForward(false,
[
new CodeMatch(OpCodes.Ldfld,
Field(typeof(PlayerControllerB), nameof(PlayerControllerB.isPlayerControlled)))
])
.Advance(2)
.InsertAndAdvance(
new CodeInstruction(OpCodes.Call,
PropertyGetter(typeof(StartOfRound), nameof(StartOfRound.Instance))),
new CodeInstruction(OpCodes.Ldfld,
Field(typeof(StartOfRound), nameof(StartOfRound.allPlayerScripts))),
new CodeInstruction(OpCodes.Ldloc_0),
new CodeInstruction(OpCodes.Ldelem_Ref),
new CodeInstruction(OpCodes.Ldfld,
Field(typeof(PlayerControllerB), nameof(PlayerControllerB.isPlayerDead)))
)
.InsertBranchAndAdvance(OpCodes.Brtrue, 78)
.InstructionEnumeration();
}
}
7 changes: 3 additions & 4 deletions Source/Patches/Spectating/EnvironmentPatches.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System.Collections;
using GameNetcodeStuff;
using HarmonyLib;
using LCVR.Patches;
using System.Collections.Generic;
using System.Reflection.Emit;
using GameNetcodeStuff;
using HarmonyLib;

namespace LCVR.Player.Spectating;
namespace LCVR.Patches.Spectating;

/// <summary>
/// Environment specific patches for the freeroam spectator feature
Expand Down
3 changes: 1 addition & 2 deletions Source/Patches/Spectating/HUDPatches.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using HarmonyLib;
using LCVR.Patches;

namespace LCVR.Player.Spectating;
namespace LCVR.Patches.Spectating;

[LCVRPatch]
[HarmonyPatch]
Expand Down
7 changes: 3 additions & 4 deletions Source/Patches/Spectating/Patches.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System.Collections;
using GameNetcodeStuff;
using HarmonyLib;
using LCVR.Patches;
using System.Collections;
using LCVR.Assets;
using LCVR.Player;
using UnityEngine;

namespace LCVR.Player.Spectating;
namespace LCVR.Patches.Spectating;

/// <summary>
/// Generic patches for the free roam spectator functionality
Expand Down
4 changes: 2 additions & 2 deletions Source/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Plugin : BaseUnityPlugin
public const string PLUGIN_VERSION = "1.2.1";

private readonly string[] GAME_ASSEMBLY_HASHES = [
"3EE687F8586F8597BA9E750E5C75141CA353C0076A3FC3C802AE9CE35D876580" // V49
"710F39A9E7610AD0056E463280EB7498810F30239356932AE0ECE4ADE9F68C69" // V50 Beta @ 4/12/2024
];

public new static Config Config { get; private set; }
Expand All @@ -46,7 +46,7 @@ public class Plugin : BaseUnityPlugin
private void Awake()
{
// Fix XR not working with non-english PC languages
// Again, why the fuck do we need another hack to make shit just work normally?
// Why isn't this the default in LC??
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;

// Reload Unity's Input System plugins since BepInEx in some
Expand Down

0 comments on commit c1d54a2

Please sign in to comment.