Add support for difficult terrain via Terrain Ruler module (resolves #1)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import {getPixelsFromGridPosition} from "./foundry_fixes.js"
|
||||
import {getColorForDistance} from "./main.js"
|
||||
|
||||
export function getHexSizeSupportTokenGridCenter(token) {
|
||||
const tokenCenterOffset = CONFIG.hexSizeSupport.getCenterOffset(token)
|
||||
const tokenCenter = {x: token.x + tokenCenterOffset.x, y: token.y + tokenCenterOffset.y}
|
||||
@@ -17,3 +20,11 @@ export function getHexSizeSupportTokenGridCenter(token) {
|
||||
}
|
||||
return tokenCenter
|
||||
}
|
||||
|
||||
export function highlightMeasurementTerrainRuler(ray, startDistance) {
|
||||
for (const space of ray.terrainRulerVisitedSpaces) {
|
||||
const [x, y] = getPixelsFromGridPosition(space.x, space.y);
|
||||
const color = getColorForDistance.call(this, startDistance, space.distance)
|
||||
canvas.grid.highlightPosition(this.name, {x, y, color: color})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user