darkness-dependent-vision/src/hooks/updateScene.js

14 lines
374 B
JavaScript
Raw Normal View History

2021-06-29 20:40:54 +02:00
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
export default function registerForUpdateSceneHook() {
Hooks.on('updateScene', onUpdateScene);
}
function onUpdateScene(scene, change) {
if (change.darkness != null) {
2021-12-04 12:06:03 +01:00
scene.getEmbeddedCollection('Token').forEach((tokenDocument) => tokenDocument.object.updateVisionSource());
2021-06-29 20:40:54 +02:00
}
}