Skip to content

Commit

Permalink
Rerender token vision when RBV setting is changed (#14676)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosFdez committed May 29, 2024
1 parent 6e83870 commit dda6771
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/module/scene/sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export class SceneConfigPF2e<TDocument extends ScenePF2e> extends SceneConfig<TD
value: "",
label: game.i18n.format("PF2E.SETTINGS.EnabledDisabled.Default", { worldDefault }),
},
{ value: "true", label: "PF2E.SETTINGS.EnabledDisabled.Enabled" },
{ value: "false", label: "PF2E.SETTINGS.EnabledDisabled.Disabled" },
{ value: "true", label: game.i18n.localize("PF2E.SETTINGS.EnabledDisabled.Enabled") },
{ value: "false", label: game.i18n.localize("PF2E.SETTINGS.EnabledDisabled.Disabled") },
];
const templates = await renderTemplate(hbsPath, { scene: this.scene, rbvOptions });

Expand Down
6 changes: 4 additions & 2 deletions src/module/system/settings/automation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ export class AutomationSettings extends SettingsMenuPF2e {
hint: CONFIG.PF2E.SETTINGS.automation.rulesBasedVision.hint,
default: true,
type: Boolean,
requiresReload: true,
onChange: (value) => {
game.pf2e.settings.rbv = !!value;
canvas.perception.update({ initializeVision: true }, true);
for (const token of canvas.scene?.tokens ?? []) {
token.reset();
}
canvas.perception.update({ initializeLighting: true, initializeVision: true }, true);
},
},
iwr: {
Expand Down
2 changes: 1 addition & 1 deletion static/templates/scene/sheet-partials.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<label for="{{scene.uuid}}-rules-based-vision">{{localize "PF2E.SETTINGS.Automation.RulesBasedVision.Name"}}</label>
<div class="form-fields">
<select id="{{scene.uuid}}-rules-based-vision" name="flags.pf2e.rulesBasedVision">
{{selectOptions rbvOptions selected=scene.flags.pf2e.rulesBasedVision localize=true}}
{{selectOptions rbvOptions selected=scene.flags.pf2e.rulesBasedVision}}
</select>

<button type="button" class="automation-settings" data-action="world-rbv-setting"
Expand Down

0 comments on commit dda6771

Please sign in to comment.