Skip to content

Commit

Permalink
Expose aura logic for hex grid support
Browse files Browse the repository at this point in the history
  • Loading branch information
FolkvangrForgent committed Dec 8, 2024
1 parent e8084f5 commit 9eefb66
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/module/scene/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let auraCheckLock = Promise.resolve();

/** Check for auras containing newly-placed or moved tokens */
const checkAuras = foundry.utils.debounce(async function (this: ScenePF2e): Promise<void> {
if (!(canvas.ready && this.isInFocus && this.grid.type === CONST.GRID_TYPES.SQUARE)) {
if (!(canvas.ready && this.isInFocus)) {
return;
}

Expand Down
8 changes: 7 additions & 1 deletion src/module/scene/token-document/aura/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ class TokenAura implements TokenAuraData {
/** Does this aura overlap with (at least part of) a token? */
containsToken(token: TokenDocumentPF2e): boolean {
// If either token is hidden or not rendered, return false early
if (this.token.hidden || token.hidden || !this.token.object || !token.object) {
if (
this.token.hidden ||
token.hidden ||
!this.token.object ||
!token.object ||
this.scene.grid.type !== CONST.GRID_TYPES.SQUARE
) {
return false;
}

Expand Down
12 changes: 12 additions & 0 deletions src/scripts/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ import {
weaponTraits,
} from "./traits.ts";

import { AuraRenderers } from "@module/canvas/token/aura/map.ts";
import { AuraRenderer } from "@module/canvas/token/aura/renderer.ts";
import { TokenAura } from "@scene/token-document/aura/index.ts";
import { EffectAreaSquare } from "@module/canvas/effect-area-square.ts";

export type StatusEffectIconTheme = "default" | "blackWhite";

const actorTypes: Record<ActorType, string> = {
Expand Down Expand Up @@ -961,6 +966,13 @@ export const PF2ECONFIG = {
},
},

Aura: {
renderers: AuraRenderers,
renderer: AuraRenderer,
token: TokenAura,
square: EffectAreaSquare,
},

JournalEntry: { sheetClass: JournalSheetPF2e },

Canvas: {
Expand Down

0 comments on commit 9eefb66

Please sign in to comment.