diff --git a/DunGenPlus/DunGenPlus/DevTools/DevDebugManager.cs b/DunGenPlus/DunGenPlus/DevTools/DevDebugManager.cs index a130b3c..859ad9b 100644 --- a/DunGenPlus/DunGenPlus/DevTools/DevDebugManager.cs +++ b/DunGenPlus/DunGenPlus/DevTools/DevDebugManager.cs @@ -47,6 +47,8 @@ namespace DunGenPlus.DevTools { private Vector3 lastCameraPosition; private Quaternion lastCameraRotation; + private Vector2 cameraYRange; + void Awake(){ Instance = this; @@ -66,6 +68,8 @@ namespace DunGenPlus.DevTools { disabledGameObject = new GameObject("Disabled GOBJ"); disabledGameObject.SetActive(false); disabledGameObject.transform.SetParent(transform); + + cameraYRange = new Vector2(devCamera.transform.position.y - 200f, devCamera.transform.position.y); } void OnDestroy(){ @@ -92,6 +96,13 @@ namespace DunGenPlus.DevTools { var movement = delta; devCamera.transform.position += new Vector3(-movement.x, 0f, -movement.y); } + + var scroll = Mouse.current.scroll.value.y; + if (scroll != 0f) { + var pos = devCamera.transform.position; + pos.y = Mathf.Clamp(pos.y + scroll * -0.05f, cameraYRange.x, cameraYRange.y); + devCamera.transform.position = pos; + } } public void OpenPanel(int index) { @@ -201,6 +212,7 @@ namespace DunGenPlus.DevTools { private void UpdatePanels() { DunFlowPanel.Instance?.UpdatePanel(true); DunGenPlusPanel.Instance?.UpdatePanel(true); + AssetsPanel.Instance?.UpdatePanel(true); } public void UpdateDungeonBounds(){ diff --git a/DunGenPlus/DunGenPlus/DevTools/DevDebugManagerUI.cs b/DunGenPlus/DunGenPlus/DevTools/DevDebugManagerUI.cs index 5dbd226..ba59fc4 100644 --- a/DunGenPlus/DunGenPlus/DevTools/DevDebugManagerUI.cs +++ b/DunGenPlus/DunGenPlus/DevTools/DevDebugManagerUI.cs @@ -118,10 +118,18 @@ namespace DunGenPlus.DevTools { return field; } - public ListUIElement CreateListUIField(Transform parentTransform, TitleParameter titleParameter, List list){ + public ListUIElement CreateListUIField(Transform parentTransform, TitleParameter titleParameter, List list, bool useAddRemove = true){ + return CreateListSimpleUIField(parentTransform, titleParameter, list, false, useAddRemove); + } + + public ListUIElement CreateListExtendedUIField(Transform parentTransform, TitleParameter titleParameter, List list, bool useAddRemove = true){ + return CreateListSimpleUIField(parentTransform, titleParameter, list, true, useAddRemove); + } + + private ListUIElement CreateListSimpleUIField(Transform parentTransform, TitleParameter titleParameter, List list, bool useExtended, bool useAddRemove){ var gameObject = Instantiate(listUIPrefab, parentTransform); var field = gameObject.GetComponent(); - field.SetupList(titleParameter, list); + field.SetupList(titleParameter, list, useExtended, useAddRemove); return field; } @@ -160,7 +168,7 @@ namespace DunGenPlus.DevTools { public DropdownInputField CreateEnumOptionsUIField(Transform parentTransform, TitleParameter titleParameter, int baseValue, Action setAction) where T: Enum{ var options = Enum.GetNames(typeof(T)); - return CreateOptionsUIField(parentTransform, titleParameter, baseValue, setAction, (i) => (T)(object)i, options); + return CreateOptionsUIField(parentTransform, titleParameter, baseValue, setAction, (i) => (T)Enum.ToObject(typeof(T), i), options); } public DropdownInputField CreateAnimationCurveOptionsUIField(Transform parentTransform, TitleParameter titleParameter, AnimationCurve baseValue, Action setAction){ diff --git a/DunGenPlus/DunGenPlus/DevTools/Panels/AssetsPanel.cs b/DunGenPlus/DunGenPlus/DevTools/Panels/AssetsPanel.cs new file mode 100644 index 0000000..41e2587 --- /dev/null +++ b/DunGenPlus/DunGenPlus/DevTools/Panels/AssetsPanel.cs @@ -0,0 +1,51 @@ +using DunGen; +using DunGenPlus.Collections; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace DunGenPlus.DevTools.Panels +{ + internal class AssetsPanel : BasePanel { + + public static AssetsPanel Instance { get; internal set; } + + public override void AwakeCall() { + Instance = this; + } + + public override void SetPanelVisibility(bool visible){ + base.SetPanelVisibility(visible); + if (visible) UpdatePanel(false); + } + + public void UpdatePanel(bool refreshPanel){ + if (refreshPanel) { + ClearPanel(); + SetupPanel(); + } + } + + public void SetupPanel(){ + var parentTransform = mainGameObject.transform; + manager.CreateListExtendedUIField(parentTransform, "Archetypes", selectedAssetCache.archetypes.list.Select(t => t.Item).Where(t => t != null).ToList(), false); + manager.CreateSpaceUIField(parentTransform); + + manager.CreateListExtendedUIField(parentTransform, "Tilesets", selectedAssetCache.tileSets.list.Select(t => t.Item).Where(t => t != null).ToList(), false); + manager.CreateSpaceUIField(parentTransform); + + manager.CreateListExtendedUIField(parentTransform, "Tiles", selectedAssetCache.tiles.list.Select(t => t.Item).Where(t => t != null).ToList(), false); + manager.CreateSpaceUIField(parentTransform); + + manager.CreateListExtendedUIField(parentTransform, "Main Paths", selectedAssetCache.mainPathExtenders.list.Select(t => t.Item).Where(t => t != null).ToList(), false); + } + + public void ClearPanel(){ + manager.ClearTransformChildren(mainGameObject.transform); + } + + } +} diff --git a/DunGenPlus/DunGenPlus/DevTools/Panels/Collections/DungeonFlowCacheAssets.cs b/DunGenPlus/DunGenPlus/DevTools/Panels/Collections/DungeonFlowCacheAssets.cs index d8f11da..f08a48d 100644 --- a/DunGenPlus/DunGenPlus/DevTools/Panels/Collections/DungeonFlowCacheAssets.cs +++ b/DunGenPlus/DunGenPlus/DevTools/Panels/Collections/DungeonFlowCacheAssets.cs @@ -82,7 +82,10 @@ namespace DunGenPlus.DevTools.Panels.Collections { void AddArchetypes(IEnumerable archetypes){ foreach(var x in archetypes){ archetypesHashSet.Add(x); - if (x != null) AddTileSets(x.TileSets); + if (x != null) { + AddTileSets(x.TileSets); + AddTileSets(x.BranchCapTileSets); + } } } diff --git a/DunGenPlus/DunGenPlus/DevTools/Panels/DunFlowPanel.cs b/DunGenPlus/DunGenPlus/DevTools/Panels/DunFlowPanel.cs index 70f4754..0070680 100644 --- a/DunGenPlus/DunGenPlus/DevTools/Panels/DunFlowPanel.cs +++ b/DunGenPlus/DunGenPlus/DevTools/Panels/DunFlowPanel.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; -using static UnityEngine.Rendering.DebugUI; namespace DunGenPlus.DevTools.Panels { internal class DunFlowPanel : BasePanel { @@ -15,7 +14,6 @@ namespace DunGenPlus.DevTools.Panels { public override void AwakeCall(){ Instance = this; - Plugin.logger.LogInfo("AwakeCall"); } diff --git a/DunGenPlus/DunGenPlus/DevTools/Panels/DunGenPlusPanel.cs b/DunGenPlus/DunGenPlus/DevTools/Panels/DunGenPlusPanel.cs index 3e0d9c5..60ce84c 100644 --- a/DunGenPlus/DunGenPlus/DevTools/Panels/DunGenPlusPanel.cs +++ b/DunGenPlus/DunGenPlus/DevTools/Panels/DunGenPlusPanel.cs @@ -9,11 +9,7 @@ using System.Text; using System.Threading.Tasks; using TMPro; using UnityEngine; -using UnityEngine.UI; -using DunGenPlus.DevTools.UIElements; using DunGenPlus.DevTools.UIElements.Collections; -using DunGenPlus.DevTools.Panels.Collections; -using static UnityEngine.Rendering.DebugUI; namespace DunGenPlus.DevTools.Panels { internal class DunGenPlusPanel : BasePanel { diff --git a/DunGenPlus/DunGenPlus/DevTools/UIElements/Collections/ListEntryType.cs b/DunGenPlus/DunGenPlus/DevTools/UIElements/Collections/ListEntryType.cs index 7d7bafc..9b197b2 100644 --- a/DunGenPlus/DunGenPlus/DevTools/UIElements/Collections/ListEntryType.cs +++ b/DunGenPlus/DunGenPlus/DevTools/UIElements/Collections/ListEntryType.cs @@ -14,6 +14,11 @@ namespace DunGenPlus.DevTools.UIElements.Collections { internal abstract class ListEntryType { public abstract object CreateEmptyObject(); public abstract void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset); + + public virtual bool UseCustomElementText() => false; + + public virtual string GetCustomElementText(IList list, int index) => string.Empty; + } internal class ListEntryDungeonArchetype : ListEntryType { @@ -26,6 +31,32 @@ namespace DunGenPlus.DevTools.UIElements.Collections { } } + internal class ListEntryDungeonArchetypeExtended : ListEntryType { + public override object CreateEmptyObject() => null; + + public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) { + var entry = (DungeonArchetype)list[index]; + DevDebugManager.Instance.CreateListUIField(parentTransform, "Tile Sets", entry.TileSets); + DevDebugManager.Instance.CreateEnumOptionsUIField(parentTransform, "Branch Cap Type", (int)entry.BranchCapType, (t) => entry.BranchCapType = t); + DevDebugManager.Instance.CreateListUIField(parentTransform, "Branch Cap Tile Sets", entry.BranchCapTileSets); + + DevDebugManager.Instance.CreateIntRangeInputField(parentTransform, "Branch Count", entry.BranchCount, (t) => entry.BranchCount = t); + DevDebugManager.Instance.CreateIntRangeInputField(parentTransform, "Branching Depth", entry.BranchingDepth, (t) => entry.BranchingDepth = t); + + DevDebugManager.Instance.CreateFloatInputField(parentTransform, "Straigten Chance", new FloatParameter(entry.StraightenChance, 0f, 1f), (t) => entry.StraightenChance = t); + DevDebugManager.Instance.CreateBoolInputField(parentTransform, "Unique", entry.Unique, (t) => entry.Unique = t); + + DevDebugManager.Instance.CreateSpaceUIField(parentTransform); + } + + public override bool UseCustomElementText() => true; + + public override string GetCustomElementText(IList list, int index) { + var entry = (DungeonArchetype)list[index]; + return entry.name; + } + } + internal class ListEntryTileSet : ListEntryType { public override object CreateEmptyObject() => null; @@ -36,6 +67,67 @@ namespace DunGenPlus.DevTools.UIElements.Collections { } } + internal class ListEntryTileExtended : ListEntryType { + public override object CreateEmptyObject() => null; + + public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) { + var entry = (GameObject)list[index]; + var tile = entry.GetComponent(); + + DevDebugManager.Instance.CreateEnumOptionsUIField(parentTransform, "Repeat Mode", (int)tile.RepeatMode, (t) => tile.RepeatMode = t); + DevDebugManager.Instance.CreateBoolInputField(parentTransform, "Allow Imm. Repeats", tile.allowImmediateRepeats, (t) => tile.allowImmediateRepeats = t); + DevDebugManager.Instance.CreateBoolInputField(parentTransform, "Allow Rotation", tile.AllowRotation, (t) => tile.AllowRotation = t); + DevDebugManager.Instance.CreateFloatInputField(parentTransform, "Connection Chance", new FloatParameter(tile.ConnectionChance, 0f, 1f), (t) => tile.ConnectionChance = t); + + DevDebugManager.Instance.CreateSpaceUIField(parentTransform); + } + + public override bool UseCustomElementText() => true; + + public override string GetCustomElementText(IList list, int index) { + var entry = (GameObject)list[index]; + return entry.name; + } + } + + internal class ListEntryTileSetExtended : ListEntryType { + public override object CreateEmptyObject() => null; + + public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) { + var entry = (TileSet)list[index]; + var weights = entry.TileWeights.Weights; + + DevDebugManager.Instance.CreateListUIField(parentTransform, "Weights", weights); + + DevDebugManager.Instance.CreateSpaceUIField(parentTransform); + } + + public override bool UseCustomElementText() => true; + + public override string GetCustomElementText(IList list, int index) { + var entry = (TileSet)list[index]; + return entry.name; + } + } + + internal class ListEntryGameObjectChance : ListEntryType { + public override object CreateEmptyObject() { + var item = new GameObjectChance(); + item.TileSet = null; + item.DepthWeightScale = null; + return item; + } + + public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) { + var entry = (GameObjectChance)list[index]; + + DevDebugManager.Instance.CreateTileOptionsUIField(parentTransform, "Tile", DevDebugManager.Instance.selectedAssetCache.tiles.dictionary[entry.Value], (t) => entry.Value = t); + DevDebugManager.Instance.CreateFloatInputField(parentTransform, "Main Path Weight", entry.MainPathWeight, (t) => entry.MainPathWeight = t); + DevDebugManager.Instance.CreateFloatInputField(parentTransform, "Branch Path Weight", entry.BranchPathWeight, (t) => entry.BranchPathWeight = t); + DevDebugManager.Instance.CreateAnimationCurveOptionsUIField(parentTransform, "Depth Weight Scale", entry.DepthWeightScale, (t) => entry.DepthWeightScale = t); + } + } + internal class ListEntryMainPathExtender : ListEntryType { public override object CreateEmptyObject() => null; @@ -46,6 +138,48 @@ namespace DunGenPlus.DevTools.UIElements.Collections { } } + internal class ListEntryMainPathExtenderExtended : ListEntryType { + public override object CreateEmptyObject() => null; + + public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) { + var entry = (MainPathExtender)list[index]; + + Transform CreateOverrideTransform(PropertyOverride property, string title){ + var transform = DevDebugManager.Instance.CreateVerticalLayoutUIField(parentTransform); + DevDebugManager.Instance.CreateBoolInputField(parentTransform, new TitleParameter(title, layoutOffset), property.Override, (t) => { + property.Override = t; + transform.gameObject.SetActive(t); + }); + transform.SetAsLastSibling(); + return transform; + } + + var branchModeTransform = CreateOverrideTransform(entry.BranchMode, "Branch Mode Override"); + DevDebugManager.Instance.CreateEnumOptionsUIField(branchModeTransform, new TitleParameter("Branch Mode", layoutOffset), (int)entry.BranchMode.Value, (t) => entry.BranchMode.Value = t); + + var branchCodeTransform = CreateOverrideTransform(entry.BranchCount, "Branch Count Override"); + DevDebugManager.Instance.CreateIntRangeInputField(branchCodeTransform, new TitleParameter("Branch Code", layoutOffset), entry.BranchCount.Value, (t) => entry.BranchCount.Value = t); + + var lengthTransform = CreateOverrideTransform(entry.Length, "Length Override"); + DevDebugManager.Instance.CreateIntRangeInputField(lengthTransform, new TitleParameter("Length", layoutOffset), entry.Length.Value, (t) => entry.Length.Value = t); + + var nodesTransform = CreateOverrideTransform(entry.Nodes, "Nodes Override"); + DevDebugManager.Instance.CreateListUIField(nodesTransform, new TitleParameter("Nodes", layoutOffset), entry.Nodes.Value); + + var linesTransform = CreateOverrideTransform(entry.Lines, "Lines Override"); + DevDebugManager.Instance.CreateListUIField(linesTransform, new TitleParameter("Lines", layoutOffset), entry.Lines.Value); + + } + + public override bool UseCustomElementText() => true; + + public override string GetCustomElementText(IList list, int index) { + var entry = (MainPathExtender)list[index]; + return entry.name; + } + + } + internal class ListEntryNodeArchetype : ListEntryType { public override object CreateEmptyObject() => new NodeArchetype(); diff --git a/DunGenPlus/DunGenPlus/DevTools/UIElements/ListUIElement.cs b/DunGenPlus/DunGenPlus/DevTools/UIElements/ListUIElement.cs index 17a49d7..deac564 100644 --- a/DunGenPlus/DunGenPlus/DevTools/UIElements/ListUIElement.cs +++ b/DunGenPlus/DunGenPlus/DevTools/UIElements/ListUIElement.cs @@ -19,9 +19,11 @@ namespace DunGenPlus.DevTools.UIElements { public GameObject templatePrefab; public Transform listTransform; + public GameObject buttonsGameObject; internal IList list; internal Type listType; + internal bool useExtended; public static readonly Dictionary typeDictionary = new Dictionary() { { typeof(DungeonArchetype), new ListEntryDungeonArchetype() }, @@ -31,10 +33,20 @@ namespace DunGenPlus.DevTools.UIElements { { typeof(TileInjectionRule), new ListEntryTileInjectionRule() }, { typeof(GraphNode), new ListEntryGraphNode() }, { typeof(GraphLine), new ListEntryGraphLine() }, + { typeof(GameObjectChance), new ListEntryGameObjectChance() }, { typeof(MainPathExtender), new ListEntryMainPathExtender() } }; - public void SetupList(TitleParameter titleParameter, List list) { + public static readonly Dictionary typeExtendedDictionary = new Dictionary() { + { typeof(DungeonArchetype), new ListEntryDungeonArchetypeExtended() }, + { typeof(TileSet), new ListEntryTileSetExtended() }, + { typeof(GameObject), new ListEntryTileExtended() }, + { typeof(MainPathExtender), new ListEntryMainPathExtenderExtended() }, + + }; + + + public void SetupList(TitleParameter titleParameter, List list, bool useExtended, bool useAddRemove) { SetupBase(titleParameter); var cValue = Mathf.LerpUnclamped(0.4f, 0.6f, titleParameter.offset / 100f); @@ -42,6 +54,11 @@ namespace DunGenPlus.DevTools.UIElements { this.list = list; listType = typeof(T); + this.useExtended = useExtended; + if (!useAddRemove) { + buttonsGameObject.SetActive(false); + } + for(var i = 0; i < list.Count; ++i) { CreateEntry(i); } @@ -49,7 +66,8 @@ namespace DunGenPlus.DevTools.UIElements { public void AddElement() { object item = null; - if (!typeDictionary.TryGetValue(listType, out var value)){ + var dictionary = useExtended ? typeExtendedDictionary : typeDictionary; + if (!dictionary.TryGetValue(listType, out var value)){ Plugin.logger.LogError($"Type {listType} does not has a defined list UI display"); } item = value.CreateEmptyObject(); @@ -67,19 +85,32 @@ namespace DunGenPlus.DevTools.UIElements { var copy = CreateCopy(index); var copyParentTransform = copy.transform.Find("Items"); - if (!typeDictionary.TryGetValue(listType, out var value)){ + var dictionary = useExtended ? typeExtendedDictionary : typeDictionary; + if (!dictionary.TryGetValue(listType, out var value)){ Plugin.logger.LogError($"Type {listType} does not has a defined list UI display"); } value.CreateEntry(list, index, copyParentTransform, layoutOffset + 24f); + SetElementText(copy, value, index); copy.SetActive(true); } public GameObject CreateCopy(int index){ var copy = Instantiate(templatePrefab, listTransform); - copy.transform.Find("Element").GetComponent().text = $"Element {index}"; return copy; } + public void SetElementText(GameObject elementGameObject, ListEntryType entryType, int index){ + var comp = elementGameObject.transform.Find("Element").GetComponent(); + string elementText; + if (entryType.UseCustomElementText()) { + elementText = entryType.GetCustomElementText(list, index); + comp.fontStyle |= FontStyles.Underline; + } else { + elementText = $"Element {index}"; + } + comp.text = elementText; + } + } diff --git a/DunGenPlus/DunGenPlus/DunGenPlus.csproj b/DunGenPlus/DunGenPlus/DunGenPlus.csproj index 863b79e..21f252c 100644 --- a/DunGenPlus/DunGenPlus/DunGenPlus.csproj +++ b/DunGenPlus/DunGenPlus/DunGenPlus.csproj @@ -147,6 +147,7 @@ + diff --git a/DunGenPlus/DunGenPlus/DunGenPlus/DunGenPlus.dll b/DunGenPlus/DunGenPlus/DunGenPlus/DunGenPlus.dll index 26a5776..62feb9b 100644 Binary files a/DunGenPlus/DunGenPlus/DunGenPlus/DunGenPlus.dll and b/DunGenPlus/DunGenPlus/DunGenPlus/DunGenPlus.dll differ diff --git a/DunGenPlus/DunGenPlus/Generation/DunGenPlusGenerator.cs b/DunGenPlus/DunGenPlus/Generation/DunGenPlusGenerator.cs index 367c420..08ea045 100644 --- a/DunGenPlus/DunGenPlus/Generation/DunGenPlusGenerator.cs +++ b/DunGenPlus/DunGenPlus/Generation/DunGenPlusGenerator.cs @@ -16,6 +16,7 @@ using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using BepInEx.Logging; using DunGenPlus.DevTools; +using DunGenPlus.Patches; [assembly: SecurityPermission( SecurityAction.RequestMinimum, SkipVerification = true )] namespace DunGenPlus.Generation { @@ -138,7 +139,7 @@ namespace DunGenPlus.Generation { yield break; } var mainRoomStartingLengthIndex = mainRoom.Placement.Depth + 1; - Plugin.logger.LogDebug($"Length Index: {mainRoomStartingLengthIndex}"); + Plugin.logger.LogDebug($"Main Room Length Index: {mainRoomStartingLengthIndex}"); //FixDoorwaysToAllFloors(mainRoom, doorwayGroups); @@ -184,7 +185,9 @@ namespace DunGenPlus.Generation { // most of this code is a mix of the GenerateMainPath() // and GenerateBranch() code - for(var t = mainRoomStartingLengthIndex; t < targetLength; ++t){ + var reachedLastNode = false; + var lastNode = nodes.ElementAt(nodes.Count() - 1); + for(var t = mainRoomStartingLengthIndex; t < targetLength && !reachedLastNode; ++t){ var lineDepthRatio = Mathf.Clamp01((float)t / (targetLength - 1)); var lineAtDepth = GetLineAtDepth(gen.DungeonFlow, lineDepthRatio); if (lineAtDepth == null){ @@ -211,6 +214,11 @@ namespace DunGenPlus.Generation { if (graphNode != null) { archetype = ModifyMainBranchNodeArchetype(null, graphNode, gen.RandomStream); useableTileSets = graphNode.TileSets; + + // Zaggy wants the last node to stop dungeon generation + if (graphNode == lastNode) { + reachedLastNode = true; + } } else { archetype = gen.currentArchetype; useableTileSets = archetype.TileSets; @@ -219,12 +227,26 @@ namespace DunGenPlus.Generation { var tileProxy = gen.AddTile(previousTile, useableTileSets, lineDepthRatio, archetype, TilePlacementResult.None); if (tileProxy == null) { - Plugin.logger.LogDebug($"Alt. main branch gen failed at {b}:{lineDepthRatio}"); + var prevName = previousTile != null ? previousTile.Prefab.name : "NULL"; + var archetypeName = archetype ? archetype.name : "NULL"; + var tileSetNames = string.Join(", ", useableTileSets); + Plugin.logger.LogDebug($"Alt. main branch gen failed at Branch {b} (Length: {t}, Ratio: {lineDepthRatio})"); + Plugin.logger.LogDebug($"Prev tile: {prevName}\nArchetype: {archetypeName}\nTilesets: {tileSetNames}"); + Plugin.logger.LogDebug($"Reason: {DungeonGeneratorPatch.lastTilePlacementResult}"); + + if (previousTile != null) { + var availableDoorways = string.Join(",", previousTile.UnusedDoorways); + var usedDoorways = string.Join(",", previousTile.UsedDoorways); + + Plugin.logger.LogDebug($"Available Doorways: {availableDoorways}"); + Plugin.logger.LogDebug($"Used Doorways: {usedDoorways}"); + } + yield return gen.Wait(gen.InnerGenerate(true)); yield break; } - if (lineDepthRatio >= 1f){ + if (reachedLastNode || lineDepthRatio >= 1f){ Plugin.logger.LogDebug($"Alt. main branch at {b} ended with {tileProxy.PrefabTile.name}"); } diff --git a/DunGenPlus/DunGenPlus/Patches/DungeonGeneratorPatch.cs b/DunGenPlus/DunGenPlus/Patches/DungeonGeneratorPatch.cs index cb5f4eb..1cefec8 100644 --- a/DunGenPlus/DunGenPlus/Patches/DungeonGeneratorPatch.cs +++ b/DunGenPlus/DunGenPlus/Patches/DungeonGeneratorPatch.cs @@ -318,6 +318,13 @@ namespace DunGenPlus.Patches { } } + public static TilePlacementResult lastTilePlacementResult; + [HarmonyPrefix] + [HarmonyPatch(typeof(DungeonGenerator), "AddTilePlacementResult")] + public static void AddTilePlacementResultPatch(TilePlacementResult result){ + lastTilePlacementResult = result; + } + /* [HarmonyTranspiler] [HarmonyPatch(typeof(DungeonGenerator), "GenerateMainPath", MethodType.Enumerator)] diff --git a/DunGenPlus/DunGenPlus/PluginConfig.cs b/DunGenPlus/DunGenPlus/PluginConfig.cs index 4c90977..321cebd 100644 --- a/DunGenPlus/DunGenPlus/PluginConfig.cs +++ b/DunGenPlus/DunGenPlus/PluginConfig.cs @@ -11,7 +11,7 @@ namespace DunGenPlus { public static ConfigEntry EnableDevDebugTools; public static void SetupConfig(ConfigFile cfg) { - EnableDevDebugTools = cfg.Bind(new ConfigDefinition("Dev", "Enable Dev Debug Tools"), false, new ConfigDescription("If enabled, allows the dev debug tools to be usable in the ship.\n\nPress M to activate.")); + EnableDevDebugTools = cfg.Bind(new ConfigDefinition("Dev", "Enable Dev Debug Tools"), false, new ConfigDescription("If enabled, allows the dev debug tools to be usable in the ship.\n\nPress LeftAlt + M to activate.")); } } diff --git a/DunGenPlus/DunGenPlus/dungen b/DunGenPlus/DunGenPlus/dungen index 87ae31c..cc29b18 100644 Binary files a/DunGenPlus/DunGenPlus/dungen and b/DunGenPlus/DunGenPlus/dungen differ