diff --git a/Game/Dungeon/DungeonGeneratorV3.cs b/Game/Dungeon/DungeonGeneratorV3.cs index 9030b20..ccb336f 100644 --- a/Game/Dungeon/DungeonGeneratorV3.cs +++ b/Game/Dungeon/DungeonGeneratorV3.cs @@ -1436,6 +1436,10 @@ public class DungeonGeneratorV3 { Log($"--- Placing Wall Tiles ---"); Log($"Wall templates available: {_wallTemplates.Count}"); + Log($"Socket matching: {(UseSocketMatching ? "ENABLED" : "DISABLED")}"); + + // Clear placement tracking for socket matching (separate from floor tiles) + _placedTemplates.Clear(); // Log detailed template info for debugging foreach (var t in _wallTemplates) @@ -1754,12 +1758,22 @@ public class DungeonGeneratorV3 var ourSocket = config.West.FirstOrDefault(); var theirSocket = westConfig.East.FirstOrDefault(); - if (ourSocket != null && theirSocket != null && !SocketConfiguration.CanConnect(ourSocket, theirSocket)) + if (ourSocket != null && theirSocket != null) { - return false; + var canConnect = SocketConfiguration.CanConnect(ourSocket, theirSocket); + if (!canConnect && VerboseLogging) + { + LogVerbose($" Socket mismatch at ({x},{y}): Template {template.Id} West={ourSocket.Type}:{ourSocket.CustomName ?? "null"} vs Neighbor({x-1},{y}) Template {westTemplateId} East={theirSocket.Type}:{theirSocket.CustomName ?? "null"}"); + } + if (!canConnect) return false; } } } + else if (x > 0 && VerboseLogging) + { + // No placed template at west neighbor - this shouldn't happen in row-by-row filling + LogVerbose($" No placed template found at West neighbor ({x-1},{y}) when checking ({x},{y})"); + } return true; }