Intelligent graphics sets support removal of fields too

This commit is contained in:
Mal 2023-09-24 01:57:26 +02:00
parent e6c247c655
commit c5eef3c657
1 changed files with 29 additions and 13 deletions

View File

@ -199,8 +199,16 @@ export default class Tilorswift
this.level.terrain.getFieldNeighbourCode(field)
);
field.setIndex(index % this.tileset.tiles);
field.setIndex(index);
this.updateNeighbours(field);
} else {
field.setIndex(this.level.terrain.brushTileIndex);
}
}
updateNeighbours(field)
{
for (const neighbour of this.level.terrain.getFieldNeighbours(field)) {
if (neighbour.index === -1) {
continue;
@ -212,8 +220,16 @@ export default class Tilorswift
neighbour.setIndex(neighbourIndex);
}
} else {
field.setIndex(this.level.terrain.brushTileIndex);
}
removeTerrain(field)
{
field.setIndex(-1);
if (this.brush.isIntelligent) {
for (const neighbour of this.level.terrain.getFieldNeighbours(field)) {
this.updateNeighbours(field);
}
}
}
@ -228,7 +244,7 @@ export default class Tilorswift
this.addTerrain(event.getField());
break;
case 2:
event.getField().setIndex(-1);
this.removeTerrain(event.getField());
break;
}
} else if (this.brush.mode === BrushMode.ENTRANCE) {