-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed a benign warning when loading input bindings - Reduced impact of playerspace spoofing hacks - Fixed an issue where somehow getting the camera out of water would prevent drowning - Fixed Diversity custom pass warping rendering when DynRes is enabled
- Loading branch information
Showing
16 changed files
with
625 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Diversity.Misc; | ||
using HarmonyLib; | ||
using LCVR.Patches; | ||
|
||
namespace LCVR.Compatibility.Diversity; | ||
|
||
[LCVRPatch(dependency: "Diversity")] | ||
[HarmonyPatch] | ||
internal static class DiversityPatches | ||
{ | ||
[HarmonyPatch(typeof(HUDManagerRevamp), nameof(HUDManagerRevamp.Start))] | ||
[HarmonyPostfix] | ||
private static void OnHUDManagerRevampStart() | ||
{ | ||
DisableGlitchCustomPass(); | ||
} | ||
|
||
[HarmonyPatch(typeof(HUDManagerRevamp), nameof(HUDManagerRevamp.Cpp_OnLoad))] | ||
[HarmonyPostfix] | ||
private static void OnLoadCustomPostProcess() | ||
{ | ||
DisableGlitchCustomPass(); | ||
} | ||
|
||
private static void DisableGlitchCustomPass() | ||
{ | ||
HUDManagerRevamp.Instance.fullscreenPass2.enabled = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../Compatibility/MoreCompany/MoreCompany.cs → ...y/MoreCompany/MoreCompanyCompatibility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
222 changes: 111 additions & 111 deletions
222
Source/Player/Spectating/AIPatches.cs → Source/Patches/Spectating/AIPatches.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,112 @@ | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using System.Reflection.Emit; | ||
using GameNetcodeStuff; | ||
using HarmonyLib; | ||
using LCVR.Patches; | ||
using UnityEngine; | ||
|
||
using static HarmonyLib.AccessTools; | ||
|
||
namespace LCVR.Player.Spectating; | ||
|
||
/// <summary> | ||
/// Generic AI patches for the free roam spectator functionality | ||
/// </summary> | ||
[LCVRPatch] | ||
[HarmonyPatch] | ||
internal static class SpectatorAIPatches | ||
{ | ||
/// <summary> | ||
/// Prevent dead player from notifying enemies that they are being looked at | ||
/// </summary> | ||
[HarmonyPatch(typeof(PlayerControllerB), nameof(PlayerControllerB.HasLineOfSightToPosition))] | ||
[HarmonyPrefix] | ||
private static bool CanCheckLineOfSight(PlayerControllerB __instance, ref bool __result) | ||
{ | ||
if (!__instance.IsOwner || !__instance.isPlayerControlled || !__instance.isPlayerDead) | ||
return true; | ||
|
||
__result = false; | ||
return false; | ||
} | ||
|
||
/// <summary> | ||
/// Prevent dead player from making audible noises for enemies to hear | ||
/// </summary> | ||
[HarmonyPatch(typeof(RoundManager), nameof(RoundManager.PlayAudibleNoise))] | ||
[HarmonyPrefix] | ||
private static bool CanBeHeard() | ||
{ | ||
return !StartOfRound.Instance.localPlayerController.isPlayerDead; | ||
} | ||
|
||
/// <summary> | ||
/// Prevent player line of sight detection for dead players | ||
/// </summary> | ||
[HarmonyPatch(typeof(EnemyAI), nameof(EnemyAI.CheckLineOfSightForPlayer))] | ||
[HarmonyTranspiler] | ||
private static IEnumerable<CodeInstruction> LineOfSightPlayerIgnoreDeadPlayer(IEnumerable<CodeInstruction> instructions, ILGenerator generator) | ||
{ | ||
return new CodeMatcher(instructions, generator) | ||
.MatchForward(false, new CodeMatch(i => i.opcode == OpCodes.Ldfld && (FieldInfo)i.operand == Field(typeof(StartOfRound), nameof(StartOfRound.allPlayerScripts)))) | ||
.Advance(-1) | ||
.Insert(new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(StartOfRound), nameof(StartOfRound.Instance)))) | ||
.CreateLabel(out var label) | ||
.Advance(1) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldfld, Field(typeof(StartOfRound), nameof(StartOfRound.allPlayerScripts)))) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldloc_1)) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldelem_Ref)) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldfld, Field(typeof(PlayerControllerB), nameof(PlayerControllerB.isPlayerDead)))) | ||
.InsertBranchAndAdvance(OpCodes.Brtrue, 77) | ||
.MatchForward(false, new CodeMatch(OpCodes.Blt)) | ||
.Advance(1) | ||
.MatchForward(false, new CodeMatch(OpCodes.Blt)) | ||
.SetOperandAndAdvance(label) | ||
.InstructionEnumeration(); | ||
} | ||
|
||
/// <summary> | ||
/// Prevent closest player line of sight detection for dead players | ||
/// </summary> | ||
[HarmonyPatch(typeof(EnemyAI), nameof(EnemyAI.CheckLineOfSightForClosestPlayer))] | ||
[HarmonyTranspiler] | ||
private static IEnumerable<CodeInstruction> LineOfSightClosestPlayerIgnoreDeadPlayer(IEnumerable<CodeInstruction> instructions, ILGenerator generator) | ||
{ | ||
return new CodeMatcher(instructions, generator) | ||
.MatchForward(false, new CodeMatch(i => i.opcode == OpCodes.Ldfld && (FieldInfo)i.operand == Field(typeof(StartOfRound), nameof(StartOfRound.allPlayerScripts)))) | ||
.Advance(-1) | ||
.Insert(new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(StartOfRound), nameof(StartOfRound.Instance)))) | ||
.CreateLabel(out var label) | ||
.Advance(1) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldfld, Field(typeof(StartOfRound), nameof(StartOfRound.allPlayerScripts)))) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldloc_S, 4)) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldelem_Ref)) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldfld, Field(typeof(PlayerControllerB), nameof(PlayerControllerB.isPlayerDead)))) | ||
.InsertBranchAndAdvance(OpCodes.Brtrue, 79) | ||
.MatchForward(false, new CodeMatch(OpCodes.Blt)) | ||
.Advance(1) | ||
.MatchForward(false, new CodeMatch(OpCodes.Blt)) | ||
.SetOperandAndAdvance(label) | ||
.InstructionEnumeration(); | ||
} | ||
|
||
/// <summary> | ||
/// Prevent collision detection on dead players | ||
/// </summary> | ||
[HarmonyPatch(typeof(EnemyAICollisionDetect), "OnTriggerStay")] | ||
[HarmonyTranspiler] | ||
private static IEnumerable<CodeInstruction> OnCollidePlayerTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) | ||
{ | ||
return new CodeMatcher(instructions, generator) | ||
.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.Ret)) | ||
.InstructionEnumeration(); | ||
} | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using System.Reflection.Emit; | ||
using GameNetcodeStuff; | ||
using HarmonyLib; | ||
using LCVR.Patches; | ||
using UnityEngine; | ||
|
||
using static HarmonyLib.AccessTools; | ||
|
||
namespace LCVR.Player.Spectating; | ||
|
||
/// <summary> | ||
/// Generic AI patches for the free roam spectator functionality | ||
/// </summary> | ||
[LCVRPatch] | ||
[HarmonyPatch] | ||
internal static class SpectatorAIPatches | ||
{ | ||
/// <summary> | ||
/// Prevent dead player from notifying enemies that they are being looked at | ||
/// </summary> | ||
[HarmonyPatch(typeof(PlayerControllerB), nameof(PlayerControllerB.HasLineOfSightToPosition))] | ||
[HarmonyPrefix] | ||
private static bool CanCheckLineOfSight(PlayerControllerB __instance, ref bool __result) | ||
{ | ||
if (!__instance.IsOwner || !__instance.isPlayerControlled || !__instance.isPlayerDead) | ||
return true; | ||
|
||
__result = false; | ||
return false; | ||
} | ||
|
||
/// <summary> | ||
/// Prevent dead player from making audible noises for enemies to hear | ||
/// </summary> | ||
[HarmonyPatch(typeof(RoundManager), nameof(RoundManager.PlayAudibleNoise))] | ||
[HarmonyPrefix] | ||
private static bool CanBeHeard() | ||
{ | ||
return !StartOfRound.Instance.localPlayerController.isPlayerDead; | ||
} | ||
|
||
/// <summary> | ||
/// Prevent player line of sight detection for dead players | ||
/// </summary> | ||
[HarmonyPatch(typeof(EnemyAI), nameof(EnemyAI.CheckLineOfSightForPlayer))] | ||
[HarmonyTranspiler] | ||
private static IEnumerable<CodeInstruction> LineOfSightPlayerIgnoreDeadPlayer(IEnumerable<CodeInstruction> instructions, ILGenerator generator) | ||
{ | ||
return new CodeMatcher(instructions, generator) | ||
.MatchForward(false, new CodeMatch(i => i.opcode == OpCodes.Ldfld && (FieldInfo)i.operand == Field(typeof(StartOfRound), nameof(StartOfRound.allPlayerScripts)))) | ||
.Advance(-1) | ||
.Insert(new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(StartOfRound), nameof(StartOfRound.Instance)))) | ||
.CreateLabel(out var label) | ||
.Advance(1) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldfld, Field(typeof(StartOfRound), nameof(StartOfRound.allPlayerScripts)))) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldloc_1)) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldelem_Ref)) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldfld, Field(typeof(PlayerControllerB), nameof(PlayerControllerB.isPlayerDead)))) | ||
.InsertBranchAndAdvance(OpCodes.Brtrue, 77) | ||
.MatchForward(false, new CodeMatch(OpCodes.Blt)) | ||
.Advance(1) | ||
.MatchForward(false, new CodeMatch(OpCodes.Blt)) | ||
.SetOperandAndAdvance(label) | ||
.InstructionEnumeration(); | ||
} | ||
|
||
/// <summary> | ||
/// Prevent closest player line of sight detection for dead players | ||
/// </summary> | ||
[HarmonyPatch(typeof(EnemyAI), nameof(EnemyAI.CheckLineOfSightForClosestPlayer))] | ||
[HarmonyTranspiler] | ||
private static IEnumerable<CodeInstruction> LineOfSightClosestPlayerIgnoreDeadPlayer(IEnumerable<CodeInstruction> instructions, ILGenerator generator) | ||
{ | ||
return new CodeMatcher(instructions, generator) | ||
.MatchForward(false, new CodeMatch(i => i.opcode == OpCodes.Ldfld && (FieldInfo)i.operand == Field(typeof(StartOfRound), nameof(StartOfRound.allPlayerScripts)))) | ||
.Advance(-1) | ||
.Insert(new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(StartOfRound), nameof(StartOfRound.Instance)))) | ||
.CreateLabel(out var label) | ||
.Advance(1) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldfld, Field(typeof(StartOfRound), nameof(StartOfRound.allPlayerScripts)))) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldloc_S, 4)) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldelem_Ref)) | ||
.InsertAndAdvance(new CodeInstruction(OpCodes.Ldfld, Field(typeof(PlayerControllerB), nameof(PlayerControllerB.isPlayerDead)))) | ||
.InsertBranchAndAdvance(OpCodes.Brtrue, 79) | ||
.MatchForward(false, new CodeMatch(OpCodes.Blt)) | ||
.Advance(1) | ||
.MatchForward(false, new CodeMatch(OpCodes.Blt)) | ||
.SetOperandAndAdvance(label) | ||
.InstructionEnumeration(); | ||
} | ||
|
||
/// <summary> | ||
/// Prevent collision detection on dead players | ||
/// </summary> | ||
[HarmonyPatch(typeof(EnemyAICollisionDetect), "OnTriggerStay")] | ||
[HarmonyTranspiler] | ||
private static IEnumerable<CodeInstruction> OnCollidePlayerTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) | ||
{ | ||
return new CodeMatcher(instructions, generator) | ||
.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.Ret)) | ||
.InstructionEnumeration(); | ||
} | ||
} |
Oops, something went wrong.