Skip to content

Instantly share code, notes, and snippets.

@manniL
Last active April 25, 2022 12:26
Show Gist options
  • Save manniL/4dd20fc425364baa13e7ec27b27cfd5d to your computer and use it in GitHub Desktop.
Save manniL/4dd20fc425364baa13e7ec27b27cfd5d to your computer and use it in GitHub Desktop.
FoundryVTT - Lock all doors in current scene
/**
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