diff --git a/CHANGELOG.md b/CHANGELOG.md index 951dba2..7956b83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated for Foundry v13 - Updated for SWADE 5.0 - Updated powerEffect application and other dialogs to ApplicationV2 +- BREAKING CHANGE: removed Portal dependency for summons +- BREAKING CHANGE: added Sequencer dependency for summons ### Fixed diff --git a/src/module/helpers.js b/src/module/helpers.js index 5ef16a1..248e42f 100644 --- a/src/module/helpers.js +++ b/src/module/helpers.js @@ -22,7 +22,12 @@ export function firstOwner(doc) { // lifted from warpgate // https://github.com/trioderegion/warpgate/blob/master/src/scripts/module.js 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 playerOwners = Object.entries(permissionObject) .filter(([id, level]) => !game.users.get(id)?.isGM && game.users.get(id)?.active && level === 3) diff --git a/src/module/powers/summonSupport.js b/src/module/powers/summonSupport.js index aa627a6..d4401c7 100644 --- a/src/module/powers/summonSupport.js +++ b/src/module/powers/summonSupport.js @@ -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; }