-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix leaving hang, fix vanilla DunGen issue
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
/// <summary> | ||
/// 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. | ||
/// </summary> | ||
[LCVRPatch(LCVRPatchTarget.Universal)] | ||
[HarmonyPatch] | ||
internal static class DunGenPatches | ||
{ | ||
[HarmonyPatch(typeof(DungeonGenerator), nameof(DungeonGenerator.InnerGenerate), MethodType.Enumerator)] | ||
[HarmonyTranspiler] | ||
[HarmonyDebug] | ||
private static IEnumerable<CodeInstruction> DunGenAllowInfiniteRetries(IEnumerable<CodeInstruction> 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(); | ||
} | ||
} |
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