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

13 lines
374 B
JavaScript

// 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.updateVisionSource());
}
}