diff --git a/CHANGELOG.md b/CHANGELOG.md index c616f9a..39da34c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - In cloned scenes Locked Door Alerts will now only highlight the door in the correct scene - When adding a door to a synchronization group it will now assume the correct state if it's being synchronized with it's twin door on a cloned map - Fixed a bug that allowed synchonized doors to be opened dispite them being locked +- Fixed a bug where secret doors that were synchronized with doors on other scenes wouldn't be tinted corretly after interacting with them ## v1.0.1 - When adding a door to a synchronization group adjust it's state to bring it in sync with the other doors diff --git a/main.js b/main.js index 9df7c00..5b4404b 100644 --- a/main.js +++ b/main.js @@ -98,7 +98,13 @@ Hooks.on("updateWall", (scene, wall, update) => { const types = CONST.WALL_DOOR_TYPES if (wall.door === types.NONE) return + // Find the door control corresponding to the changed door const changedDoor = canvas.controls.doors.children.find(control => control.wall.data._id === wall._id); + // If the changed door doesn't have a control it's not on this scene - ignore it + if (!changedDoor) + return + // The wall object we got passed might be from another scene so we replace it with the door from the current scene + wall = changedDoor.wall.data if (wall.door === types.DOOR) changedDoor.icon.tint = 0xFFFFFF else if (wall.door === types.SECRET) @@ -289,7 +295,7 @@ function lockedDoorAlertLeftClick() { // Updates all doors in the specified synchronization group with the provided data function updateSynchronizedDoors(updateData, synchronizationGroup) { // Search for doors belonging to the synchronization group in all scenes - let scenes = filterAllWalls(wall => wall.door && wall.flags.smartdoors?.synchronizationGroup == synchronizationGroup); + let scenes = filterAllWalls(wall => wall.door && wall.flags.smartdoors?.synchronizationGroup === synchronizationGroup); // Update all doors in the synchronization group scenes.forEach((scene) => {