Fixing Room Templates

This commit is contained in:
dingo
2026-01-10 09:22:14 -05:00
parent 8c756cc191
commit b987015e67
4 changed files with 44 additions and 9 deletions
+20 -2
View File
@@ -834,6 +834,7 @@ public class DungeonGeneratorV3
X = spawn.X,
Y = spawn.Y,
MobType = mobType,
MobDefinitionId = spawn.MobDefinitionId,
RoomIndex = roomIndex,
IsAlive = true
});
@@ -1079,7 +1080,7 @@ public class DungeonGeneratorV3
{
try
{
var spawns = JsonSerializer.Deserialize<List<BuilderMobSpawn>>(template.MobSpawnsJson);
var spawns = JsonSerializer.Deserialize<List<BuilderMobSpawn>>(template.MobSpawnsJson, _jsonOptions);
if (spawns != null)
{
foreach (var spawn in spawns)
@@ -1089,6 +1090,7 @@ public class DungeonGeneratorV3
X = room.X + spawn.X,
Y = room.Y + spawn.Y,
Type = spawn.Type,
MobDefinitionId = spawn.MobDefinitionId,
Count = spawn.Count
});
}
@@ -1223,6 +1225,15 @@ public class DungeonGeneratorV3
if (x >= 0 && x < MapWidth && cy >= 0 && cy < MapHeight)
{
layout.Walkable[x, cy] = true;
// Clear tile so FillFloorTiles can place a floor tile here
// This handles walls that get carved through for corridors
layout.Tiles[x, cy] = 0;
// Remove any existing tile details at this position
layout.TileDetails.RemoveAll(t => t.X == x && t.Y == cy);
// Clear from placed templates tracking
_placedTemplates.Remove($"{x},{cy}");
}
}
}
@@ -1242,6 +1253,14 @@ public class DungeonGeneratorV3
if (cx >= 0 && cx < MapWidth && y >= 0 && y < MapHeight)
{
layout.Walkable[cx, y] = true;
// Clear tile so FillFloorTiles can place a floor tile here
layout.Tiles[cx, y] = 0;
// Remove any existing tile details at this position
layout.TileDetails.RemoveAll(t => t.X == cx && t.Y == y);
// Clear from placed templates tracking
_placedTemplates.Remove($"{cx},{y}");
}
}
}
@@ -2043,7 +2062,6 @@ public class ConnectionPoint
public int X { get; set; }
public int Y { get; set; }
public string Direction { get; set; } = "north";
public int Width { get; set; }
}
public class TemplateTilePlacement