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

14 lines
368 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) {
scene.getEmbeddedCollection('Token').forEach((tokenDocument) => tokenDocument.object.updateSource());
}
}