Zaggy1024 patch so
"your latest version works perfectly in editor with just this change to GenerateMainPathDebugPatch"
This commit is contained in:
parent
25530ebbb3
commit
e94de480e0
@ -259,18 +259,28 @@ namespace DunGenPlus.Patches {
|
|||||||
tileProxyNullSequence.AddBasicLocal(OpCodes.Ldloc_S, 14);
|
tileProxyNullSequence.AddBasicLocal(OpCodes.Ldloc_S, 14);
|
||||||
tileProxyNullSequence.AddBasic(OpCodes.Brtrue);
|
tileProxyNullSequence.AddBasic(OpCodes.Brtrue);
|
||||||
|
|
||||||
|
FieldInfo indexField = null;
|
||||||
|
|
||||||
foreach(var instruction in instructions){
|
foreach(var instruction in instructions){
|
||||||
|
if (instruction.operand is FieldInfo field && field.Name.StartsWith("<j>"))
|
||||||
|
indexField = field;
|
||||||
|
|
||||||
if (tileProxyNullSequence.VerifyStage(instruction)) {
|
if (tileProxyNullSequence.VerifyStage(instruction)) {
|
||||||
var specialFunction = typeof(DunGenPlusGenerator).GetMethod("PrintAddTileErrorQuick", BindingFlags.Static | BindingFlags.Public);
|
|
||||||
var field = typeof(DungeonGenerator).Assembly.GetType("DunGen.DungeonGenerator+<GenerateMainPath>d__100").GetField("<j>5__8", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
||||||
|
|
||||||
yield return instruction;
|
yield return instruction;
|
||||||
|
|
||||||
|
if (indexField != null) {
|
||||||
|
var specialFunction = typeof(DunGenPlusGenerator).GetMethod("PrintAddTileErrorQuick", BindingFlags.Static | BindingFlags.Public);
|
||||||
|
|
||||||
yield return new CodeInstruction(OpCodes.Ldloc_1);
|
yield return new CodeInstruction(OpCodes.Ldloc_1);
|
||||||
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
||||||
yield return new CodeInstruction(OpCodes.Ldfld, field);
|
yield return new CodeInstruction(OpCodes.Ldfld, indexField);
|
||||||
|
|
||||||
yield return new CodeInstruction(OpCodes.Call, specialFunction);
|
yield return new CodeInstruction(OpCodes.Call, specialFunction);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Plugin.logger.LogWarning("Failed to find current tile index field in the main path enumerator");
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user