Wire pf2e auto-template into preCreateRegion for Foundry v14#311
Open
takaqiao wants to merge 1 commit into
Open
Wire pf2e auto-template into preCreateRegion for Foundry v14#311takaqiao wants to merge 1 commit into
takaqiao wants to merge 1 commit into
Conversation
In Foundry v14 + PF2e v8 spell areas are placed as Regions rather than MeasuredTemplates. flags.pf2e.origin keeps the same shape and flags.pf2e.areaShape carries one of the EFFECT_AREA_SHAPES values, so the existing autoTemplate categories/overrides settings can be reused on the Region creation path. - AutoTemplatePF2E gains preCreateRegion(region) and a pf2e areaShape -> legacy template type map (burst/emanation/cylinder -> circle, cube/square -> rect, line -> ray) so each trait is matched against the right config bucket. - tokenmagic.js adds a preCreateRegion handler that mirrors the existing preCreateMeasuredTemplate flow: it lets the system auto-template inject tmfx options, then converts them into flags.tokenmagic.filters and flags.tokenmagic.regionData.alpha so the existing createRegion hook picks them up at render time. - module.json compatibility.verified bumped to 14.360 (minimum stays at 13).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In Foundry v14 + PF2e v8 spell areas are placed as Regions rather than MeasuredTemplates (
canvas.regions.placeRegion(...)). The existing autoTemplate flow only fires onpreCreateMeasuredTemplate, so on v14 PF2e games auto-presets stop applying to spells.flags.pf2e.originkeeps the same{name, slug, traits, ...}shape on regions, andflags.pf2e.areaShapecarries one of the PF2eEFFECT_AREA_SHAPESvalues (burst,cone,cube,cylinder,emanation,line,square). This PR reuses the existing autoTemplate settings on the Region creation path with a small shape map so trait → preset lookups continue to work.Changes
AutoTemplatePF2EgainspreCreateRegion(region)and an areaShape → legacy template type map (burst/emanation/cylinder→circle,cube/square→rect,line→ray). Override-by-name still wins over category-by-trait, matching the template flow.tokenmagic.jsadds apreCreateRegionhook that mirrors the existingpreCreateMeasuredTemplateflow: lets the system auto-template inject tmfx options, then converts them intoflags.tokenmagic.filtersandflags.tokenmagic.regionData.alphaso the existingcreateRegionhook picks them up at render time.placeableTypeis set toRegionand the anchor is fixed to(0.5, 0.5)since regions have no direction/angle.module.jsoncompatibility.verifiedbumped to14.360.minimumis left at13so v13 games keep installing it unchanged.No bundle output is touched; running webpack will pick up the source edits.
Test plan
EFFECT_AREA_SHAPESvalue (e.g. Burning Hands → cone, Fireball → burst, Lightning Bolt → line) and confirm trait-matched presets and tints apply to the resulting Region.