Update code for Foundry 9
This commit is contained in:
@@ -13,7 +13,7 @@ Door Control icons will be rendered the same size in every scene, regardless of
|
||||
### Toggle Secret Doors
|
||||

|
||||
|
||||
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
|
||||
|
||||
10
lang/en.json
10
lang/en.json
@@ -1,5 +1,11 @@
|
||||
{
|
||||
"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": {
|
||||
"doorControlSizeFactor": {
|
||||
"name": "Door Control Size Factor",
|
||||
@@ -16,10 +22,6 @@
|
||||
"synchronizedDoors": {
|
||||
"name": "Synchronized 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": {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"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.",
|
||||
"version": "1.2.9",
|
||||
"minimumCoreVersion" : "0.8.7",
|
||||
"compatibleCoreVersion" : "0.8.8",
|
||||
"minimumCoreVersion" : "9.238",
|
||||
"compatibleCoreVersion" : "9",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Manuel Vögele",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import {toggleSecretDoor} from "../keybindings.js";
|
||||
import {settingsKey} from "../settings.js"
|
||||
import {updateSynchronizedDoors} from "./synchronized_doors.js";
|
||||
|
||||
// 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)
|
||||
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 newtype = this.wall.data.door === types.DOOR ? types.SECRET : types.DOOR
|
||||
const updateData = {door: newtype}
|
||||
|
||||
15
src/keybindings.js
Normal file
15
src/keybindings.js
Normal file
@@ -0,0 +1,15 @@
|
||||
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: () => toggleSecretDoor = true,
|
||||
onUp: () => toggleSecretDoor = false,
|
||||
restricted: true,
|
||||
editable: [{key: "AltLeft"}],
|
||||
precedence: -1,
|
||||
});
|
||||
}
|
||||
@@ -8,10 +8,13 @@ import * as SynchronizedDoors from "./features/synchronized_doors.js"
|
||||
import * as ToggleSecretDoor from "./features/toggle_secret_door.js"
|
||||
|
||||
import {performMigrations} from "./migration.js"
|
||||
import {registerKeybindings} from "./keybindings.js"
|
||||
import {registerSettings, settingsKey} from "./settings.js"
|
||||
|
||||
Hooks.once("init", () => {
|
||||
registerSettings()
|
||||
registerKeybindings()
|
||||
|
||||
hookDoorEvents()
|
||||
hookWallConfigUpdate()
|
||||
hookDoorControlDraw()
|
||||
|
||||
@@ -30,14 +30,6 @@ export function registerSettings() {
|
||||
default: false,
|
||||
onChange: reloadGM,
|
||||
})
|
||||
game.settings.register(settingsKey, "toggleSecretDoors", {
|
||||
name: "smart-doors.settings.toggleSecretDoors.name",
|
||||
hint: "smart-doors.settings.toggleSecretDoors.hint",
|
||||
scope: "world",
|
||||
config: true,
|
||||
type: Boolean,
|
||||
default: true,
|
||||
})
|
||||
game.settings.register(settingsKey, "lockedDoorAlert", {
|
||||
name: "smart-doors.settings.lockedDoorAlert.name",
|
||||
hint: "smart-doors.settings.lockedDoorAlert.hint",
|
||||
|
||||
Reference in New Issue
Block a user