Toggle between secret and normal door by ctrl+left click

This commit is contained in:
2020-12-07 23:06:53 +01:00
parent 598e323689
commit 408eee8bc0
4 changed files with 34 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
## v1.1.0 (in development)
### New features
- Tint secret doors grey for the GM to differentiate them from regular doors
- Toggle doors between secret and normal with ctrl+click
## 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

@@ -9,6 +9,12 @@ Makes doors smarter. Allows doors to synchronize across multiple scenes and send
Which where the secret doors again? This tints all secret doors grey in the GM view, allowing to easily differentiate between normal and secret doors.
### Toggle Secret Doors
![Toggle Secret Doors demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/da5872042ea81e2f41875a193d161331a81a2b6d/media/secret_door_toggle.webp)
Easily reveal secret doors to players. Strg+left click secrets doors to turn them into regular doors. Strg+left click can also be done on normal doors to turn them into secret doors. Using this in combination with Tint Secret Doors is recommended so you can actually see what you are doing.
### Locked Door Alerts
![Locked Door Alerts demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/360d724240634dbc6cc493a3b62243a8b28b7056/media/locked_door_alert.webp)

View File

@@ -12,6 +12,10 @@
"synchronizedDoors": {
"name": "Synchronized Doors",
"hint": "Synchronize the state of configured doors"
},
"toggleSecretDoors": {
"name": "Toggle Secret Doors",
"hint": "Toggle the door type between normal and secret using ctrl+left click"
}
},
"ui": {

23
main.js
View File

@@ -168,6 +168,9 @@ function onDoorMouseDown(event) {
if ( game.paused && !game.user.isGM )
return false
if (toggleSecretDoorLeftClick.call(this, event))
return true
if (lockedDoorAlertLeftClick.call(this))
return true
@@ -179,12 +182,24 @@ function onDoorMouseDown(event) {
// Our custom handler for rightdown events on doors
function onDoorRightDown(event) {
if (synchronizedDoorsRightClick.call(this))
return true
return false
}
// Toggles between normal and secret doors
function toggleSecretDoorLeftClick(event) {
if (event.data.originalEvent.ctrlKey && game.user.isGM && game.settings.get(settingsKey, "toggleSecretDoors")) {
const types = CONST.WALL_DOOR_TYPES
const newtype = this.wall.data.door === types.DOOR ? types.SECRET : types.DOOR
this.wall.update({door: newtype})
return true
}
return false
}
// Creates a chat message stating that a player tried to open a locked door
function lockedDoorAlertLeftClick() {
const state = this.wall.data.ds
@@ -318,6 +333,14 @@ function registerSettings() {
default: true,
onChange: reloadGM,
})
game.settings.register(settingsKey, "toggleSecretDoors", {
name: "smart-doors.settings.toggleSecretDoors.name",
hint: "smart-doors.settings.toggleSecretDoors.hint",
scope: "world",
config: true,
type: Boolean,
default: true,
})
game.settings.register(settingsKey, "lockedDoorAlert", {
name: "smart-doors.settings.lockedDoorAlert.name",
hint: "smart-doors.settings.lockedDoorAlert.hint",