Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 07d0c37fe9 | |||
| b8b97ac27a | |||
| 0e9215e8bb | |||
| dc4355e0de | |||
| cf7f84d9e4 | |||
| fe8a3b7b39 | |||
| be9535acd3 | |||
| 530a16ca5d | |||
| 3b9fbac80d | |||
| 0456fb0849 | |||
| 01d01f9887 | |||
| 9042b79967 | |||
| 4159d20e18 | |||
| 3897577756 | |||
| 5c29f401d6 | |||
| 1328d52f94 | |||
| eef05553c0 | |||
| 7ba89e4229 |
@@ -1,3 +1,36 @@
|
|||||||
|
## 1.7.7
|
||||||
|
### Compatibility
|
||||||
|
- Updated the default settings for the swade game system. The new default speed attribute points to a speed value that gets adjusted for wounds.
|
||||||
|
|
||||||
|
|
||||||
|
## 1.7.6
|
||||||
|
### Translation
|
||||||
|
- Added Korean translation (thanks to KLO#1490)
|
||||||
|
- Added Spanish translation (thanks to Viriato139ac#342)
|
||||||
|
|
||||||
|
### Compatibility
|
||||||
|
- Drag Ruler's Generic Speed Provider is now awar of good default values for the "Call of Cthulhu 7th edition (Unofficial)" game system
|
||||||
|
- Drag Ruler is now compatible with Foundry 0.8.8
|
||||||
|
|
||||||
|
## 1.7.5
|
||||||
|
### Bugfixes
|
||||||
|
- Decimal speeds (as often used in metric game systems) are no longer being rounded down (thanks to DarKDinDoN for diagnosing this bug)
|
||||||
|
|
||||||
|
|
||||||
|
## 1.7.4
|
||||||
|
### Bugfixes
|
||||||
|
- Fixed a bug where the ruler would wrongly snap to the grid center for other players when dragging a measurement template
|
||||||
|
|
||||||
|
### Compatibility
|
||||||
|
- Drag Ruler is now compatiblie with the "Monk's Active Tile Triggers" module
|
||||||
|
- Drag Ruler's Generic Speed Provider is now aware of good default values for the D&D 3.5 game system
|
||||||
|
- Drag Ruler is now compatible with Foundry 0.8.7
|
||||||
|
|
||||||
|
## 1.7.3
|
||||||
|
### Compatibility
|
||||||
|
- Drag Ruler is now compatible with Foundry 0.8.5
|
||||||
|
|
||||||
|
|
||||||
## 1.7.2
|
## 1.7.2
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
- Fixed a bug that prevented waypoints for measurement templates from snapping to any other point than a grid cell corner (or grid cell center on hex)
|
- Fixed a bug that prevented waypoints for measurement templates from snapping to any other point than a grid cell corner (or grid cell center on hex)
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ Drag Ruler is available in the follwing languages:
|
|||||||
- English
|
- English
|
||||||
- German
|
- German
|
||||||
- Japanese (thanks to touge)
|
- Japanese (thanks to touge)
|
||||||
|
- Korean (thanks to KLO#1490)
|
||||||
|
- Spanish (thanks to Viriato139ac#342)
|
||||||
|
|
||||||
## API
|
## API
|
||||||
*Audience: This paragraph is intended for module and system devleopers that want to add more complex behavior to Drag Ruler. If you just want to use this plugins features skip this paragraph.*
|
*Audience: This paragraph is intended for module and system devleopers that want to add more complex behavior to Drag Ruler. If you just want to use this plugins features skip this paragraph.*
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"drag-ruler": {
|
||||||
|
"I18N": {
|
||||||
|
"LANGUAGE": "Español",
|
||||||
|
"MAINTAINERS": "@Viriato139ac#0342"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ok": "OK",
|
||||||
|
"terrain-ruler": {
|
||||||
|
"title": "Cómo medir a través de terreno difícil con Drag Ruler",
|
||||||
|
"text": "You have the {moduleName} module enabled. Drag Ruler is able to measure difficult terrain that was placed down using that module. To make this possible Drag Ruler utilizes the Terrain Ruler module. If Terrain Ruler is installed and activated Drag Ruler will automatically start to respect difficult terrain in it's measurements.",
|
||||||
|
"neverShowAgain": "No volver a mostrar"
|
||||||
|
},
|
||||||
|
"socketlib": {
|
||||||
|
"title": "El módulo Socketlib no está instalado",
|
||||||
|
"text": "Drag Ruler necesita para su funcionamiento correcto que instale socketlib. Por favor, active socketlib en este mundo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resetMovementHistory": "Reiniciar historial de movimiento",
|
||||||
|
"genericSpeedProvider": {
|
||||||
|
"settings": {
|
||||||
|
"dashMultiplier": {
|
||||||
|
"name": "Multiplicador por correr",
|
||||||
|
"hint": "Se puede usar para aplicar a los iconos una velocidad secundaria que use un color distinto en la medición de la ruta a seguir. Establece el valor a 0 para deshabilitar esta velocidad secundaria"
|
||||||
|
},
|
||||||
|
"speedAttribute": {
|
||||||
|
"name": "Attributo de velocidad",
|
||||||
|
"hint": "El atributo que define la velocidad de movimiento andando del icono. Se usa para los códigos de colores al medir la ruta a seguir"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"speeds": {
|
||||||
|
"walk": "caminar",
|
||||||
|
"dash": "correr"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"alwaysShowSpeedForPCs": {
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"enableMovementHistory": {
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"showGMRulerToPlayers": {
|
||||||
|
"name": "Mostrar regla del GM a los jugadores",
|
||||||
|
"hint": "Si se deshabilita, no se mostrará la regla de medición de los GMs al resto de usuarios"
|
||||||
|
},
|
||||||
|
"speedProviderSettings": {
|
||||||
|
"name": "Proveedor de configuración de velocidad",
|
||||||
|
"hint": "El proveedor de ajustes de velocidad contiene todos los ajustes específicos de cada sistema",
|
||||||
|
"button": "Proveedor de configuración de velocidad",
|
||||||
|
"windowTitle": "Proveedor de configuración de velocidad",
|
||||||
|
"headers": {
|
||||||
|
"speedProvider": "Proveedor de velocidad",
|
||||||
|
"speedProviderSettings": "Configuraciones específicas del proveedor de velocidad"
|
||||||
|
},
|
||||||
|
"activeProvider": {
|
||||||
|
"name": "Proveedor de velocidad actualmente activo",
|
||||||
|
"hint": "La configuración que se muestra más abajo depende del proveedor de velocidad activo. Si el GM selecciona un proveedor distinto, los ajustes disponibles puede que cambien"
|
||||||
|
},
|
||||||
|
"noSettings": "Este proveedor de velocidad no dispone de ninguna opción de configuración",
|
||||||
|
"color": {
|
||||||
|
"name": "Color para {colorName}",
|
||||||
|
"hint": "Color que se usará para establecer el tono de las cuadrículas que se encuentran dentro del rango {colorName}",
|
||||||
|
"unreachable": {
|
||||||
|
"name": "inalcanzable",
|
||||||
|
"hint": "Color que se usará para las cuadrículas más allá de la distancia máxima de movimiento del icono"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"speedProvider": {
|
||||||
|
"name": "Proveedor de configuración de velocidad",
|
||||||
|
"hint": "Seleccione quien suministra la información de la velocidad de los iconos a la hora de colorear la ruta a seguir. Drag Ruler incluye un proveedor genérico que ofrece una funcionalidad básica y que probablemente funcione para casi todos los sistemas si se usa de forma correcta. Se pueden añadir otros proveedores de velocidad al instalar sistemas o módulos. Seleccionar un proveedor distinto al genérico asegurará una mejor integración con las reglas del sistema que está usando. Las opciones siguientes dependerán del proveedor que seleccione",
|
||||||
|
"choices": {
|
||||||
|
"module": "Módulo {name}",
|
||||||
|
"native": "Genérico",
|
||||||
|
"system": "Sistema {name}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"swapSpacebarRightClick": {
|
||||||
|
"name": "Intercambiar barra espaciadora y clic-derecho",
|
||||||
|
"hint": "Cambia el funcionamiento de la barra espaciadora y el clic-derecho del ratón mientras se arrastra un icono. Si está habilitado, clic-derecho establecerá puntos en la ruta y la barra espaciadora los borrará"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
"drag-ruler": {
|
||||||
|
"dependencies": {
|
||||||
|
"ok": "OK",
|
||||||
|
"terrain-ruler": {
|
||||||
|
"title": "Drag Ruler를 사용한 험지 측정 방법",
|
||||||
|
"text": "{moduleName} 모듈을 활성화했습니다. Drag Ruler는 해당 모듈을 사용하여 험지를 측정할 수 있습니다. 이렇게 하려면 Terrain Ruler 모듈을 활성화하십시오. Terrain Ruler 모듈을 설치하고 Drag Ruler를 활성화하면 자동적으로 험지를 측정합니다.",
|
||||||
|
"neverShowAgain": "다시 표시하지 않음"
|
||||||
|
},
|
||||||
|
"socketlib": {
|
||||||
|
"title": "Socketlib 모듈 비탐지",
|
||||||
|
"text": "Drag Ruler는 Socketlib 모듈이 있어야 합니다. 이 월드에서 해당 모듈을 활성화하십시오."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resetMovementHistory": "이동 내역 리셋",
|
||||||
|
"genericSpeedProvider": {
|
||||||
|
"settings": {
|
||||||
|
"dashMultiplier": {
|
||||||
|
"name": "질주 승수",
|
||||||
|
"hint": "측정된 경로에 색을 입힐 때 추가 속도를 제공하는 데 사용할 수 있다. 추가 속도를 비활성화하려면 이 값을 0으로 설정한다."
|
||||||
|
},
|
||||||
|
"speedAttribute": {
|
||||||
|
"name": "속도 어트리뷰트",
|
||||||
|
"hint": "토큰의 이동속도를 정의하는 속성이다. 측정 경로에 색을 입힐 때 사용한다."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"speeds": {
|
||||||
|
"walk": "보행",
|
||||||
|
"dash": "질주"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"alwaysShowSpeedForPCs": {
|
||||||
|
"name": "PC 속도를 모두에게 표시",
|
||||||
|
"hint": "활성화시 플레이어 캐릭터에 대한 관찰자 권한이 없더라도 액터 속도에 따라 색상이 모든 유저에게 표시된다."
|
||||||
|
},
|
||||||
|
"enableMovementHistory": {
|
||||||
|
"name": "전투 중 이동 기록 사용",
|
||||||
|
"hint": "활성화시 Drag Ruler는 해당 턴에 토큰이 이동한 경로를 기억하고 다시 이동시킬 때 표시한다."
|
||||||
|
},
|
||||||
|
"showGMRulerToPlayers": {
|
||||||
|
"name": "GM 측정자를 플레이어에게 표시",
|
||||||
|
"hint": "비활성화 시 GM이 아닌 유저에게는 GM의 측정자가 표시되지 않는다."
|
||||||
|
},
|
||||||
|
"speedProviderSettings": {
|
||||||
|
"name": "속도 공급자 설정",
|
||||||
|
"hint": "속도 공급자 설정은 게임 시스템별 설정을 모두 포함한다.",
|
||||||
|
"button": "속도 공급자 설정",
|
||||||
|
"windowTitle": "속도 공급자 설정",
|
||||||
|
"headers": {
|
||||||
|
"speedProvider": "속도 공급자",
|
||||||
|
"speedProviderSettings": "속도 공급자 관련 설정"
|
||||||
|
},
|
||||||
|
"activeProvider": {
|
||||||
|
"name": "현재 활성화된 속도 공급자",
|
||||||
|
"hint": "아래에 표시된 설정은 활성화된 속도 공급자를 보여준다. GM이 다른 속도 공급자를 선택하면 사용 가능한 설정이 변경될 수 있다."
|
||||||
|
},
|
||||||
|
"noSettings": "이 속도 공급자는 구성 옵션을 제공하지 않습니다.",
|
||||||
|
"color": {
|
||||||
|
"name": "{colorName} 색상",
|
||||||
|
"hint": "{colorName} 범위 내에서의 칸의 색상을 지정하는데 사용할 색상.",
|
||||||
|
"unreachable": {
|
||||||
|
"name": "도달 불가",
|
||||||
|
"hint": "드래그한 토큰으로 도달할 수 없는 공간의 색상"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"speedProvider": {
|
||||||
|
"name": "속도 설정 공급자",
|
||||||
|
"hint": "색을 입힐 동안 사용할 토큰에 대한 속도 정보 제공자를 선택한다. Drag Ruler는 기본 기능을 제공하며 올바르게 구성된 경우 모든 게임 시스템에서 작동하는 일반적 속도 공급자를 제공한다. 게임 시스템과 설치된 모듈을 통해 더 많은 속도 공급자를 이용할 수 있다. 일반 속도 공급자와는 다른 속도 공급자를 선택하면 사용 중인 게임 시스템의 규칙에 더 잘 통합될 수 있다.아래 옵션은 여기에서 선택한 속도 공급자에 따라 다르다.",
|
||||||
|
"choices": {
|
||||||
|
"module": "모듈 {name}",
|
||||||
|
"native": "포괄적",
|
||||||
|
"system": "시스템 {name}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"swapSpacebarRightClick": {
|
||||||
|
"name": "스페이스바와 우클릭 스왑",
|
||||||
|
"hint": "드래그 도중 스페이스바의 기능을 우클릭 기능과 바꾼다. 활성화된 경우 드래그시 우클릭을 사용하면 경유지가 배치되고, 스페이스바가 해당 경유지를 삭제한다."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-4
@@ -2,9 +2,9 @@
|
|||||||
"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.7.2",
|
"version": "1.7.7",
|
||||||
"minimumCoreVersion" : "0.7.9",
|
"minimumCoreVersion" : "0.8.5",
|
||||||
"compatibleCoreVersion" : "0.7.9",
|
"compatibleCoreVersion" : "0.8.8",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Manuel Vögele",
|
"name": "Manuel Vögele",
|
||||||
@@ -35,10 +35,20 @@
|
|||||||
"name": "日本語",
|
"name": "日本語",
|
||||||
"path": "lang/ja.json"
|
"path": "lang/ja.json"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"lang": "ko",
|
||||||
|
"name": "한국어",
|
||||||
|
"path": "lang/ko.json"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"lang": "zh-tw",
|
"lang": "zh-tw",
|
||||||
"name": "正體中文",
|
"name": "正體中文",
|
||||||
"path": "lang/zh-tw.json"
|
"path": "lang/zh-tw.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lang": "es",
|
||||||
|
"name": "Español",
|
||||||
|
"path": "lang/es.json"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
@@ -49,7 +59,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.7.2.zip",
|
"download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.7.7.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",
|
||||||
|
|||||||
+11
-1
@@ -72,6 +72,10 @@ async function animateEntities(entities, draggedEntity, draggedRays, wasPaused)
|
|||||||
const isToken = draggedEntity instanceof Token;
|
const isToken = draggedEntity instanceof Token;
|
||||||
const animate = isToken && !game.keyboard.isDown("Alt");
|
const animate = isToken && !game.keyboard.isDown("Alt");
|
||||||
const startWaypoint = animate ? 0 : entityAnimationData[0].rays.length - 1;
|
const startWaypoint = animate ? 0 : entityAnimationData[0].rays.length - 1;
|
||||||
|
|
||||||
|
// This is a flag of the "Monk's Active Tile Triggers" module that signals that the movement should be cancelled early
|
||||||
|
this.cancelMovement = false;
|
||||||
|
|
||||||
for (let i = startWaypoint;i < entityAnimationData[0].rays.length; i++) {
|
for (let i = startWaypoint;i < entityAnimationData[0].rays.length; i++) {
|
||||||
if (!wasPaused && game.paused) break;
|
if (!wasPaused && game.paused) break;
|
||||||
const entityPaths = entityAnimationData.map(({entity, rays, dx, dy}) => {
|
const entityPaths = entityAnimationData.map(({entity, rays, dx, dy}) => {
|
||||||
@@ -83,9 +87,15 @@ async function animateEntities(entities, draggedEntity, draggedRays, wasPaused)
|
|||||||
const updates = entityPaths.map(({entity, path}) => {
|
const updates = entityPaths.map(({entity, path}) => {
|
||||||
return {x: path.B.x, y: path.B.y, _id: entity.id};
|
return {x: path.B.x, y: path.B.y, _id: entity.id};
|
||||||
});
|
});
|
||||||
await draggedEntity.scene.updateEmbeddedEntity(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, path}) => entity.animateMovement(path)));
|
||||||
|
|
||||||
|
// This is a flag of the "Monk's Active Tile Triggers" module that signals that the movement should be cancelled early
|
||||||
|
if (this.cancelMovement) {
|
||||||
|
entityAnimationData.forEach(ead => ead.rays = ead.rays.slice(0, i + 1));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isToken)
|
if (isToken)
|
||||||
trackRays(entities, entityAnimationData.map(({rays}) => rays)).then(() => recalculate(entities));
|
trackRays(entities, entityAnimationData.map(({rays}) => rays)).then(() => recalculate(entities));
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ Hooks.on("getCombatTrackerEntryContext", function (html, menu) {
|
|||||||
const entry = {
|
const entry = {
|
||||||
name: "drag-ruler.resetMovementHistory",
|
name: "drag-ruler.resetMovementHistory",
|
||||||
icon: '<i class="fas fa-undo-alt"></i>',
|
icon: '<i class="fas fa-undo-alt"></i>',
|
||||||
callback: li => resetMovementHistory(ui.combat.combat, li.data('combatant-id')),
|
callback: li => resetMovementHistory(ui.combat.viewed, li.data('combatant-id')),
|
||||||
};
|
};
|
||||||
menu.splice(1, 0, entry);
|
menu.splice(1, 0, entry);
|
||||||
});
|
});
|
||||||
|
|||||||
+12
-12
@@ -4,19 +4,19 @@ import {getTokenShape, zip} from "./util.js";
|
|||||||
|
|
||||||
function initTrackingFlag(combatant) {
|
function initTrackingFlag(combatant) {
|
||||||
const initialFlag = {passedWaypoints: [], trackedRound: 0};
|
const initialFlag = {passedWaypoints: [], trackedRound: 0};
|
||||||
let dragRulerFlag = combatant.flags?.dragRuler;
|
let dragRulerFlag = combatant.data.flags.dragRuler;
|
||||||
if (dragRulerFlag) {
|
if (dragRulerFlag) {
|
||||||
if (isNaN(dragRulerFlag.trackedRound)) {
|
if (isNaN(dragRulerFlag.trackedRound)) {
|
||||||
mergeObject(dragRulerFlag, initialFlag);
|
mergeObject(dragRulerFlag, initialFlag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
combatant.flags.dragRuler = initialFlag;
|
combatant.data.flags.dragRuler = initialFlag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInitializedCombatant(token, combat) {
|
function getInitializedCombatant(token, combat) {
|
||||||
const combatant = combat.getCombatantByToken(token.data._id);
|
const combatant = combat.getCombatantByToken(token.id);
|
||||||
if (!combatant)
|
if (!combatant)
|
||||||
return undefined;
|
return undefined;
|
||||||
initTrackingFlag(combatant);
|
initTrackingFlag(combatant);
|
||||||
@@ -43,14 +43,14 @@ function calculateUpdate(combat, token, rays) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Check if we have entered a new round. If so, remove the currently stored path
|
// Check if we have entered a new round. If so, remove the currently stored path
|
||||||
if (combat.data.round > combatant.flags.dragRuler.trackedRound) {
|
if (combat.data.round > combatant.data.flags.dragRuler.trackedRound) {
|
||||||
combatant.flags.dragRuler.passedWaypoints = [];
|
combatant.data.flags.dragRuler.passedWaypoints = [];
|
||||||
combatant.flags.dragRuler.trackedRound = combat.data.round;
|
combatant.data.flags.dragRuler.trackedRound = combat.data.round;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the passed waypoints to the combatant
|
// Add the passed waypoints to the combatant
|
||||||
const terrainRulerAvailable = game.modules.get("terrain-ruler")?.active && (!game.modules.get("TerrainLayer")?.active || canvas.grid.type !== CONST.GRID_TYPES.GRIDLESS);
|
const terrainRulerAvailable = game.modules.get("terrain-ruler")?.active && (!game.modules.get("TerrainLayer")?.active || canvas.grid.type !== CONST.GRID_TYPES.GRIDLESS);
|
||||||
const dragRulerFlags = combatant.flags.dragRuler;
|
const dragRulerFlags = combatant.data.flags.dragRuler;
|
||||||
const waypoints = dragRulerFlags.passedWaypoints;
|
const waypoints = dragRulerFlags.passedWaypoints;
|
||||||
for (const ray of rays) {
|
for (const ray of rays) {
|
||||||
// Ignore rays that have the same start and end coordinates
|
// Ignore rays that have the same start and end coordinates
|
||||||
@@ -63,17 +63,17 @@ function calculateUpdate(combat, token, rays) {
|
|||||||
waypoints.push(ray.A);
|
waypoints.push(ray.A);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {_id: combatant._id, dragRulerFlags};
|
return {_id: combatant.id, dragRulerFlags};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMovementHistory(token) {
|
export function getMovementHistory(token) {
|
||||||
const combat = game.combat;
|
const combat = game.combat;
|
||||||
if (!combat)
|
if (!combat)
|
||||||
return [];
|
return [];
|
||||||
const combatant = combat.getCombatantByToken(token.data._id);
|
const combatant = combat.getCombatantByToken(token.id);
|
||||||
if (!combatant)
|
if (!combatant)
|
||||||
return [];
|
return [];
|
||||||
const dragRulerFlags = combatant.flags.dragRuler;
|
const dragRulerFlags = combatant.data.flags.dragRuler;
|
||||||
if (!dragRulerFlags)
|
if (!dragRulerFlags)
|
||||||
return [];
|
return [];
|
||||||
if (combat.data.round > dragRulerFlags.trackedRound)
|
if (combat.data.round > dragRulerFlags.trackedRound)
|
||||||
@@ -82,8 +82,8 @@ export function getMovementHistory(token) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function resetMovementHistory(combat, combatantId) {
|
export async function resetMovementHistory(combat, combatantId) {
|
||||||
const combatant = combat.getCombatant(combatantId);
|
const combatant = combat.combatants.get(combatantId);
|
||||||
const dragRulerFlags = combatant.flags.dragRuler;
|
const dragRulerFlags = combatant.data.flags.dragRuler;
|
||||||
if (!dragRulerFlags)
|
if (!dragRulerFlags)
|
||||||
return;
|
return;
|
||||||
dragRulerFlags.passedWaypoints = null;
|
dragRulerFlags.passedWaypoints = null;
|
||||||
|
|||||||
+8
-2
@@ -33,8 +33,11 @@ export class DragRulerRuler extends Ruler {
|
|||||||
|
|
||||||
toJSON() {
|
toJSON() {
|
||||||
const json = super.toJSON();
|
const json = super.toJSON();
|
||||||
if (this.draggedEntity)
|
if (this.draggedEntity) {
|
||||||
json["draggedEntity"] = this.draggedEntity.data._id;
|
const isToken = this.draggedEntity instanceof Token;
|
||||||
|
json["draggedEntityIsToken"] = isToken;
|
||||||
|
json["draggedEntity"] = this.draggedEntity.id;
|
||||||
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +47,10 @@ export class DragRulerRuler extends Ruler {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (data.draggedEntity) {
|
if (data.draggedEntity) {
|
||||||
|
if (data.draggedEntityIsToken)
|
||||||
this.draggedEntity = canvas.tokens.get(data.draggedEntity);
|
this.draggedEntity = canvas.tokens.get(data.draggedEntity);
|
||||||
|
else
|
||||||
|
this.draggedEntity = canvas.templates.get(data.draggedEntity);
|
||||||
}
|
}
|
||||||
super.update(data);
|
super.update(data);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -12,7 +12,7 @@ export function updateCombatantDragRulerFlags(combat, updates) {
|
|||||||
const combatId = combat.id;
|
const combatId = combat.id;
|
||||||
// TODO Check if canvas.tokens.get is still neccessary in future foundry versions
|
// TODO Check if canvas.tokens.get is still neccessary in future foundry versions
|
||||||
return socket.executeAsGM(_socketUpdateCombatantDragRulerFlags, combatId, updates)
|
return socket.executeAsGM(_socketUpdateCombatantDragRulerFlags, combatId, updates)
|
||||||
.then(() => currentSpeedProvider.onMovementHistoryUpdate(updates.map(update => canvas.tokens.get(combat.getCombatant(update._id).token._id))));
|
.then(() => currentSpeedProvider.onMovementHistoryUpdate(updates.map(update => canvas.tokens.get(combat.combatants.get(update._id).token.id))));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _socketUpdateCombatantDragRulerFlags(combatId, updates) {
|
async function _socketUpdateCombatantDragRulerFlags(combatId, updates) {
|
||||||
@@ -20,10 +20,10 @@ async function _socketUpdateCombatantDragRulerFlags(combatId, updates) {
|
|||||||
const combat = game.combats.get(combatId);
|
const combat = game.combats.get(combatId);
|
||||||
const requestedUpdates = updates.length;
|
const requestedUpdates = updates.length;
|
||||||
updates = updates.filter(update => {
|
updates = updates.filter(update => {
|
||||||
const actor = combat.getCombatant(update._id).actor;
|
const actor = combat.combatants.get(update._id).actor;
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return false;
|
return false;
|
||||||
return actor.hasPerm(user, "OWNER");
|
return actor.testUserPermission(user, "OWNER");
|
||||||
});
|
});
|
||||||
if (updates.length !== requestedUpdates) {
|
if (updates.length !== requestedUpdates) {
|
||||||
console.warn(`Some of the movement history updates requested by user '${game.users.get(this.socketdata.userId).name}' were not performed because the user lacks owner permissions for those tokens`);
|
console.warn(`Some of the movement history updates requested by user '${game.users.get(this.socketdata.userId).name}' were not performed because the user lacks owner permissions for those tokens`);
|
||||||
@@ -31,7 +31,7 @@ async function _socketUpdateCombatantDragRulerFlags(combatId, updates) {
|
|||||||
updates = updates.map(update => {
|
updates = updates.map(update => {
|
||||||
return {_id: update._id, flags: {dragRuler: update.dragRulerFlags}};
|
return {_id: update._id, flags: {dragRuler: update.dragRulerFlags}};
|
||||||
});
|
});
|
||||||
await combat.updateEmbeddedEntity("Combatant", updates, {diff: false});
|
await combat.updateEmbeddedDocuments("Combatant", updates, {diff: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function recalculate(tokens) {
|
export function recalculate(tokens) {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export class GenericSpeedProvider extends SpeedProvider {
|
|||||||
const speedAttribute = this.getSetting("speedAttribute")
|
const speedAttribute = this.getSetting("speedAttribute")
|
||||||
if (!speedAttribute)
|
if (!speedAttribute)
|
||||||
return []
|
return []
|
||||||
const tokenSpeed = parseInt(getProperty(token, speedAttribute));
|
const tokenSpeed = parseFloat(getProperty(token, speedAttribute));
|
||||||
if (tokenSpeed === undefined) {
|
if (tokenSpeed === undefined) {
|
||||||
console.warn(`Drag Ruler (Generic Speed Provider) | The configured token speed attribute "${speedAttribute}" didn't return a speed value. To use colors based on drag distance set the setting to the correct value (or clear the box to disable this feature).`)
|
console.warn(`Drag Ruler (Generic Speed Provider) | The configured token speed attribute "${speedAttribute}" didn't return a speed value. To use colors based on drag distance set the setting to the correct value (or clear the box to disable this feature).`)
|
||||||
return []
|
return []
|
||||||
|
|||||||
+7
-1
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
export function getDefaultSpeedAttribute() {
|
export function getDefaultSpeedAttribute() {
|
||||||
switch (game.system.id) {
|
switch (game.system.id) {
|
||||||
|
case "CoC7":
|
||||||
|
return "actor.data.data.attribs.mov.value";
|
||||||
case "dcc":
|
case "dcc":
|
||||||
return "actor.data.data.attributes.speed.value";
|
return "actor.data.data.attributes.speed.value";
|
||||||
case "dnd5e":
|
case "dnd5e":
|
||||||
@@ -8,13 +10,14 @@ export function getDefaultSpeedAttribute() {
|
|||||||
case "lancer":
|
case "lancer":
|
||||||
return "actor.data.data.mech.speed"
|
return "actor.data.data.mech.speed"
|
||||||
case "pf1":
|
case "pf1":
|
||||||
|
case "D35E":
|
||||||
return "actor.data.data.attributes.speed.land.total"
|
return "actor.data.data.attributes.speed.land.total"
|
||||||
case "sfrpg":
|
case "sfrpg":
|
||||||
return "actor.data.data.attributes.speed.value";
|
return "actor.data.data.attributes.speed.value";
|
||||||
case "shadowrun5e":
|
case "shadowrun5e":
|
||||||
return "actor.data.data.movement.walk.value";
|
return "actor.data.data.movement.walk.value";
|
||||||
case "swade":
|
case "swade":
|
||||||
return "actor.data.data.stats.speed.value"
|
return "actor.data.data.stats.speed.adjusted";
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -27,9 +30,12 @@ export function getDefaultDashMultiplier() {
|
|||||||
case "dnd5e":
|
case "dnd5e":
|
||||||
case "lancer":
|
case "lancer":
|
||||||
case "pf1":
|
case "pf1":
|
||||||
|
case "D35E":
|
||||||
case "sfrpg":
|
case "sfrpg":
|
||||||
case "shadowrun5e":
|
case "shadowrun5e":
|
||||||
return 2
|
return 2
|
||||||
|
case "CoC7":
|
||||||
|
return 5;
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user