9 Commits

11 changed files with 159 additions and 22 deletions

View File

@@ -1,3 +1,28 @@
## 1.3.1
### Bugfixes
- The keybinding to toggle secret doors no longer supresses other keybindings that are assigned to the same key
## 1.3.0
### New features
- The keybinding for the Toggle Secret Door feature can now be reconfigured via Foundries keybinding configuration (the default key has changed to AltLeft)
### Compatibility
- Smart Doors is now compatible with Foundry 9
### Translation
- Added french translation (thanks to Elfenduli)
## 1.2.9
### Feature revival
- The "Tint secret doors" feature is back, but will remain disabled by default.
## 1.2.8
### Compatibility
- Smart Doors is now compatible with Foundry 0.8.8
- Due to API changes inside Foundry, Smart Doors is no longer compatible with Foundry versions older than 0.8.7
## 1.2.7 ## 1.2.7
### Compatibility ### Compatibility
- Smart Doors is now compatible with Foundry 0.8.5 - Smart Doors is now compatible with Foundry 0.8.5

View File

@@ -10,16 +10,10 @@ Makes doors smarter. Allows doors to synchronize across multiple scenes and send
Door Control icons will be rendered the same size in every scene, regardless of the configured grid size. The size of the icons is configurable. Door Control icons will be rendered the same size in every scene, regardless of the configured grid size. The size of the icons is configurable.
### 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.
### Toggle Secret Doors ### Toggle Secret Doors
![Toggle Secret Doors demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/da5872042ea81e2f41875a193d161331a81a2b6d/media/secret_door_toggle.webp) ![Toggle Secret Doors demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/da5872042ea81e2f41875a193d161331a81a2b6d/media/secret_door_toggle.webp)
Easily reveal secret doors to players. Ctrl+left click secrets doors to turn them into regular doors. Ctrl+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. Easily reveal secret doors to players. Alt+left click secrets doors to turn them into regular doors. Alt+left click can also be done on normal doors to turn them into secret doors. The keybinding for this feature can be reconfigured.
### Locked Door Alerts ### Locked Door Alerts
@@ -29,6 +23,10 @@ Keep everyone informed who tried to open which door. Whenever a player tries to
If the GM tries to open a locked door the sound will only played for him and no chat message will be sent. If the GM tries to open a locked door the sound will only played for him and no chat message will be sent.
### Tint Secret Doors
This tints secret doors in a gay shade to make them easier to discern from regular doors when being zoomed further out.
### Synchronized Doors ### Synchronized Doors
![Synchronized Doors demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/360d724240634dbc6cc493a3b62243a8b28b7056/media/synchronized_doors.webp) ![Synchronized Doors demonstration](https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/360d724240634dbc6cc493a3b62243a8b28b7056/media/synchronized_doors.webp)

View File

