Skip to content

Commit

Permalink
11.0.3 - Add keybinding support
Browse files Browse the repository at this point in the history
  • Loading branch information
coffiarts committed Apr 2, 2024
1 parent 3f8ad64 commit f9fbed8
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
The **major** version number in my modules (like "11") always reflects the
The **major** version number in my modules (like "11") always reflects the
Foundry VTT **core** version it is compatible with (and recommended for).

## 11.0.3
### 2024-04-02 - Keybinding support
- Adds an optional keybinding for toggling sheet lock on/off (gamemasters only).
- "Optional" means: There's no preassigned key combination. Assign it to your liking in the game settings (or ignore it if you don't want to use it). My personal preference is **SHIFT + L**.

## 11.0.2
### 2023-12-21 - Add missing changelog & readme to release package
That's why Module Management+ wasn't providing links to them in game (in case anyone should have noticed that groundbreaking detail).
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![](https://img.shields.io/badge/Foundry-v11-informational)
![](https://img.shields.io/badge/Foundry-v11-informational)
![GitHub All Releases](https://img.shields.io/github/downloads/coffiarts/FoundryVTT-lock-the-sheets/latest/total?label=Downloads+latest+release)
![GitHub All Releases](https://img.shields.io/github/downloads/coffiarts/FoundryVTT-lock-the-sheets/11.0.1/total?label=previous+release+[11.0.1])
![GitHub All Releases](https://img.shields.io/github/downloads/coffiarts/FoundryVTT-lock-the-sheets/11.0.2/total?label=previous+release+[11.0.2])

# Lock The Sheets! for Foundry VTT
<table style="border:0;width:840px">
Expand Down Expand Up @@ -33,6 +33,7 @@ This is absolutely optional! Don't feel obliged in any way to do so. My mod is a
- [Why I created this ...](#why-i-created-this-)
- [Changelog](#changelog)
- [Adjustable module settings](#adjustable-module-settings)
- [Toggle by hotkey](#toggle-by-hotkey)
- [Control it by macro](#control-it-by-macro)
- [Compatibility and Dependencies](#compatibility-and-dependencies)
- [Copyrights and Credits for used assets](#copyrights-and-credits-for-used-assets)
Expand Down Expand Up @@ -104,6 +105,15 @@ This screenshot shows the default values.

<img src="src/lock-the-sheets/artwork/lock-the-sheets-settings.png" alt="Lock The Sheets! Settings"/>

## Toggle by hotkey
You (gamemasters only) can assign a custom hotkey in the game settings (by default it is empty to prevent unwanted key collisions). My personal preference is **SHIFT + L**:

<img src="src/lock-the-sheets/artwork/lock-the-sheets-keybinding-step1.png" alt="Lock the Sheets! assign keybinding - step 1"/>

<img src="src/lock-the-sheets/artwork/lock-the-sheets-keybinding-step2.png" alt="Lock the Sheets! assign keybinding - step 2"/>

<img src="src/lock-the-sheets/artwork/lock-the-sheets-keybinding-step3.png" alt="Lock the Sheets! assign keybinding - step 3"/>

## Control it by macro
A ready-to-use macro button for doing the toggle is already included as a compendium pack:

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/lock-the-sheets/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
},
"controlButton": {
"label": "Lock The Sheets! EIN/AUS"
}
},
"keybindingMenuLabel": "Lock The Sheets! ein-/ausschalten"
}
}
3 changes: 2 additions & 1 deletion src/lock-the-sheets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
},
"controlButton": {
"label": "Lock The Sheets! ON/OFF"
}
},
"keybindingMenuLabel": "Toggle Lock The Sheets!"
}
}
2 changes: 1 addition & 1 deletion src/lock-the-sheets/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "lock-the-sheets",
"title": "Lock The Sheets!",
"description": "Oh Game Master, thou shalt be the gatekeeper! Lock and unlock all your players' character sheets at once with just one click. May you never ever again watch them accidentally delete that beloved item from their inventory (\"Uuuugh... NOOOOO!\")... or let those nasty cheaters among them mess around secretly with their hitpoints (\"AAAAArrrrgh!\").",
"version": "11.0.2",
"version": "11.0.3",
"url": "https://github.com/coffiarts/FoundryVTT-lock-the-sheets",
"manifest": "https://github.com/coffiarts/FoundryVTT-lock-the-sheets/releases/download/latest/module.json",
"download": "https://github.com/coffiarts/FoundryVTT-lock-the-sheets/releases/download/latest/module.zip",
Expand Down
19 changes: 18 additions & 1 deletion src/lock-the-sheets/scripts/config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {Logger} from './logger.js';
import {LockTheSheets} from "./main.js";

// keep values in sync with module.json!
const MOD_ID = "lock-the-sheets";
const MOD_PATH = `/modules/${MOD_ID}`;
const MOD_TITLE = "Lock The Sheets!";
const MOD_DESCRIPTION = "[TODO]";
const MOD_DESCRIPTION = "Oh Game Master, thou shalt be the gatekeeper! Lock and unlock all your players' character sheets at once with just one click. May you never ever again watch them accidentally delete that beloved item from their inventory (\"Uuuugh... NOOOOO!\")... or let those nasty cheaters among them mess around secretly with their hitpoints (\"AAAAArrrrgh!\").";
const MOD_LINK = `https://github.com/coffiarts/FoundryVTT-${MOD_ID}`;

export class Config {
Expand Down Expand Up @@ -57,6 +58,22 @@ export class Config {
};
Config.registerSettings(data);

// Add the keybinding
game.keybindings.register("lock-the-sheets", "active", {
name: Config.localize('keybindingMenuLabel'),
editable: [
//{ key: "KeyL", modifiers: [KeyboardManager.MODIFIER_KEYS.SHIFT] }
],
restricted: true,
onDown: () => {
if (!game.user.isGM) {
return;
}
LockTheSheets.toggle();
}
});
Logger.info("Empty keybinding registered. Assign it to your liking in the game settings.");

// Whenever loading up, we need to adjust the "pseudo-setting" modVersion once to the current value from
// the manifest. Otherwise, module updates won't be reflected in its value (users would always see their first
// installed version ever in the settings menu).
Expand Down
2 changes: 1 addition & 1 deletion src/lock-the-sheets/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let socket;
Hooks.once("ready", () => {
ready2play = true;
Logger.infoGreen(`Ready to play! Version: ${game.modules.get(Config.data.modID).version}`);
Logger.info(Config.data.modDescription);
Logger.infoGreen(Config.data.modDescription);
LockTheSheets.isActive = Config.setting('isActive');

Hooks.on("preCreateItem", function (item, data, options, userid) {
Expand Down

0 comments on commit f9fbed8

Please sign in to comment.