Tint secret doors in grey for the GM

This commit is contained in:
2020-12-07 21:09:20 +01:00
parent d5a273e12e
commit 598e323689
4 changed files with 57 additions and 4 deletions

View File

@@ -1,3 +1,7 @@
## v1.1.0 (in development)
### New features
- Tint secret doors grey for the GM to differentiate them from regular doors
## v1.0.1
- When adding a door to a synchronization group adjust it's state to bring it in sync with the other doors
- Use the players character as speaker for the Locked Door Alert

View File

@@ -3,15 +3,21 @@ Makes doors smarter. Allows doors to synchronize across multiple scenes and send
## Feature overview
### Locked door alerts
![Locked door alerts demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/360d724240634dbc6cc493a3b62243a8b28b7056/media/locked_door_alert.webp)
### Tint Secret Doors
![Tint Secret Doors demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/dc5d328cd9bc4a0e2aacc5c86ab59e15739cc6d1/media/tint_secret_doors.webp)
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.
### Locked Door Alerts
![Locked Door Alerts demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/360d724240634dbc6cc493a3b62243a8b28b7056/media/locked_door_alert.webp)
Keep everyone informed who tried to open which door. Whenever a player tries to open a door that is locked, a chat message stating that fact will be sent to all players. Additionally the door locked sound will be played for everyone. When the chat message is hovered with the mouse, the door that the player tried to open will be highlighted.
If the GM tries to open a locked door the sound will only played for him and no chat message will be sent.
### Synchronized doors
![Synchronized doors demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/360d724240634dbc6cc493a3b62243a8b28b7056/media/synchronized_doors.webp)
### Synchronized Doors
![Synchronized Doors demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/360d724240634dbc6cc493a3b62243a8b28b7056/media/synchronized_doors.webp)
Keep multiple doors in sync - even across different scenes. Example use cases:
- A tavern has an outdoor and an indoor scene. If a player opens the entrance door on the outdoor map, the entrance door in the indoor map will be opened as well

View File

@@ -1,6 +1,10 @@
{
"smart-doors": {
"settings": {
"highlightSecretDoors": {
"name": "Tint Secret Doors",
"hint": "Shade secret doors in a different color on the gm screen to differentiate them from normal doors"
},
"lockedDoorAlert": {
"name": "Locked Door Alert",
"hint": "Send a message in chat when a player tried to open a locked door"

39
main.js
View File

@@ -37,6 +37,31 @@ Hooks.on("renderChatMessage", (message, html, data) => {
html.on("mouseleave", mouseLeave);
})
const SECRET_DOOR_TINT = 0x222222
// Tint all secret doors dark grey
Hooks.on("canvasReady", () => {
if (game.settings.get(settingsKey, "highlightSecretDoors")) {
const types = CONST.WALL_DOOR_TYPES
const secretDoors = canvas.controls.doors.children.filter(control => control.wall.data.door == types.SECRET)
secretDoors.forEach(control => control.icon.tint = SECRET_DOOR_TINT)
}
})
// If door type has been changed, tint the door accordingly
Hooks.on("updateWall", (scene, wall, update) => {
const types = CONST.WALL_DOOR_TYPES
if (wall.door === types.NONE)
return
const changedDoor = canvas.controls.doors.children.find(control => control.wall.data._id === wall._id);
if (wall.door === types.DOOR)
changedDoor.icon.tint = 0xFFFFFF
else if (wall.door === types.SECRET)
changedDoor.icon.tint = SECRET_DOOR_TINT
else
console.warn("Smart Doors | Encountered unknown door type " + wall.door + " while highlighting secret doors.")
})
// Inject our custom settings into the WallConfig dialog
Hooks.on("renderWallConfig", (wallConfig, html, data) => {
// Settings for synchronized doors
@@ -272,6 +297,11 @@ function performMigrations() {
ui.notifications.error(game.i18n.localize("smart-doors.ui.messages.unknownVersion"), {permanent: true})
}
function reloadGM() {
if (game.user.isGM)
location.reload()
}
function registerSettings() {
game.settings.register(settingsKey, "dataVersion", {
scope: "world",
@@ -279,6 +309,15 @@ function registerSettings() {
type: String,
default: "fresh install"
})
game.settings.register(settingsKey, "highlightSecretDoors", {
name: "smart-doors.settings.highlightSecretDoors.name",
hint: "smart-doors.settings.highlightSecretDoors.hint",
scope: "world",
config: true,
type: Boolean,
default: true,
onChange: reloadGM,
})
game.settings.register(settingsKey, "lockedDoorAlert", {
name: "smart-doors.settings.lockedDoorAlert.name",
hint: "smart-doors.settings.lockedDoorAlert.hint",