Compare commits

..

11 Commits

10 changed files with 55 additions and 6 deletions
+17
View File
@@ -1,3 +1,20 @@
## 1.11.4
### Bugfixes
- When changing the measurement mode via a keybinding (toggle snaping or toggle pathfinding) the updated ruler will now be sent to other players immediately
- Fixed a bug that incorrectly showed a ruler to be snapped to other players despite the ruler not being snapped
- Fixed a bug that could cause a token to move to an incorrect location if the token was being dragged and dropped very rapidly
- Drag Ruler's token movement animations can now be properly waited for (this improves the interaction with modules like sequencer)
### Translation
- Updated Spanish translation (thanks to Viriato139ac#342)
## 1.11.3
### Bugfixes
- The setting to automatically start pathfinding is now visible to players again (this was a regression introduced in 1.11.2)
- Fixed a bug that would show the measurements of other players as if they were using the pathfinder, even if they were not using it.
## 1.11.2 ## 1.11.2
### Bugfixes ### Bugfixes
- Fixed a memory leak that could cause the rule to slow down after using the pathfinding functionality for a while - Fixed a memory leak that could cause the rule to slow down after using the pathfinding functionality for a while
+2
View File
@@ -37,6 +37,7 @@ Drag Ruler will work with all Foundry VTT game systems. However, some game syste
The game systems that offer Drag Ruler integration are: The game systems that offer Drag Ruler integration are:
- Cypher System (starting with version 1.13.0) - Cypher System (starting with version 1.13.0)
- DnD5e (via the module [DnD5e Drag Ruler Integration](https://foundryvtt.com/packages/elevation-drag-ruler))
- GURPS 4th Edition Game Aid (Unofficial) (starting with version 0.9.1) - GURPS 4th Edition Game Aid (Unofficial) (starting with version 0.9.1)
- Ironclaw Second Edition (starting with version 0.2.2) - Ironclaw Second Edition (starting with version 0.2.2)
- Lancer (via the module [Lancer Speed Provider](https://foundryvtt.com/packages/lancer-speed-provider)) - Lancer (via the module [Lancer Speed Provider](https://foundryvtt.com/packages/lancer-speed-provider))
@@ -44,6 +45,7 @@ The game systems that offer Drag Ruler integration are:
- Pathfinder 1 (starting with version 0.77.3) - Pathfinder 1 (starting with version 0.77.3)
- Pathfinder 2e (via the module [PF2E Drag Ruler Integration](https://foundryvtt.com/packages/pf2e-dragruler/)) - Pathfinder 2e (via the module [PF2E Drag Ruler Integration](https://foundryvtt.com/packages/pf2e-dragruler/))
- Shadowrun 5th Edition (via the module [Drag Ruler Integration for Shadowrun 5E](https://foundryvtt.com/packages/drag-ruler-integration-for-shadowrun-5e)) - Shadowrun 5th Edition (via the module [Drag Ruler Integration for Shadowrun 5E](https://foundryvtt.com/packages/drag-ruler-integration-for-shadowrun-5e))
- Shadow of the Demon Lord (starting with version 1.7.15)
- Starfinder (via the module [Starfinder Drag Ruler Integration](https://foundryvtt.com/packages/starfinder-drag-ruler)) - Starfinder (via the module [Starfinder Drag Ruler Integration](https://foundryvtt.com/packages/starfinder-drag-ruler))
- Stargate RPG (starting with version 1.6.0) - Stargate RPG (starting with version 1.6.0)
- Symbaroum (via the module [Symbaroum drag ruler integration](https://foundryvtt.com/packages/symbaroum-drag-ruler-integration)) - Symbaroum (via the module [Symbaroum drag ruler integration](https://foundryvtt.com/packages/symbaroum-drag-ruler-integration))
+12
View File
@@ -44,9 +44,17 @@
"moveWithoutAnimation": { "moveWithoutAnimation": {
"name": "Deshabilitar animación de icono", "name": "Deshabilitar animación de icono",
"hint": "Si al soltar un icono se presiona esta tecla, se deshabilitará la animación del icono al moverse al destino" "hint": "Si al soltar un icono se presiona esta tecla, se deshabilitará la animación del icono al moverse al destino"
},
"togglePathfinding": {
"name": "Conmutar búsqueda de camino",
"hint": "Cuando se presione al arrastrar un icono, la funcionalidad de búsqueda de camino será temporalmente habilitada/deshabilitada"
} }
}, },
"settings": { "settings": {
"allowPathfinding": {
"name": "Permitir búsqueda de camino a los jugadores",
"hint": "Permite a los jugadores usar en este mundo la funcionalidad de búsqueda de camino. Tenga cuidado porque la ruta puede transcurrir por lugares con niebla de guerra o muros invisibles, lo que podrá revelar algunos secretos a los jugadores antes de tiempo"
},
"alwaysShowSpeedForPCs": { "alwaysShowSpeedForPCs": {
"name": "Mostrar velocidad de los PJs a todo el mundo", "name": "Mostrar velocidad de los PJs a todo el mundo",
"hint": "Si se habilita, se mostrará a todo el mundo los códigos de colores de las rutas de los PJs, incluso si no tienen permisos de observador para ese personaje" "hint": "Si se habilita, se mostrará a todo el mundo los códigos de colores de las rutas de los PJs, incluso si no tienen permisos de observador para ese personaje"
@@ -55,6 +63,10 @@
"name": "Comenzar a medir automáticamente", "name": "Comenzar a medir automáticamente",
"hint": "Si se habilita, Drag Ruler comenzará a medir en cuanto se comience a arrastrar un icono. Si se deshabilita, Drag Ruler permanecerá inactivo y comenzará a medir únicamente cuando se presione el botón configurado para añadir un nuevo punto de ruta" "hint": "Si se habilita, Drag Ruler comenzará a medir en cuanto se comience a arrastrar un icono. Si se deshabilita, Drag Ruler permanecerá inactivo y comenzará a medir únicamente cuando se presione el botón configurado para añadir un nuevo punto de ruta"
}, },
"autoPathfinding": {
"name": "Búsqueda de camino por defecto",
"hint": "Si se habilita, al arrastrar un icono se usará automáticamente la regla de búsqueda de camino"
},
"enableMovementHistory": { "enableMovementHistory": {
"name": "Habilitar historial de movimiento durante el combate", "name": "Habilitar historial de movimiento durante el combate",
"hint": "Si se habilita, Drag Ruler recordará la ruta que ha seguido un icono en su turno y la mostrará al seleccionarlo de nuevo" "hint": "Si se habilita, Drag Ruler recordará la ruta que ha seguido un icono en su turno y la mostrará al seleccionarlo de nuevo"
+2 -2
View File
@@ -2,7 +2,7 @@
"name": "drag-ruler", "name": "drag-ruler",
"title": "Drag Ruler", "title": "Drag Ruler",
"description": "When dragging a token displays a ruler showing how far you've moved that token.", "description": "When dragging a token displays a ruler showing how far you've moved that token.",
"version": "1.11.2", "version": "1.11.4",
"minimumCoreVersion" : "9.245", "minimumCoreVersion" : "9.245",
"compatibleCoreVersion" : "9", "compatibleCoreVersion" : "9",
"authors": [ "authors": [
@@ -65,7 +65,7 @@
], ],
"socket": true, "socket": true,
"url": "https://github.com/manuelVo/foundryvtt-drag-ruler", "url": "https://github.com/manuelVo/foundryvtt-drag-ruler",
"download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.11.2.zip", "download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.11.4.zip",
"manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json", "manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json",
"readme": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/README.md", "readme": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/README.md",
"changelog": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/CHANGELOG.md", "changelog": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/CHANGELOG.md",
+2 -2
View File
@@ -91,7 +91,7 @@ async function animateEntities(entities, draggedEntity, draggedRays, wasPaused)
}); });
await draggedEntity.scene.updateEmbeddedDocuments(draggedEntity.constructor.embeddedName, updates, {animate}); await draggedEntity.scene.updateEmbeddedDocuments(draggedEntity.constructor.embeddedName, updates, {animate});
if (animate) if (animate)
await Promise.all(entityPaths.map(({entity, path}) => entity.animateMovement(path))); await Promise.all(entityPaths.map(({entity}) => CanvasAnimation.getAnimation(entity.movementAnimationName)?.promise));
// This is a flag of the "Monk's Active Tile Triggers" module that signals that the movement should be cancelled early // This is a flag of the "Monk's Active Tile Triggers" module that signals that the movement should be cancelled early
if (this.cancelMovement) { if (this.cancelMovement) {
@@ -168,7 +168,7 @@ export function measure(destination, options={}) {
this.dragRulerRemovePathfindingWaypoints(); this.dragRulerRemovePathfindingWaypoints();
if (isToken && isPathfindingEnabled()) { if (isToken && isPathfindingEnabled.call(this)) {
const from = getGridPositionFromPixelsObj(this.waypoints[this.waypoints.length - 1]); const from = getGridPositionFromPixelsObj(this.waypoints[this.waypoints.length - 1]);
const to = getGridPositionFromPixelsObj(destination); const to = getGridPositionFromPixelsObj(destination);
let path = findPath(from, to, this.draggedEntity, this.waypoints); let path = findPath(from, to, this.draggedEntity, this.waypoints);
+2
View File
@@ -107,6 +107,7 @@ function handleDisableSnap(event) {
return false; return false;
ruler.measure(getMeasurePosition(), {snap: !disableSnap}); ruler.measure(getMeasurePosition(), {snap: !disableSnap});
ruler.dragRulerSendState();
return false; return false;
} }
@@ -124,5 +125,6 @@ function handleTogglePathfinding(event) {
return false; return false;
ruler.measure(getMeasurePosition(), {snap: !disableSnap}); ruler.measure(getMeasurePosition(), {snap: !disableSnap});
ruler.dragRulerSendState();
return false; return false;
} }
+5
View File
@@ -97,6 +97,7 @@ async function tokenLayerUndoHistory(wrapped) {
function onEntityLeftDragStart(wrapped, event) { function onEntityLeftDragStart(wrapped, event) {
wrapped(event); wrapped(event);
console.warn("start", Date.now());
const isToken = this instanceof Token; const isToken = this instanceof Token;
const ruler = canvas.controls.ruler const ruler = canvas.controls.ruler
ruler.draggedEntity = this; ruler.draggedEntity = this;
@@ -127,6 +128,7 @@ function onEntityLeftDragMove(wrapped, event) {
function onEntityDragLeftDrop(event) { function onEntityDragLeftDrop(event) {
const ruler = canvas.controls.ruler const ruler = canvas.controls.ruler
console.warn("stop", ruler._state, Date.now());
if (!ruler.isDragRuler) { if (!ruler.isDragRuler) {
ruler.draggedEntity = undefined; ruler.draggedEntity = undefined;
return false return false
@@ -137,6 +139,9 @@ function onEntityDragLeftDrop(event) {
// This can happen if the user presses ESC during drag (maybe there are other ways too) // This can happen if the user presses ESC during drag (maybe there are other ways too)
if (selectedTokens.length === 0) if (selectedTokens.length === 0)
selectedTokens.push(ruler.draggedEntity); selectedTokens.push(ruler.draggedEntity);
// This can happen if the ruler is being dragged so rapidly that the drag move handler hasn't been called before dropping
if (ruler._state === Ruler.STATES.STARTING)
onMouseMove.call(ruler, event);
ruler._state = Ruler.STATES.MOVING ruler._state = Ruler.STATES.MOVING
moveEntities.call(ruler, ruler.draggedEntity, selectedTokens); moveEntities.call(ruler, ruler.draggedEntity, selectedTokens);
return true return true
+2
View File
@@ -8,6 +8,8 @@ let cachedNodes = undefined;
let use5105 = false; let use5105 = false;
export function isPathfindingEnabled() { export function isPathfindingEnabled() {
if (this.user !== game.user)
return false;
if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS) if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS)
return false; return false;
if (!game.user.isGM && !game.settings.get(settingsKey, "allowPathfinding")) if (!game.user.isGM && !game.settings.get(settingsKey, "allowPathfinding"))
+9
View File
@@ -61,6 +61,9 @@ export function extendRuler() {
measure(destination, options={}) { measure(destination, options={}) {
if (this.isDragRuler) { if (this.isDragRuler) {
// If this is the ruler of a remote user take the waypoints as they were transmitted and don't apply any additional snapping to them
if (this.user !== game.user)
options.snap = false;
return measure.call(this, destination, options); return measure.call(this, destination, options);
} }
else { else {
@@ -199,6 +202,12 @@ export function extendRuler() {
if (measureImmediately) if (measureImmediately)
ruler.measure(destination, options); ruler.measure(destination, options);
} }
dragRulerSendState() {
game.user.broadcastActivity({
ruler: this.toJSON()
});
}
} }
Ruler = DragRulerRuler; Ruler = DragRulerRuler;
+1 -1
View File
@@ -97,7 +97,7 @@ export function registerSettings() {
name: "drag-ruler.settings.autoPathfinding.name", name: "drag-ruler.settings.autoPathfinding.name",
hint: "drag-ruler.settings.autoPathfinding.hint", hint: "drag-ruler.settings.autoPathfinding.hint",
scpoe: "client", scpoe: "client",
config: early_isGM(), config: early_isGM() || game.settings.get(settingsKey, "allowPathfinding"),
type: Boolean, type: Boolean,
defualt: false, defualt: false,
}); });