2025-01-31 15:05:45 +01:00
|
|
|
using Godot;
|
|
|
|
|
using System;
|
2025-03-06 13:49:01 +01:00
|
|
|
using System.Linq;
|
|
|
|
|
using Godot.Collections;
|
2025-01-31 15:05:45 +01:00
|
|
|
|
|
|
|
|
public partial class TilemapAvoidance : TileMapLayer
|
|
|
|
|
{
|
|
|
|
|
|
2025-03-06 13:49:01 +01:00
|
|
|
[Export] private Array<TileMapLayer> _solidLayers;
|
2025-01-31 15:05:45 +01:00
|
|
|
|
|
|
|
|
public override bool _UseTileDataRuntimeUpdate(Vector2I coords)
|
|
|
|
|
{
|
2025-03-06 13:49:01 +01:00
|
|
|
// if (_solidLayer.GetUsedCellsById(0).Contains(coords))
|
|
|
|
|
// {
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
2025-01-31 15:05:45 +01:00
|
|
|
|
2025-03-06 13:49:01 +01:00
|
|
|
return _solidLayers.Aggregate(false, (current, layer) => current | layer.GetUsedCellsById(0).Contains(coords));
|
2025-01-31 15:05:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void _TileDataRuntimeUpdate(Vector2I coords, TileData tileData)
|
|
|
|
|
{
|
|
|
|
|
tileData.SetNavigationPolygon(0, null);
|
|
|
|
|
}
|
|
|
|
|
}
|