Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb9a2ee60c | |||
| 57ed545e30 | |||
| 94fe223529 | |||
| 942bfa04e8 | |||
| b4ac65e478 | |||
| 0de01379e9 | |||
| f6eb5eff9c | |||
| fee0983841 | |||
| 3de044ea45 | |||
| e473fea121 |
+22
-1
@@ -1,3 +1,24 @@
|
||||
## 1.4.5
|
||||
### Bugfixes
|
||||
- Tiny tokens (0.5x0.5 or smaller) now snap to the coners of a square like they do in vanilla foundry ([#49](https://github.com/manuelVo/foundryvtt-drag-ruler/issues/49))
|
||||
- Fixed a bug that could cause a meausred distance to be wrong when disabling token snapping using the shift key
|
||||
- Fixed a bug where the highlighted path could have gaps when disabbling token snapping using the shift key
|
||||
|
||||
|
||||
## 1.4.4
|
||||
### Bugfixes
|
||||
- Fix snapping for tokens that are smaller than 1x1
|
||||
|
||||
|
||||
## 1.4.3
|
||||
### System compatibility
|
||||
- Drag Ruler's Generic SpeedProvider is now aware of good default values for the Savage Worlds Adventure Edition game system
|
||||
|
||||
### Translation
|
||||
- Added german translation
|
||||
- Updated japanese translation (thanks to touge)
|
||||
|
||||
|
||||
## 1.4.2
|
||||
### Bugfixes
|
||||
- Drag Ruler now works again on gridless maps
|
||||
@@ -38,7 +59,7 @@
|
||||
|
||||
## 1.3.2
|
||||
### Translation
|
||||
- Updated japanese translation (thanks to togue)
|
||||
- Updated japanese translation (thanks to touge)
|
||||
|
||||
|
||||
## 1.3.1
|
||||
|
||||
@@ -43,6 +43,7 @@ The game systems that offer Drag Ruler integration are:
|
||||
Drag Ruler is available in the follwing languages:
|
||||
- Chinese (thanks to zeteticl)
|
||||
- English
|
||||
- German
|
||||
- Japanese (thanks to touge)
|
||||
|
||||
## API
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"drag-ruler": {
|
||||
"genericSpeedProvider": {
|
||||
"settings": {
|
||||
"dashMultiplier": {
|
||||
"name": "Sprint Multiplikator",
|
||||
"hint": "Diese Einstellung kann genutzt werden, um eine zweite Geschwindigkeitsfarbe im gemessenen Pfad zu erhalten. Die zweite Farbe wird deaktiviert, wenn diese Einstellung auf 0 gesetzt ist."
|
||||
},
|
||||
"speedAttribute": {
|
||||
"name": "Geschwindigkeitsattribut",
|
||||
"hint": "Das Attribut, das die Gehgeschwindigkeit einer Spielfigur definiert. Diese Attribut wird während der Färbung des hervorgehobenen Pfads verwendet."
|
||||
}
|
||||
},
|
||||
"speeds": {
|
||||
"walk": "gehen",
|
||||
"dash": "sprinten"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"alwaysShowSpeedForPCs": {
|
||||
"name": "Geschwindigkeit von Spielercharakteren für jeden anzeigen",
|
||||
"hint": "Wenn diese Einstellung aktiviert ist wird die Färbung der hervorgehobenen Felder bei Spielercharakteren allen Spielern angezeigt, selbst wenn diese keinen Zugriff auf den Charakterbogen haben."
|
||||
},
|
||||
"showGMRulerToPlayers": {
|
||||
"name": "Lineal des Sipelleiters bei Spielern anzeigen",
|
||||
"hint": "Wenn diese Option deaktiviert ist wird das Lineal des Spielleiters bei den anderen Spielern nicht angezeigt."
|
||||
},
|
||||
"speedProviderSettings": {
|
||||
"name": "Einstellungen zur Spielsystemintegration",
|
||||
"hint": "In diesem Menü befinden sich alle spielsystemspezifischen Einstellungen.",
|
||||
"button": "Einstellungen zur Spielsystemintegration",
|
||||
"windowTitle": "Einstellungen zur Spielsystemintegration",
|
||||
"headers": {
|
||||
"speedProvider": "Spielsystemintegration",
|
||||
"speedProviderSettings": "Integrationsspezifische Einstellungen"
|
||||
},
|
||||
"activeProvider": {
|
||||
"name": "Verwendete Spielsystemintegration",
|
||||
"hint": "Die unten angezeigten Einstellungen hängen von der verwendeten Spielsystemintegration ab. Wenn der Spielleiter eine andere Spielsystemintegration auswählt können sich die zur Verfügung stehnden Einstellungen ändern."
|
||||
},
|
||||
"noSettings": "Diese Spielsystemintegration hat keine Einstellmöglichkeiten",
|
||||
"color": {
|
||||
"name": "Farbe für {colorName}",
|
||||
"hint": "Die Farbe mit der Felder in {colorName} Reichweite hervorgehoben werden",
|
||||
"unreachable": {
|
||||
"name": "unerreichbar",
|
||||
"hint": "Die Farbe für Felder, die von der bewegten Spielfigur nicht erreicht werden können"
|
||||
}
|
||||
},
|
||||
"speedProvider": {
|
||||
"name": "Verwendete Spielsystemintegration",
|
||||
"hint": "Wähle aus, welche Spielsystemintegration für die farbliche Hervorhebung der Felder zuständig sein soll. Drag Ruler stellt eine generische Spielsystemintegration zur Verfügung, die grundlegende Funktionalität bietet und bei korrekter konfiguration mit allen Spielsystemen funktionieren sollte. Weitere Spielsystemintegrationen können durch Module und Spielsysteme angeboten werden. Eine andere Spielsystemintegration als die generische auszuwählen kann eine bessere Inegration in das verwendete Spielsystem bieten. Die Optionen unterhalb sind davon abhäng, welche Spielsystemintegration hier ausgewählt wurde.",
|
||||
"choices": {
|
||||
"module": "Modul {name}",
|
||||
"native": "Generisch",
|
||||
"system": "System {name}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"swapSpacebarRightClick": {
|
||||
"name": "Leertaste und Rechtsklick tauschen",
|
||||
"hint": "Die Funktionen der Leertaste und des Rechtsklicks sind während eine Spielfigur bewegt wird vertauscht. Wenn diese Option aktiviert wrid können mit Rechtsklick Wegpunkte gesetzt werden und mit der Leertaste werden sie wieder gelöscht."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,10 @@
|
||||
"name": "プレイヤーキャラクターの移動速度を全員に公開する",
|
||||
"hint": "有効にすると、アクターの観察者(Observer)権限を持たない人にも,移動範囲の色分けが表示されるようになります。"
|
||||
},
|
||||
"showGMRulerToPlayers": {
|
||||
"name": "GMのルーラーをプレイヤーに見せる",
|
||||
"hint": "無効の場合、GMのルーラーはプレイヤーに表示されません。"
|
||||
},
|
||||
"speedProviderSettings": {
|
||||
"name": "移動速度の提供元",
|
||||
"hint": "ゲームシステムに固有のすべての設定をここで行います。",
|
||||
|
||||
+7
-2
@@ -2,7 +2,7 @@
|
||||
"name": "drag-ruler",
|
||||
"title": "Drag Ruler",
|
||||
"description": "When dragging a token displays a ruler showing how far you've moved that token.",
|
||||
"version": "1.4.2",
|
||||
"version": "1.4.5",
|
||||
"minimumCoreVersion" : "0.7.9",
|
||||
"compatibleCoreVersion" : "0.7.9",
|
||||
"authors": [
|
||||
@@ -19,6 +19,11 @@
|
||||
"speed_provider_settings.html"
|
||||
],
|
||||
"languages": [
|
||||
{
|
||||
"lang": "de",
|
||||
"name": "Deutsch",
|
||||
"path": "lang/de.json"
|
||||
},
|
||||
{
|
||||
"lang": "en",
|
||||
"name": "English",
|
||||
@@ -36,7 +41,7 @@
|
||||
}
|
||||
],
|
||||
"url": "https://github.com/manuelVo/foundryvtt-drag-ruler",
|
||||
"download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.4.2.zip",
|
||||
"download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.4.5.zip",
|
||||
"manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json",
|
||||
"readme": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/README.md",
|
||||
"changelog": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/CHANGELOG.md",
|
||||
|
||||
@@ -108,9 +108,14 @@ export function measure(destination, {gridSpaces=true, snap=false} = {}) {
|
||||
if (snap)
|
||||
destination = getSnapPointForToken(destination.x, destination.y, this.draggedToken)
|
||||
|
||||
const terrainRulerAvailable = game.modules.get("terrain-ruler")?.active && canvas.grid.type !== CONST.GRID_TYPES.GRIDLESS;
|
||||
|
||||
const waypoints = this.waypoints.concat([destination]);
|
||||
// Move the waypoints to the center of the grid if a size is used that measures from edge to edge
|
||||
const centeredWaypoints = applyTokenSizeOffset(waypoints, this.draggedToken)
|
||||
// Foundries native ruler requires the waypoints to sit in the dead center of the square to work properly
|
||||
if (!terrainRulerAvailable)
|
||||
centeredWaypoints.forEach(w => [w.x, w.y] = canvas.grid.getCenter(w.x, w.y));
|
||||
|
||||
const r = this.ruler;
|
||||
this.destination = destination;
|
||||
@@ -133,10 +138,10 @@ export function measure(destination, {gridSpaces=true, snap=false} = {}) {
|
||||
centeredSegments.push({ray: centeredRay, label})
|
||||
}
|
||||
|
||||
|
||||
const shape = getTokenShape(this.draggedToken)
|
||||
|
||||
// Compute measured distance
|
||||
const terrainRulerAvailable = game.modules.get("terrain-ruler")?.active && canvas.grid.type !== CONST.GRID_TYPES.GRIDLESS
|
||||
let distances
|
||||
if (terrainRulerAvailable)
|
||||
distances = game.terrainRuler.measureDistances(centeredSegments, {costFunction: (x, y) => getCostFromSpeedProvider(this.draggedToken, getAreaFromPositionAndShape({x, y}, shape), {x, y})});
|
||||
|
||||
@@ -7,12 +7,16 @@ export function getDefaultSpeedAttribute() {
|
||||
return "actor.data.data.mech.speed"
|
||||
case "pf1":
|
||||
return "actor.data.data.attributes.speed.land.total"
|
||||
case "swade":
|
||||
return "actor.data.data.stats.speed.value"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
export function getDefaultDashMultiplier() {
|
||||
switch (game.system.id) {
|
||||
case "swade":
|
||||
return 0
|
||||
case "dnd5e":
|
||||
case "lancer":
|
||||
case "pf1":
|
||||
|
||||
+17
-1
@@ -7,6 +7,9 @@ export function* zip(it1, it2) {
|
||||
}
|
||||
|
||||
export function getSnapPointForToken(x, y, token) {
|
||||
if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS) {
|
||||
return new PIXI.Point(x, y);
|
||||
}
|
||||
if (canvas.grid.isHex && game.modules.get("hex-size-support")?.active && CONFIG.hexSizeSupport.getAltSnappingFlag(token)) {
|
||||
if (token.getFlag("hex-size-support", "borderSize") % 2 === 0) {
|
||||
const snapPoint = CONFIG.hexSizeSupport.findVertexSnapPoint(x, y, token, canvas.grid.grid)
|
||||
@@ -16,9 +19,22 @@ export function getSnapPointForToken(x, y, token) {
|
||||
return new PIXI.Point(...canvas.grid.getCenter(x, y))
|
||||
}
|
||||
}
|
||||
if (canvas.grid.isHex || token.data.width % 2 === 1) {
|
||||
// Tiny tokens can snap to the cells corners
|
||||
if (!canvas.grid.isHex && token.data.width <= 0.5) {
|
||||
const [topLeftX, topLeftY] = canvas.grid.getTopLeft(x, y);
|
||||
const offsetX = x - topLeftX;
|
||||
const offsetY = y - topLeftY;
|
||||
const subGridWidth = Math.floor(canvas.grid.w / 2);
|
||||
const subGridHeight = Math.floor(canvas.grid.h / 2);
|
||||
const subGridPosX = Math.floor(offsetX / subGridWidth);
|
||||
const subGridPosY = Math.floor(offsetY / subGridHeight);
|
||||
return new PIXI.Point(topLeftX + (subGridPosX + 0.5) * subGridWidth, topLeftY + (subGridPosY + 0.5) * subGridHeight);
|
||||
}
|
||||
// Hex tokens, tokens with odd multipliers (1x1, 3x3, ...) and tokens smaller than 1x1 but bigger than 0.5x0.5 snap to the center of the grid cell
|
||||
if (canvas.grid.isHex || Math.round(token.data.width) % 2 === 1 || token.data.width < 1) {
|
||||
return new PIXI.Point(...canvas.grid.getCenter(x, y))
|
||||
}
|
||||
// All remaining tokens (those with even or fractional multipliers on square grids) snap to the intersection points of the grid
|
||||
const [snappedX, snappedY] = canvas.grid.getCenter(x - canvas.grid.w / 2, y - canvas.grid.h / 2)
|
||||
return new PIXI.Point(snappedX + canvas.grid.w / 2, snappedY + canvas.grid.h / 2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user