From 83d9d8f55d121e3fd07d15189ee65657e6abd8ec Mon Sep 17 00:00:00 2001 From: coffiarts Date: Sat, 16 Dec 2023 17:41:03 +0100 Subject: [PATCH] Make allowed action (equipping/unquipping) an option in module settings --- README.md | 2 -- src/sheet-locker/lang/de.json | 4 ++++ src/sheet-locker/lang/en.json | 4 ++++ src/sheet-locker/scripts/config.js | 3 +++ src/sheet-locker/scripts/main.js | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 17280c8..565c058 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ # TODO -- identify and add support for more allowed actions -- make allowed actions configurable in settings (i.e. equip/unequip) - test with actor prototypes => overlay in actors list? - dnd5e test - video (dnd5) diff --git a/src/sheet-locker/lang/de.json b/src/sheet-locker/lang/de.json index 2957f8d..3129936 100644 --- a/src/sheet-locker/lang/de.json +++ b/src/sheet-locker/lang/de.json @@ -13,6 +13,10 @@ "name": "Aktiviert", "hint": "Modul aktivieren (d.h. Charakterbögen sperren)." }, + "allowEquip": { + "name": "Aktion zulassen: Ausrüsten", + "hint": "Soll das An- und Ablegen (\"Ausrüsten\") von Gegenständen im Inventory auch bei aktiviertem Lock erlaubt sein?" + }, "showUIButton": { "name": "UI Button anzeigen", "hint": "Button in der linken Menüleiste anzeigen, um Actor Sheet Lock an- und auszuschalten." diff --git a/src/sheet-locker/lang/en.json b/src/sheet-locker/lang/en.json index 5399a27..90daf25 100644 --- a/src/sheet-locker/lang/en.json +++ b/src/sheet-locker/lang/en.json @@ -13,6 +13,10 @@ "name": "Active", "hint": "Activate this module (i.e.: LOCK all character sheets)." }, + "allowEquip": { + "name": "Allow: Equipping", + "hint": "Should equipping/unequipping items from the inventory be allowed while sheet lock is active?" + }, "showUIButton": { "name": "Show UI Button", "hint": "Display a button in the scene controls menu on the left hand for toggling Actor Sheet Lock on and off." diff --git a/src/sheet-locker/scripts/config.js b/src/sheet-locker/scripts/config.js index e4d21ec..aa70cbf 100644 --- a/src/sheet-locker/scripts/config.js +++ b/src/sheet-locker/scripts/config.js @@ -50,6 +50,9 @@ export class Config { }, overlayIconOpen: { scope: 'world', config: true, type: String, filePicker: "image", default: `${Config.data.modPath}/artwork/lock-green-open.png` + }, + allowEquip: { + scope: 'world', config: true, type: Boolean, default: true } }; Config.registerSettings(data); diff --git a/src/sheet-locker/scripts/main.js b/src/sheet-locker/scripts/main.js index 1f0d479..5cb9cb1 100644 --- a/src/sheet-locker/scripts/main.js +++ b/src/sheet-locker/scripts/main.js @@ -165,7 +165,7 @@ function onItemChangedInSheet(item, data, options, userid) { // check if event is allowed if ( - data?.system?.worn != null + data?.system?.worn != null && Config.setting('allowEquip') ) return true; if (!SheetLocker.isSilentMode) {