Ensure doors are on the current scene before tinting them

This commit is contained in:
2020-12-08 21:04:05 +01:00
parent ff53eed1ee
commit e7539b8f22
2 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -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) => {