Fixing Room Templates
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user