onWallConfigUpdate now accounts for the fact that wall ids aren't globally unique

This commit is contained in:
2020-12-08 20:34:05 +01:00
parent 597ede53ab
commit 7724476128
2 changed files with 14 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
### Bugfixes ### Bugfixes
- In cloned scenes Locked Door Alerts will now only highlight the door in the correct scene - 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
## v1.0.1 ## v1.0.1
- When adding a door to a synchronization group adjust it's state to bring it in sync with the other doors - When adding a door to a synchronization group adjust it's state to bring it in sync with the other doors

14
main.js
View File

@@ -151,7 +151,19 @@ async function onWallConfigUpdate(event, formData) {
// If a synchronization group is set, get the state of existing doors and assume their state // If a synchronization group is set, get the state of existing doors and assume their state
if (formData.synchronizationGroup) { if (formData.synchronizationGroup) {
const doorInGroup = findInAllWalls(wall => wall.door && wall.flags.smartdoors?.synchronizationGroup == formData.synchronizationGroup && !ids.includes(wall._id)); // Search for other doors in the synchronization group that aren't in the list of edited doors
const doorInGroup = findInAllWalls(wall => {
// We only search for doors
if (!wall.door)
return false
// We only want doors in the same synchronization group
if (wall.flags.smartdoors?.synchronizationGroup !== formData.synchronizationGroup)
return false
// Doors on this scene that have their id included in `ids` are currently being changed. Ignore them.
if (wall.scene === canvas.scene && ids.includes(wall._id))
return false
return true
})
if (doorInGroup) if (doorInGroup)
updateData.ds = doorInGroup.ds; updateData.ds = doorInGroup.ds;
} }