[#4698] Auto-sync actor senses to prototype token vision#6864
[#4698] Auto-sync actor senses to prototype token vision#6864Sayshal wants to merge 1 commit intofoundryvtt:5.3.xfrom
Conversation
- Expand CONFIG.DND5E.senses from string labels to SenseConfiguration objects with detectionMode, grantsSight, and visionMode properties - Add TokenDocument5e.prepareBaseData to apply sense-derived sight and detection mode overrides to placed tokens - Add CRUD handlers (preCreateSenses, preUpdateSenses) on AttributesFields to persist prototype token sync - Add Actor5e._syncTokenSenses for descendant hook sync when items or effects change - Add senseVisionSync world setting to control the feature - Add migration for existing actors (systemVersion < 6.0.0) - Update all label references to use the new object structure Closes foundryvtt#4698
|
Is there a need for this to be gated behind a setting? |
I think so, it's automation that writes to tokens, and the system already gates similar behavior behind toggles ( The Defaults to |
|
A high-level consideration: We might want to, instead of manually setting values on the token during base data prep, leverage |
Updates the prototype token's sight range, vision mode, and detection modes when an actor's senses change. Works for direct edits on the actor sheet, senses inherited from species items, and Active Effects that modify sense ranges.
CONFIG.DND5E.senseshas been expanded from string labels to objects so each sense can declare adetectionMode, whether itgrantsSight, and avisionMode:Modules can extend this config to add custom senses with their own detection/vision mode mappings.
Vision range is the max of all senses with
grantsSight. Senses without it only add detection modes. So an actor with darkvision 10, truesight 30, and tremorsense 60 gets a sight range of 30 withfeelTremorandseeAlldetection modes.The prototype token is kept in sync through CRUD handlers (
preCreateSenses,preUpdateSensesonAttributesFields, and_syncTokenSensesonActor5ecalled from descendant hooks). Placed tokens on the canvas also get overrides applied duringTokenDocument5e.prepareBaseData, before V14 AE token changes run.A few notes:
senseVisionSyncworld setting (defaulttrue)systemVersion < 6.0.0)Closes #4698