update summon powers to use sequencer crosshairs

This commit is contained in:
Mike Bloy 2025-06-01 16:03:38 -05:00
parent 15436de599
commit c7193b3306
3 changed files with 28 additions and 6 deletions

View File

@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated for Foundry v13 - Updated for Foundry v13
- Updated for SWADE 5.0 - Updated for SWADE 5.0
- Updated powerEffect application and other dialogs to ApplicationV2 - Updated powerEffect application and other dialogs to ApplicationV2
- BREAKING CHANGE: removed Portal dependency for summons
- BREAKING CHANGE: added Sequencer dependency for summons
### Fixed ### Fixed

View File

@ -22,7 +22,12 @@ export function firstOwner(doc) {
// lifted from warpgate // lifted from warpgate
// https://github.com/trioderegion/warpgate/blob/master/src/scripts/module.js // https://github.com/trioderegion/warpgate/blob/master/src/scripts/module.js
if (!doc) return undefined; if (!doc) return undefined;
const corrected = doc instanceof TokenDocument ? doc.actor : doc instanceof Token ? doc.document.actor : doc; const corrected =
doc instanceof TokenDocument
? doc.actor
: doc instanceof foundry.canvas.placeables.Token
? doc.document.actor
: doc;
const permissionObject = foundry.utils.getProperty(corrected ?? {}, 'ownership'); const permissionObject = foundry.utils.getProperty(corrected ?? {}, 'ownership');
const playerOwners = Object.entries(permissionObject) const playerOwners = Object.entries(permissionObject)
.filter(([id, level]) => !game.users.get(id)?.isGM && game.users.get(id)?.active && level === 3) .filter(([id, level]) => !game.users.get(id)?.isGM && game.users.get(id)?.active && level === 3)

View File

@ -1,4 +1,4 @@
/* globals Portal */ /* globals Sequencer */
import { log, moduleHelpers, moduleName } from '../globals.js'; import { log, moduleHelpers, moduleName } from '../globals.js';
import { templates } from '../preloadTemplates.js'; import { templates } from '../preloadTemplates.js';
import { ActorFolderEffect } from './basePowers.js'; import { ActorFolderEffect } from './basePowers.js';
@ -30,10 +30,25 @@ export class BaseSummonEffect extends ActorFolderEffect {
} }
async spawn() { async spawn() {
const spawned = await new Portal() const location = await Sequencer.Crosshair.show({
.addCreature(this.targetTokenDoc, { count: this.summonCount }) distance: this.targetTokenDoc.height / 2,
.texture(this.targetTokenDoc.texture.src) texture: this.targetTokenDoc.texture.src,
.spawn(); 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; return spawned;
} }