silphius/resources/hoe/projection-check.js
2024-11-09 20:58:10 -06:00

15 lines
408 B
JavaScript

export default function*({ecs, projected}) {
const layer0 = ecs.get(1).TileLayers.layer(0);
const layer1 = ecs.get(1).TileLayers.layer(1);
const filtered = [];
for (const position of projected) {
if (
[224, 225, 226, 227, 242, 243, 244, 245].includes(layer0.tile(position))
&& ![7].includes(layer1.tile(position))
) {
filtered.push(position);
}
}
return filtered;
}