Added disable mayor basement config
Dungeon generation now uses a universal archetype for normal Nodes (fixes mayor and hallway entrance)
This commit is contained in:
parent
6613191d7e
commit
882c4a0c3e
11 changed files with 158 additions and 17 deletions
|
@ -54,5 +54,70 @@ namespace ScarletMansion.DunGenPatch {
|
|||
Plugin.logger.LogInfo("Alt. InnerGenerate() function complete");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(DungeonGenerator), "GenerateMainPath", MethodType.Enumerator)]
|
||||
public static IEnumerable<CodeInstruction> GenerateMainPathPatch(IEnumerable<CodeInstruction> instructions){
|
||||
|
||||
var addFunction = typeof(List<DungeonArchetype>).GetMethod("Add", BindingFlags.Instance | BindingFlags.Public);
|
||||
|
||||
var sequence = new InstructionSequence("archetype node");
|
||||
sequence.AddOperandTypeCheck(OpCodes.Ldfld, typeof(List<DungeonArchetype>));
|
||||
sequence.AddBasic(OpCodes.Ldnull);
|
||||
sequence.AddBasic(OpCodes.Callvirt, addFunction);
|
||||
|
||||
foreach(var instruction in instructions){
|
||||
|
||||
if (sequence.VerifyStage(instruction)){
|
||||
|
||||
var method = typeof(GeneratePath).GetMethod("ModifyMainBranchNodeArchetype", BindingFlags.Public | BindingFlags.Static);
|
||||
|
||||
yield return new CodeInstruction(OpCodes.Ldloc_S, 8);
|
||||
yield return new CodeInstruction(OpCodes.Call, method);
|
||||
|
||||
yield return instruction;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
yield return instruction;
|
||||
}
|
||||
|
||||
sequence.ReportComplete();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
[HarmonyPatch(typeof(DungeonGenerator), "AddTile")]
|
||||
[HarmonyPostfix]
|
||||
public static void AddTilePatch(TileProxy attachTo, IEnumerable<TileSet> useableTileSets, DungeonArchetype archetype, ref TileProxy __result){
|
||||
var atString = attachTo != null ? attachTo.Prefab.ToString() : "NULL";
|
||||
var aString = archetype ? archetype.ToString() : "NULL";
|
||||
var rString = __result != null ? __result.Prefab.ToString() : "NULL";
|
||||
|
||||
Plugin.logger.LogInfo($"");
|
||||
Plugin.logger.LogInfo($"Attach: {atString}");
|
||||
Plugin.logger.LogInfo($"ValidCount: {useableTileSets.Sum(u => u.TileWeights.Weights.Count).ToString()}");
|
||||
Plugin.logger.LogInfo($"Entry: {aString}");
|
||||
Plugin.logger.LogInfo($"Result: {rString}");
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(DungeonGenerator), "TryPlaceTile")]
|
||||
[HarmonyPostfix]
|
||||
public static void TryPlaceTilePatch(ref TilePlacementResult __result){
|
||||
Plugin.logger.LogInfo(__result.ToString());
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(DoorwayPairFinder), "GetDoorwayPairs")]
|
||||
[HarmonyPostfix]
|
||||
public static void GetDoorwayPairsPatch(ref Queue<DoorwayPair> __result){
|
||||
Plugin.logger.LogInfo(__result.Count().ToString());
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue