Skip to content

Commit

Permalink
1.0.36 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ironmonk88 committed Dec 22, 2021
1 parent 398cfb7 commit 0cc2c46
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 1.0.36

Well... this is embarassing. I guess in the effort to get modules up to date, I forgot to include a template. Should be fixed now.

# Version 1.0.35

Adding v9 support
Expand Down
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "enhanced-terrain-layer",
"title": "Enhanced Terrain Layer",
"description": "A base module that adds a Terrain Layer to Foundry. Used as a library for Rulers and other modules",
"version": "1.0.35",
"version": "1.0.36",
"minimumCoreVersion": "9",
"compatibleCoreVersion": "9.236",
"compatibleCoreVersion": "9",
"author": "IronMonk",
"authors": [{
"name": "IronMonk",
Expand Down Expand Up @@ -47,7 +47,7 @@
"styles": [ "css/terrainlayer.css" ],
"packs": [],
"url" : "https://github.com/ironmonk88/enhanced-terrain-layer",
"download" : "https://github.com/ironmonk88/enhanced-terrain-layer/archive/1.0.35.zip",
"download" : "https://github.com/ironmonk88/enhanced-terrain-layer/archive/1.0.36.zip",
"manifest" : "https://github.com/ironmonk88/enhanced-terrain-layer/releases/latest/download/module.json",
"bugs": "https://github.com/ironmonk88/enhanced-terrain-layer/issues",
"allowBugReporter": true
Expand Down
55 changes: 55 additions & 0 deletions templates/terrain-form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<div class="form-group">
<label for="multiple">{{localize "EnhancedTerrainLayer.TerrainCost"}}</label>
<div class="form-fields">
<input type="range" name="flags.enhanced-terrain-layer.multiple" data-dtype="Number" value="{{data.multiple}}" min="0" max="4" step="1">
<span class="range-value" style="flex: 0 1 48px; line-height: 17px; ">{{data.multiple}}</span>
</div>
</div>
<div class="form-group">
<label for="terrainheight">{{localize "EnhancedTerrainLayer.TerrainHeight"}}</label>
<div class="form-fields" style="position:relative;">
<label class="terrainheight-label">{{localize "EnhancedTerrainLayer.Min"}}</label>
<input type="number" style="text-align:right;" name="flags.enhanced-terrain-layer.min" data-dtype="Number" value="{{data.min}}">
<label class="terrainheight-label">{{localize "EnhancedTerrainLayer.Max"}}</label>
<input type="number" style="text-align:right;" name="flags.enhanced-terrain-layer.max" data-dtype="Number" value="{{data.max}}">
</div>
</div>
<div class="form-group">
<label for="environment">{{localize "EnhancedTerrainLayer.Environment"}}</label>
<div class="form-fields">
<select name="flags.enhanced-terrain-layer.environment" data-dtype="String">
<option value=""></option>
<optgroup label="{{localize "EnhancedTerrainLayer.Environment"}}" data-type="environment">
{{ selectOptions environments selected=data.environment }}
</optgroup>
<optgroup label="{{localize "EnhancedTerrainLayer.Obstacle"}}" data-type="obstacle">
{{ selectOptions obstacles selected=data.environment }}
</optgroup>
</select>
</div>
</div>
{{#if useObstacles}}
<div class="form-group">
<label for="obstacle">{{localize "EnhancedTerrainLayer.Obstacle"}}</label>
<div class="form-fields">
<select name="flags.enhanced-terrain-layer.obstacle" data-dtype="String">
{{ selectOptions obstacles selected=data.obstacle blank=' ' nameValue="name" nameValue="name" }}
</select>
</div>
</div>
{{/if}}
{{#if full}}
<div class="form-group">
<label for="flags.enhanced-terrain-layer.drawcolor">{{localize "EnhancedTerrainLayer.TerrainColor"}}</label>
<div class="form-fields">
{{ colorPicker name="drawcolor" value=data.drawcolor}}
</div>
</div>
<div class="form-group">
<label>{{localize "EnhancedTerrainLayer.opacity.name"}}</label>
<div class="form-fields">
<input type="range" dtype="Number" min="0" max="1.0" step="0.1" name="flags.enhanced-terrain-layer.opacity" value="{{data.opacity}}">
<span class="range-value" style="flex: 0 1 48px;">{{data.opacity}}</span>
</div>
</div>
{{/if}}
32 changes: 9 additions & 23 deletions terrain-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,6 @@ function addControls(app, html, addheader) {
.append($('<label>').addClass('terrainheight-label').html(i18n("EnhancedTerrainLayer.Max")))
.append($('<input>').attr({ type: 'number', name: 'flags.enhanced-terrain-layer.max', 'data-type': 'Number' }).val(app.object.getFlag('enhanced-terrain-layer', 'max') || 0))
);
/*
.append($('<select>')
.attr('name', 'flags.enhanced-terrain-layer.terraintype')
.attr('data-type', 'String')
.append(function () { return canvas.terrain.getTerrainTypes().map(v => { return $('<option>').attr('value', v.id).html(i18n(v.text)); }) })
.val(app.object.getFlag('enhanced-terrain-layer', 'terraintype') || 'ground')));*/

//add the environment
var obs = [];
Expand Down Expand Up @@ -255,12 +249,11 @@ function addControls(app, html, addheader) {

async function addControlsv9(app, dest, full) {
//add the environment
var obs = [];
var obs = {};
var env = canvas.terrain.getEnvironments().reduce(function (map, obj) {
let opt = { name: i18n(obj.text), value: obj.id };
(obj.obstacle === true ? obs : map).push(opt);
(obj.obstacle === true ? obs : map)[obj.id] = i18n(obj.text);
return map;
}, []);
}, {});

let template = "modules/enhanced-terrain-layer/templates/terrain-form.html";
let data = {
Expand All @@ -269,33 +262,25 @@ async function addControlsv9(app, dest, full) {
obstacles: obs,
full: full
};
data.data.multiple = data.data.multiple || 1
data.data.multiple = data.data.multiple || 1;

let html = await renderTemplate(template, data);
//if (full)
dest.append(html);
/*else {
let ctrl = $('[name="flags.mess.templateTexture"], [name="texture"],[name="data.target.units"],[name="data.range.value"],[name="backgroundColor"]', dest);
if (ctrl.length > 0) {
let group = ctrl.get(0).closest(".form-group");
if (group)
$(html).insertAfter(group);
}
}*/
dest.append(html);
}

Hooks.on('canvasInit', () => {
canvas.hud.terrain = new TerrainHUD();
//Scene.constructor.config.embeddedEntities.Terrain = "terrain";
});

Hooks.on('ready', () => {
//Hooks.on('ready', () => {
/*
if (game.user.isGM && !setting('conversion')) {
checkUpgrade();
game.settings.set('enhanced-terrain-layer', 'conversion', true);
}*/

/*
window.setTimeout(function () {
if (canvas.terrain.getObstacles != undefined && !canvas.terrain.updateObstacles) {
warn('getObstacles is deprecated, please use getEnvironment and set the obstacle property to true');
Expand All @@ -313,7 +298,8 @@ Hooks.on('ready', () => {
canvas.terrain.updateObstacles = true;
}
}, 100);
})
*/
//})

Hooks.on('init', async () => {
game.socket.on('module.enhanced-terrain-layer', async (data) => {
Expand Down

0 comments on commit 0cc2c46

Please sign in to comment.