@@ -1,10 +1,20 @@
{ {
"smart-doors": { "smart-doors": {
"keybindings": {
"toggleSecretDoor": {
"name": "Toggle Secret Door",
"hint": "While this key is being pressed, clicking on doors will cause the to toggle between normal and secret door"
}
},
"settings": { "settings": {
"doorControlSizeFactor": { "doorControlSizeFactor": {
"name": "Door Control Size Factor", "name": "Door Control Size Factor",
"hint": "Defines by which factor the size of the door control icons should be scaled up" "hint": "Defines by which factor the size of the door control icons should be scaled up"
}, },
"highlightSecretDoors": {
"name": "Tint Secret Doors",
"hint": "Shade secret doors in a different color on the gm screen to differentiate them from normal doors"
},
"lockedDoorAlert": { "lockedDoorAlert": {
"name": "Locked Door Alert", "name": "Locked Door Alert",
"hint": "Send a message in chat when a player tried to open a locked door" "hint": "Send a message in chat when a player tried to open a locked door"
@@ -12,10 +22,6 @@
"synchronizedDoors": { "synchronizedDoors": {
"name": "Synchronized Doors", "name": "Synchronized Doors",
"hint": "Synchronize the state of configured 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": { "ui": {

35
lang/fr.json Normal file
View File

@@ -0,0 +1,35 @@
{
"smart-doors": {
"settings": {
"doorControlSizeFactor": {
"name": "Facteur de taille de commande de porte",
"hint": "Définit par quel facteur la taille des icônes de contrôle de porte doit être agrandie"
},
"highlightSecretDoors": {
"name": "Teinte des portes secrètes",
"indice": "Ombragez les portes secrètes d'une couleur différente sur l'écran gm pour les différencier des portes normales"
},
"lockedDoorAlert": {
"name": "Alerte de porte verrouillée",
"hint": "Envoyer un message dans le chat lorsqu'un joueur essaie d'ouvrir une porte verrouillée"
},
"synchronizedDoors": {
"name": "Portes synchronisées",
"hint": "Synchroniser l'état des portes configurées"
}
}
},
"ui": {
"messages": {
"migrating": "Migration de Smart Doors vers la version {version}. Veuillez ne pas fermer l'application.",
"migrationDone": "Smart Doors a migré avec succès vers la version {version}.",
"unknownVersion": "La migration de Smart Doors a échoué avec l'erreur : Version inconnue {version}. Veuillez le signaler à l'outil de suivi des problèmes Smart Doors. Pour éviter une éventuelle perte de données, n'utilisez pas ce plug-in tant que cette erreur n'est pas corrigée."
},
"synchronizedDoors": {
"description": "Les changements d'état des portes dans le même groupe de synchronisation seront synchronisés entre les scènes. Laissez vide pour désactiver la synchronisation pour cette porte.",
"groupName": "Groupe de synchronisation",
"synchronizeSecretStatus": "Synchroniser le statut Secret"
}
}
}
}

View File

@@ -2,9 +2,9 @@
"name": "smart-doors", "name": "smart-doors",
"title": "Smart Doors", "title": "Smart Doors",
"description": "Makes doors smarter. Allows doors to synchronize across multiple scenes and sends chat messages when players try to open locked doors.", "description": "Makes doors smarter. Allows doors to synchronize across multiple scenes and sends chat messages when players try to open locked doors.",
"version": "1.2.7", "version": "1.3.1",
"minimumCoreVersion" : "0.8.5", "minimumCoreVersion" : "9.238",
"compatibleCoreVersion" : "0.8.5", "compatibleCoreVersion" : "9",
"authors": [ "authors": [
{ {
"name": "Manuel Vögele", "name": "Manuel Vögele",
@@ -21,11 +21,16 @@
"lang": "en", "lang": "en",
"name": "English", "name": "English",
"path": "lang/en.json" "path": "lang/en.json"
},
{
"lang": "fr",
"name": "Français",
"path": "lang/fr.json"
} }
], ],
"url": "https://github.com/manuelVo/foundryvtt-smart-doors", "url": "https://github.com/manuelVo/foundryvtt-smart-doors",
"manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/master/module.json", "manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-smart-doors/master/module.json",
"download": "https://github.com/manuelVo/foundryvtt-smart-doors/archive/v1.2.7.zip", "download": "https://github.com/manuelVo/foundryvtt-smart-doors/archive/v1.3.1.zip",
"readme": "https://github.com/manuelVo/foundryvtt-smart-doors/blob/master/README.md", "readme": "https://github.com/manuelVo/foundryvtt-smart-doors/blob/master/README.md",
"changelog": "https://github.com/manuelVo/foundryvtt-smart-doors/blob/master/CHANGELOG.md", "changelog": "https://github.com/manuelVo/foundryvtt-smart-doors/blob/master/CHANGELOG.md",
"bugs": "https://github.com/manuelVo/foundryvtt-smart-doors/issues", "bugs": "https://github.com/manuelVo/foundryvtt-smart-doors/issues",

View File

@@ -0,0 +1,34 @@
import {settingsKey} from "../settings.js"
const SECRET_DOOR_TINT = 0x888888
// Tint all secret doors dark grey
export function onCanvasReady(currentCanvas) {
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
export function onUpdateWall(scene, wall, update) {
if (!game.settings.get(settingsKey, "highlightSecretDoors"))
return
const types = CONST.WALL_DOOR_TYPES
if (wall.door === types.NONE)
return
// Find the door control corresponding to the changed door
const changedDoor = canvas.controls.doors.children.find(control => control.wall.data._id === wall._id);
// If the changed door doesn't have a control it's not on this scene - ignore it
if (!changedDoor)
return
// The wall object we got passed might be from another scene so we replace it with the door from the current scene
wall = changedDoor.wall.data
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.")
}

View File

@@ -33,7 +33,7 @@ export function onRederWallConfig(wallConfig, html, data) {
export async function onWallConfigUpdate(event, formData) { export async function onWallConfigUpdate(event, formData) {
const synchronizeSecretStatus = formData.synchronizeSecretStatus; const synchronizeSecretStatus = formData.synchronizeSecretStatus;
const updateData = {flags: {smartdoors: {synchronizationGroup: formData.synchronizationGroup}}}; const updateData = {flags: {smartdoors: {synchronizationGroup: formData.synchronizationGroup}}};
let ids = this.options.editTargets; let ids = this.editTargets;
if (ids.length == 0) { if (ids.length == 0) {
ids = [this.object.id]; ids = [this.object.id];
} }

View File

@@ -1,10 +1,11 @@
import {toggleSecretDoor} from "../keybindings.js";
import {settingsKey} from "../settings.js" import {settingsKey} from "../settings.js"
import {updateSynchronizedDoors} from "./synchronized_doors.js"; import {updateSynchronizedDoors} from "./synchronized_doors.js";
// Toggles between normal and secret doors // Toggles between normal and secret doors
export function onDoorLeftClick(event) { export function onDoorLeftClick() {
// We don't trust the event to be filled with the expected data for compatibilty with arms reach (which passes a broken event) // 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) { if (toggleSecretDoor && game.user.isGM) {
const types = CONST.WALL_DOOR_TYPES const types = CONST.WALL_DOOR_TYPES
const newtype = this.wall.data.door === types.DOOR ? types.SECRET : types.DOOR const newtype = this.wall.data.door === types.DOOR ? types.SECRET : types.DOOR
const updateData = {door: newtype} const updateData = {door: newtype}

20
src/keybindings.js Normal file
View File

@@ -0,0 +1,20 @@
import {settingsKey} from "./settings.js";
export let toggleSecretDoor = false;
export function registerKeybindings() {
game.keybindings.register(settingsKey, "toggleSecretDoor", {
name: "smart-doors.keybindings.toggleSecretDoor.name",
hint: "smart-doors.keybindings.toggleSecretDoor.hint",
onDown: handleToggleSecretDoor,
onUp: handleToggleSecretDoor,
restricted: true,
editable: [{key: "AltLeft"}],
precedence: -1,
});
}
function handleToggleSecretDoor(event) {
toggleSecretDoor = !event.up;
return false;
}

View File

@@ -2,15 +2,19 @@
import {libWrapper} from "../lib/libwrapper_shim.js"; import {libWrapper} from "../lib/libwrapper_shim.js";
import * as DoorControlIconScale from "./features/door_control_icon_scale.js" import * as DoorControlIconScale from "./features/door_control_icon_scale.js"
import * as HighlightSecretDoors from "./features/highlight_secret_doors.js"
import * as LockedDoorAlert from "./features/locked_door_alert.js" import * as LockedDoorAlert from "./features/locked_door_alert.js"
import * as SynchronizedDoors from "./features/synchronized_doors.js" import * as SynchronizedDoors from "./features/synchronized_doors.js"
import * as ToggleSecretDoor from "./features/toggle_secret_door.js" import * as ToggleSecretDoor from "./features/toggle_secret_door.js"
import {performMigrations} from "./migration.js" import {performMigrations} from "./migration.js"
import {registerKeybindings} from "./keybindings.js"
import {registerSettings, settingsKey} from "./settings.js" import {registerSettings, settingsKey} from "./settings.js"
Hooks.once("init", () => { Hooks.once("init", () => {
registerSettings() registerSettings()
registerKeybindings()
hookDoorEvents() hookDoorEvents()
hookWallConfigUpdate() hookWallConfigUpdate()
hookDoorControlDraw() hookDoorControlDraw()
@@ -24,6 +28,9 @@ Hooks.once("ready", () => {
Hooks.on("renderChatMessage", LockedDoorAlert.onRenderChatMessage) Hooks.on("renderChatMessage", LockedDoorAlert.onRenderChatMessage)
Hooks.on("canvasReady", DoorControlIconScale.onCanvasReady) Hooks.on("canvasReady", DoorControlIconScale.onCanvasReady)
Hooks.on("canvasReady", HighlightSecretDoors.onCanvasReady)
Hooks.on("updateWall", HighlightSecretDoors.onUpdateWall)
// Inject our custom settings into the WallConfig dialog // Inject our custom settings into the WallConfig dialog
Hooks.on("renderWallConfig", SynchronizedDoors.onRederWallConfig) Hooks.on("renderWallConfig", SynchronizedDoors.onRederWallConfig)

View File

@@ -1,5 +1,10 @@
export const settingsKey = "smart-doors"; export const settingsKey = "smart-doors";
function reloadGM() {
if (game.user.isGM)
location.reload()
}
export function registerSettings() { export function registerSettings() {
game.settings.register(settingsKey, "dataVersion", { game.settings.register(settingsKey, "dataVersion", {
scope: "world", scope: "world",
@@ -16,13 +21,14 @@ export function registerSettings() {
default: 1.5, default: 1.5,
onChange: () => location.reload() onChange: () => location.reload()
}) })
game.settings.register(settingsKey, "toggleSecretDoors", { game.settings.register(settingsKey, "highlightSecretDoors", {
name: "smart-doors.settings.toggleSecretDoors.name", name: "smart-doors.settings.highlightSecretDoors.name",
hint: "smart-doors.settings.toggleSecretDoors.hint", hint: "smart-doors.settings.highlightSecretDoors.hint",
scope: "world", scope: "world",
config: true, config: true,
type: Boolean, type: Boolean,
default: true, default: false,
onChange: reloadGM,
}) })
game.settings.register(settingsKey, "lockedDoorAlert", { game.settings.register(settingsKey, "lockedDoorAlert", {
name: "smart-doors.settings.lockedDoorAlert.name", name: "smart-doors.settings.lockedDoorAlert.name",