Skip to content

Commit

Permalink
Make compatbile with the Arms Reach module
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelVo committed Feb 10, 2021
1 parent f905657 commit 6b36b62
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## In development
### Other
- Smart Doors is now compatible with Arms Reach

## v1.2.2
### Bugfix
- Disabled features are now less likely to interfere with other modules, increasing compatibility.
Expand Down
1 change: 0 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
},
"ui": {
"messages": {
"armsReachIncompatiblilty": "You have the modules Smart Doors and Arms Reach activated. Those modules are known to conflict with each other. To resolve the conflict please disable either the \"Toggle Secret Doors\" setting of Smart Doors or the \"Hotkey 'e' for interaction\" setting of Arms Reach.",
"migrating": "Migrating Smart Doors to version {version}. Please don't close the application.",
"migrationDone": "Smart Doors successfully migrated to version {version}.",
"unknownVersion": "Smart Doors migration failed with the error: Unkown Version {version}. Please report this to the Smart Doors issue tracker. To prevent possible data loss don't use this plugin until this error is fixed."
Expand Down
3 changes: 2 additions & 1 deletion src/features/toggle_secret_door.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {settingsKey} from "../settings.js"

// Toggles between normal and secret doors
export function onDoorLeftClick(event) {
if (game.settings.get(settingsKey, "toggleSecretDoors") && event.data.originalEvent.ctrlKey && game.user.isGM) {
// We don't trust the event to be filled with the expected data for compatibilty with arms reach (which passes a broken event)
if (game.settings.get(settingsKey, "toggleSecretDoors") && event.data?.originalEvent?.ctrlKey && game.user.isGM) {
const types = CONST.WALL_DOOR_TYPES
const newtype = this.wall.data.door === types.DOOR ? types.SECRET : types.DOOR
this.wall.update({door: newtype})
Expand Down
11 changes: 0 additions & 11 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ Hooks.once("init", () => {

Hooks.once("ready", () => {
performMigrations()

// Check if arms-reach module is active and conflicting features are enabled
if (game.user.isGM && game.modules.get("arms-reach")?.active) {
// Our toggle-secret-door and arms-reach's hotkeyDoorInteraction conflict. Check if both are enabled.
if (game.settings.get(settingsKey, "toggleSecretDoors") && game.settings.get("arms-reach", "hotkeyDoorInteraction")) {
// Inform the user that they have incompatible features enabled
const incopatibilityMessage = game.i18n.localize("smart-doors.ui.messages.armsReachIncompatiblilty")
console.warn("Smart Doors | " + incopatibilityMessage)
ui.notifications.warn(incopatibilityMessage, {permanent: true})
}
}
})

Hooks.on("renderChatMessage", LockedDoorAlert.onRenderChatMessage)
Expand Down

0 comments on commit 6b36b62

Please sign in to comment.