update summon powers to use sequencer crosshairs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* globals Portal */
|
||||
/* globals Sequencer */
|
||||
import { log, moduleHelpers, moduleName } from '../globals.js';
|
||||
import { templates } from '../preloadTemplates.js';
|
||||
import { ActorFolderEffect } from './basePowers.js';
|
||||
@@ -30,10 +30,25 @@ export class BaseSummonEffect extends ActorFolderEffect {
|
||||
}
|
||||
|
||||
async spawn() {
|
||||
const spawned = await new Portal()
|
||||
.addCreature(this.targetTokenDoc, { count: this.summonCount })
|
||||
.texture(this.targetTokenDoc.texture.src)
|
||||
.spawn();
|
||||
const location = await Sequencer.Crosshair.show({
|
||||
distance: this.targetTokenDoc.height / 2,
|
||||
texture: this.targetTokenDoc.texture.src,
|
||||
snap: {
|
||||
position: CONST.GRID_SNAPPING_MODES.VERTEX | CONST.GRID_SNAPPING_MODES.CENTER,
|
||||
},
|
||||
label: { text: this.targetTokenDoc.name },
|
||||
});
|
||||
const tokenDocs = [];
|
||||
for (let i = 0; i < this.summonCount; i++) {
|
||||
tokenDocs[i] = this.targetTokenDoc.clone({
|
||||
x: location.token.x + i * 5,
|
||||
y: location.token.y + i * 5,
|
||||
elevation: this.source.elevation,
|
||||
});
|
||||
}
|
||||
log('token docs', tokenDocs);
|
||||
const spawned = await this.source.scene.createEmbeddedDocuments('Token', tokenDocs);
|
||||
log('Spawned', spawned);
|
||||
return spawned;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user