Browse Source

Add configuration options

tags/0.0.3
bertieb 3 years ago
parent
commit
580d20f8f3
2 changed files with 32 additions and 4 deletions
  1. +2
    -2
      module.json
  2. +30
    -2
      scripts/wallconvert.js

+ 2
- 2
module.json View File

@@ -3,10 +3,10 @@
"title": "Walls-to-Drawing",
"description": "Convert selected walls to a Drawing to make walls visible to players",
"authors": [{ "name": "BertieB", "email": "foundry@bertieb.org", "url": "https://bertieb.org" }],
"version": "0.0.2",
"version": "0.0.3",
"minimumCoreVersion": "0.6.5",
"scripts": [ "scripts/wallconvert.js" ],
"url": "https://git.bertieb.org/bertieb/foundry-walls-to-drawing",
"manifest": "https://git.bertieb.org/bertieb/foundry-walls-to-drawing/raw/branch/master/module.json",
"download": "https://git.bertieb.org/bertieb/foundry-walls-to-drawing/archive/0.0.2.zip"
"download": "https://git.bertieb.org/bertieb/foundry-walls-to-drawing/archive/0.0.3.zip"
}

+ 30
- 2
scripts/wallconvert.js View File

@@ -4,11 +4,39 @@ WALLCOLOUR = "#111111";
/** @constant {number} */
WALLWIDTH = "4";

/** @constant {string} */
MODULENAME = "foundry-walls-to-drawing";

/**
* Set up configuration options
* */
Hooks.on("init" () => {
game.settings.register(MODULENAME, "cvWallColour", {
name: "Converted Wall Colour",
default: WALLCOLOUR,
type: String,
scope: "client",
config: true,
hint: "Enter a hexadecimal colour, eg #FF0000 for red"
});

game.settings.register(MODULENAME, "cvWallWidth", {
name: "Converted Wall Width",
default: WALLWIDTH,
type: Number,
scope: "client",
config: true,
hint: "Enter a decimal width"
});

/**
* Add 'Convert to walls' button in Walls Layer Tools
* */

Hooks.on('getSceneControlButtons', controls => {
cvWallColour = game.settings.get(MODULENAME, "cvWallColour");
cvWallWidth = game.settings.get(MODULENAME, "cvWallWidth");

let walls = controls.find(e => e.name === "walls");
walls.tools.push( {
"name": "convert-to-draw",
@@ -22,8 +50,8 @@ Hooks.on('getSceneControlButtons', controls => {
x: 0,
y: 0,
height: 100,
strokeWidth: WALLWIDTH,
strokeColor: WALLCOLOUR,
strokeWidth: cvWallWidth,
strokeColor: cvWallColour,
points: [
[wall.coords[0], wall.coords[1]],
[wall.coords[2], wall.coords[3]]


Loading…
Cancel
Save