浏览代码

Add configuration options

tags/0.0.3
bertieb 4 年前
父节点
当前提交
580d20f8f3
共有 2 个文件被更改,包括 32 次插入4 次删除
  1. +2
    -2
      module.json
  2. +30
    -2
      scripts/wallconvert.js

+ 2
- 2
module.json 查看文件

@@ -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 查看文件

@@ -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]]


正在加载...
取消
保存