a little bit of cleanup, still some edge cases but took care of the big stuff

This commit is contained in:
2026-06-09 03:29:59 -04:00
parent 7a10f4a9fc
commit e209861cb3
2 changed files with 13 additions and 16 deletions
+6 -11
View File
@@ -94,16 +94,10 @@ public partial class Map : TileMapLayer
public bool IsCellSolid(Vector2I CELL_TO_CHECK)
{
bool hasOccupant = GetOccupant(CELL_TO_CHECK) != null;
if (hasOccupant)
{
// GD.Print(CELL_TO_CHECK, " has occupant");
}
bool hasOccupant = HasOccupant(CELL_TO_CHECK);
bool isSolid = (bool)GetCellTileData(CELL_TO_CHECK).GetCustomData(_isSolidString);
if (isSolid)
{
// GD.Print(CELL_TO_CHECK, " is solid");
}
return hasOccupant || isSolid;
}
@@ -111,7 +105,7 @@ public partial class Map : TileMapLayer
{
List<Vector2I> rowCells = [.. _cells.Where(c => c.Y == ROW_TO_CHECK)];
return rowCells.All(c => GetOccupant(c) != null);
return rowCells.All(c => HasOccupant(c));
}
public void SetCellEnemy(Vector2I ADDRESS, Enemy ENEMY)
@@ -119,7 +113,6 @@ public partial class Map : TileMapLayer
_addressOccupants[ENEMY._address] = null;
SetCellSolid(ENEMY._address);
ENEMY._address = ADDRESS;
_addressOccupants[ADDRESS] = ENEMY;
@@ -146,6 +139,8 @@ public partial class Map : TileMapLayer
{
_astar.SetPointSolid(FROM, false);
List<Vector2I> pathTaken = [.. _astar.GetIdPath(FROM, TO, true)];
_astar.SetPointSolid(FROM, true);
// if (SHOW_PATH)
// {
// for (int i = 0; i < pathTaken.Count; i++)