mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
* Look for rangeMeasurementSettingsOverride on the scene to switch off DH global range measurement settings. * Part progress on adding config tab to scene config * Hard coded template; no value applied/saved * Flag fix * Use the flags setting * Clean up * Remove import * Better initialisation of PARTS and TABS * Fix localisation --------- Co-authored-by: Chris Ryan <chrisr@blackhole> Co-authored-by: WBHarry <williambjrklund@gmail.com>
18 lines
758 B
JavaScript
18 lines
758 B
JavaScript
import DhMeasuredTemplate from '../placeables/measuredTemplate.mjs';
|
|
|
|
export default class DhpRuler extends foundry.canvas.interaction.Ruler {
|
|
_getWaypointLabelContext(waypoint, state) {
|
|
const context = super._getWaypointLabelContext(waypoint, state);
|
|
if (!context) return;
|
|
|
|
const range = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).rangeMeasurement;
|
|
|
|
if (range.enabled) {
|
|
const result = DhMeasuredTemplate.getRangeLabels(waypoint.measurement.distance.toNearest(0.01), range);
|
|
context.cost = { total: result.distance, units: result.units };
|
|
context.distance = { total: result.distance, units: result.units };
|
|
}
|
|
|
|
return context;
|
|
}
|
|
}
|