Last active
April 25, 2022 12:26
-
-
Save manniL/4dd20fc425364baa13e7ec27b27cfd5d to your computer and use it in GitHub Desktop.
FoundryVTT - Lock all doors in current scene
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
This is a macro for FoundryVTT to lock all door in a scene. | |
Author: manniL#9160 | |
*/ | |
const DOOR_STATE_LOCKED = 2 | |
const updates = [] | |
canvas.walls?.doors | |
.filter((item) => item.data.ds !== DOOR_STATE_LOCKED) | |
.forEach((item) => updates.push({ _id: item.id, ds: DOOR_STATE_LOCKED })) | |
await canvas.scene.updateEmbeddedDocuments("Wall", updates) | |
ui.notifications?.info(`All doors have been locked.`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment