can capture and destroy ports

This commit is contained in:
evanpelle
2024-11-14 08:09:24 -08:00
committed by Evan
parent 530f2dc2df
commit d3d0651659
5 changed files with 40 additions and 18 deletions
@@ -72,6 +72,12 @@ export class StructureLayer implements Layer {
private handlePortEvent(event: UnitEvent) {
if (!this.anchorImageLoaded) return;
bfs(event.unit.tile(), euclDist(event.unit.tile(), 8))
.forEach(t => this.clearCell(t.cell()));
if (!event.unit.isActive()) {
return
}
// Create a temporary canvas to process the anchor icon
const tempCanvas = document.createElement('canvas');
const tempContext = tempCanvas.getContext('2d');