17 Commits

Author SHA1 Message Date
a0cdaff5db Release v1.3.3 2022-02-14 15:35:29 +01:00
30272cfbf4 Remove extra curly brace in french translation (fixes #21) 2022-02-14 15:08:18 +01:00
46581362fb Implement delayed reload to esnure all settings are applied 2022-02-12 18:35:23 +01:00
993cc2b658 Fix typo in readme 2022-02-12 18:34:55 +01:00
644f6795a6 Release v1.3.2 2022-01-17 11:41:12 +01:00
31bc7c82e5 Add german translation 2022-01-17 11:38:56 +01:00
7fd6f1f9a9 Make locked door alert messages localizable (fixes #15) 2022-01-17 11:29:52 +01:00
Brother Sharp
d51c416ac2 add japanese localization 2022-01-17 11:16:11 +01:00
697950e22a Release v1.3.1 2022-01-05 21:15:12 +01:00
78d41d2a40 Don't suppress other key events in the toggleSecretDoors keybinding (fixes #12) 2022-01-05 21:12:52 +01:00
c222d3019c Release v1.3.0 2022-01-05 12:02:14 +01:00
a2541bf934 Add french translation (thanks Elfenduli) (provided by & closes #11) 2022-01-05 12:00:37 +01:00
3dbaf84db3 Update code for Foundry 9 2022-01-05 11:49:14 +01:00
cf3cbb892c Release v1.2.9 2021-07-20 11:21:15 +02:00
2ce7e57f43 Bring back the "tint secret doors" feature (resolves #7)
This partially reverts commit 42529d3df6.
2021-07-20 11:18:41 +02:00
e20b259d99 Release v1.2.8 2021-06-27 22:10:25 +02:00
13df0ccecd Update Smart Doors to work with the changed API (between Version 0.8.5 and 0.8.7). Update Smart Doors to work again (fixes #8) 2021-06-27 22:07:56 +02:00
14 changed files with 274 additions and 24 deletions

View File

@@ -1,3 +1,43 @@
## 1.3.3
### Bugfixes
- Fixed a bug that could cause some settings to not apply if multiple settings were changed at once
- Fixed a bug that caused the french translation to not work
## 1.3.2
### Bugfixes
- The message sent to chat when triggering a locke door alert can now be translated
### Translation
- Added japanese translation (thanks to touge)
- Added german translation
## 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 gray 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)

41
lang/de.json Normal file
View File

@@ -0,0 +1,41 @@
{
"smart-doors": {
"keybindings": {
"toggleSecretDoor": {
"name": "Geheimtüren umschalten",
"hint": "Solange diese Taste gedrückt ist, werden Türen beim Klicken zwischen normaler Tür und Geheimtür umgeschalten."
}
},
"settings": {
"doorControlSizeFactor": {
"name": "Sklaierungsfaktor des Türsymbols",
"hint": "Legt fest um welchen faktor die Größe der Türsymbole hochskaliert werden sollen"
},
"highlightSecretDoors": {
"name": "Geheimtüren einfärben",
"hint": "Geheimtüren werden beim Spielleiter in einer anderen Farbe dargestellt, um sie einfacher von anderen Türen unterscheiden zu können."
},
"lockedDoorAlert": {
"name": "Alarm bei verschlossenen Türen",
"hint": "Wenn ein Spieler versucht eine verschlossene Tür zu öffnen wird eine Nachricht im Chat angezeigt"
},
"synchronizedDoors": {
"name": "Synchronisierte Türen",
"hint": "Erlaubt es den Zustand mehrerer Türen zu synchronisieren"
}
},
"ui": {
"lockedDoorAlert": "Hat versucht eine verschlossene Tür zu öffnen",
"messages": {
"migrating": "Update Smart Doors zur Version {version}. Bitte schließe die Anwendung nicht.",
"migrationDone": "Smart Doors wurde erfolgreich auf die Version {version} geupdated.",
"unknownVersion": "Das Update von Smart doors ist mit folgendem Fehler fehlgeschlagen: Unbekannte Version {version}. Bite melde diesen Fehler im Bugtracker von Smart Doors. Um Datenverlust zu vermeiden, dekativiere dieses Modul bis dieser Fehler behoben ist."
},
"synchronizedDoors": {
"description": "Zustandsänderungen von Türen in der gleichen Synchronisationsgruppe werden Szenenübergreifend synchronisiert. Lasse dieses Feld leer, wenn du diese Tür nicht Synchornisieren möchtest.",
"groupName": "Synchronisationsgruppe",
"synchronizeSecretStatus": "Geheimtürstatus synchronisieren"
}
}
}
}

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,13 +22,10 @@
"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": {
"lockedDoorAlert": "Just tried to open a locked door",
"messages": { "messages": {
"migrating": "Migrating Smart Doors to version {version}. Please don't close the application.", "migrating": "Migrating Smart Doors to version {version}. Please don't close the application.",
"migrationDone": "Smart Doors successfully migrated to version {version}.", "migrationDone": "Smart Doors successfully migrated to version {version}.",

34
lang/fr.json Normal file
View File

@@ -0,0 +1,34 @@
{
"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"
}
}
}

40
lang/ja.json Normal file
View File

@@ -0,0 +1,40 @@
{
"smart-doors": {
"keybindings": {
"toggleSecretDoor": {
"name": "シークレット・ドア切替",
"hint": "このキーを押しながらドアをクリックすると、シークレット・ドアと通常のドアを切り替えます。"
}
},
"settings": {
"doorControlSizeFactor": {
"name": "扉アイコンの大きさ",
"hint": "扉アイコンをどの程度大きくスケールアップするか設定します。"
},
"highlightSecretDoors": {
"name": "シークレット・ドア色",
"hint": "シークレット・ドアに異なる色を重ねることで、GM側から視認しやすくなります。"
},
"lockedDoorAlert": {
"name": "ロック中通知",
"hint": "ロックされた扉を誰かが開けようとした時チャットに通知を表示します。"
},
"synchronizedDoors": {
"name": "扉の同期",
"hint": "設定した扉の状態を同期させます。"
}
},
"ui": {
"messages": {
"migrating": "Smart Doorsをバージョン{version}。にマイグレーションしています。FVTTを終了しないでください。",
"migrationDone": "Smart Doorsバージョン{version}のマイグレーションに成功しました。",
"unknownVersion": "Smart Doorsのマイグレーションに失敗しました。エラー不明なバージョン{version}。Smart Doorsのissue trackerに報告していただくか、オンセ工房のDiscordサーバまでご報告ください。データの損失が起こりうる可能性がありますので、このエラーが解消されるまで使用しないでください。"
},
"synchronizedDoors": {
"description": "同じ同期グループにいる扉はシーンをまたいで状態が同期されます。空の場合はこの扉の同期を無効化します。",
"groupName": "同期グループ名",
"synchronizeSecretStatus": "シークレット状態同期"
}
}
}
}

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.3",
"minimumCoreVersion" : "0.8.5", "minimumCoreVersion" : "9.238",
"compatibleCoreVersion" : "0.8.5", "compatibleCoreVersion" : "9",
"authors": [ "authors": [
{ {
"name": "Manuel Vögele", "name": "Manuel Vögele",
@@ -17,15 +17,30 @@
"src/main.js" "src/main.js"
], ],
"languages": [ "languages": [
{
"lang": "de",
"name": "Deutsch",
"path": "lang/de.json"
},
{ {
"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"
},
{
"lang": "ja",
"name": "日本語",
"path": "lang/ja.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.3.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

@@ -22,6 +22,9 @@ export function onRenderChatMessage(message, html, data) {
sourceDoor.icon.tint = 0xffffff; sourceDoor.icon.tint = 0xffffff;
} }
html.on("mouseleave", mouseLeave); html.on("mouseleave", mouseLeave);
// Localize the message
html.find(".message-content")[0].innerText = game.i18n.localize("smart-doors.ui.lockedDoorAlert");
} }
// Creates a chat message stating that a player tried to open a locked door // Creates a chat message stating that a player tried to open a locked door
@@ -46,7 +49,7 @@ export function onDoorLeftClick() {
message.user = game.user.id; message.user = game.user.id;
if (game.user.character) if (game.user.character)
message.speaker = {actor: game.user.character} message.speaker = {actor: game.user.character}
message.content = "Just tried to open a locked door" message.content = game.i18n.localize("smart-doors.ui.lockedDoorAlert");
message.sound = CONFIG.sounds.lock message.sound = CONFIG.sounds.lock
message.flags = {smartdoors: {source: {wall: this.wall.data._id, scene: this.wall.scene.id}}} message.flags = {smartdoors: {source: {wall: this.wall.data._id, scene: this.wall.scene.id}}}
ChatMessage.create(message) ChatMessage.create(message)

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,14 @@
export const settingsKey = "smart-doors"; export const settingsKey = "smart-doors";
function reloadGM() {
if (game.user.isGM)
delayedReload()
}
function delayedReload() {
window.setTimeout(() => location.reload(), 500);
}
export function registerSettings() { export function registerSettings() {
game.settings.register(settingsKey, "dataVersion", { game.settings.register(settingsKey, "dataVersion", {
scope: "world", scope: "world",
@@ -14,15 +23,16 @@ export function registerSettings() {
config: true, config: true,
type: Number, type: Number,
default: 1.5, default: 1.5,
onChange: () => location.reload() onChange: delayedReload,
}) })
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",