Always check first if a feature is enabled before doing anything else to increase compatibility with other modules

This commit is contained in:
2021-01-27 12:43:47 +01:00
parent 2a9d7e7acb
commit 869fedd128
4 changed files with 10 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ import {settingsKey} from "../settings.js"
// Toggles between normal and secret doors
export function onDoorLeftClick(event) {
if (event.data.originalEvent.ctrlKey && game.user.isGM && game.settings.get(settingsKey, "toggleSecretDoors")) {
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})