Update the movement tracking flags in the GM client, becauase the user isn't allowed to modify them
This commit is contained in:
+9
-1
@@ -13,7 +13,8 @@
|
||||
}
|
||||
],
|
||||
"esmodules": [
|
||||
"src/main.js"
|
||||
"src/main.js",
|
||||
"src/socket.js"
|
||||
],
|
||||
"templates": [
|
||||
"speed_provider_settings.html"
|
||||
@@ -40,6 +41,13 @@
|
||||
"path": "lang/zh-tw.json"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "socketlib",
|
||||
"manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-socketlib/master/module.json"
|
||||
}
|
||||
],
|
||||
"socket": true,
|
||||
"url": "https://github.com/manuelVo/foundryvtt-drag-ruler",
|
||||
"download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.4.6.zip",
|
||||
"manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {measureDistances} from "./compatibility.js";
|
||||
import {updateCombatantDragRulerFlags} from "./socket.js";
|
||||
import {getTokenShape} from "./util.js";
|
||||
|
||||
function initTrackingFlag(combatant) {
|
||||
@@ -54,7 +55,7 @@ export async function trackRays(token, rays) {
|
||||
waypoints.push(ray.A);
|
||||
}
|
||||
}
|
||||
await combat.updateEmbeddedEntity("Combatant", {_id: combatant._id, flags: combatant.flags}, {diff: false});
|
||||
await updateCombatantDragRulerFlags(combat, combatant, dragRulerFlags);
|
||||
}
|
||||
|
||||
export function getMovementHistory(token) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
let socket;
|
||||
|
||||
Hooks.once("socketlib.ready", () => {
|
||||
socket = socketlib.registerModule("drag-ruler");
|
||||
socket.register("updateCombatantDragRulerFlags", _socketUpdateCombatantDragRulerFlags);
|
||||
});
|
||||
|
||||
export async function updateCombatantDragRulerFlags(combat, combatant, flags) {
|
||||
const combatId = combat.id;
|
||||
const combatantId = combatant._id;
|
||||
return socket.executeAsGM(_socketUpdateCombatantDragRulerFlags, combatId, combatantId, flags);
|
||||
}
|
||||
|
||||
async function _socketUpdateCombatantDragRulerFlags(combatId, combatantId, flags) {
|
||||
const combat = game.combats.get(combatId);
|
||||
return combat.updateEmbeddedEntity("Combatant", {_id: combatantId, flags: {dragRuler: flags}}, {diff: false});
|
||||
}
|
||||
Reference in New Issue
Block a user