Update the movement tracking flags in the GM client, becauase the user isn't allowed to modify them

This commit is contained in:
Manuel Vögele
2021-04-14 15:40:59 +02:00
parent 9787a41fd1
commit f7683e8945
3 changed files with 28 additions and 2 deletions
+17
View File
@@ -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});
}