Dungeon Building p8

This commit is contained in:
dingo
2025-12-28 14:08:57 -05:00
parent 0bdd9b0ffc
commit 1b3e47e5c2
2 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -436,7 +436,7 @@ public class DungeonGeneratorV2
if (x >= 0 && x < MapWidth && ty >= 0 && ty < MapHeight && layout.Tiles[x, ty] == 0)
{
layout.Tiles[x, ty] = floorId;
if (floorId > 1)
if (floorId > 0 && sheetId > 0)
{
layout.TileDetails.Add(new PlacedTile
{
@@ -465,7 +465,7 @@ public class DungeonGeneratorV2
if (tx >= 0 && tx < MapWidth && y >= 0 && y < MapHeight && layout.Tiles[tx, y] == 0)
{
layout.Tiles[tx, y] = floorId;
if (floorId > 1)
if (floorId > 0 && sheetId > 0)
{
layout.TileDetails.Add(new PlacedTile
{
+6 -5
View File
@@ -92,10 +92,10 @@ public class DungeonSimulation
foreach (var (tileX, tileY) in cornerPositions)
{
// Check if this is a valid floor tile
// Check if this is a valid floor tile (non-zero = walkable)
if (tileX >= 0 && tileX < Layout.Width &&
tileY >= 0 && tileY < Layout.Height &&
Layout.Tiles[tileX, tileY] == 1) // 1 = floor
Layout.Tiles[tileX, tileY] != 0) // non-zero = floor
{
// Check surrounding tiles to avoid placing near hallways
bool nearHallway = false;
@@ -113,7 +113,7 @@ public class DungeonSimulation
checkY < entranceRoom.Y ||
checkY >= entranceRoom.Y + entranceRoom.Height;
if (outsideRoom && Layout.Tiles[checkX, checkY] == 1) // Floor outside room = hallway
if (outsideRoom && Layout.Tiles[checkX, checkY] != 0) // Floor outside room = hallway
{
nearHallway = true;
}
@@ -148,7 +148,7 @@ public class DungeonSimulation
if (portalTileX >= 0 && portalTileX < Layout.Width &&
portalTileY >= 0 && portalTileY < Layout.Height &&
Layout.Tiles[portalTileX, portalTileY] == 1)
Layout.Tiles[portalTileX, portalTileY] != 0)
{
var portal = new PortalInstance
{
@@ -1015,7 +1015,8 @@ public class DungeonSimulation
if (tileX < 0 || tileX >= Layout.Width || tileY < 0 || tileY >= Layout.Height)
return false;
return Layout.Tiles[tileX, tileY] == 1;
// Any non-zero tile is walkable (0 = void/wall, >0 = floor tile ID or 1 for basic floor)
return Layout.Tiles[tileX, tileY] != 0;
}
private void MoveToward(MobInstance mob, float targetX, float targetY, float speed)