Borders: Clean up debug prints
A lot of console logs where left for debugging the scene switch issues. Those issues being fixed now, they are not useful anymore : remove them.
This commit is contained in:
parent
77ae01a7b3
commit
95bb1c3445
1 changed files with 1 additions and 21 deletions
|
@ -87,8 +87,7 @@ function create_new_border(type, width, height, visible) {
|
||||||
function token_set_border_visibility(token, played) {
|
function token_set_border_visibility(token, played) {
|
||||||
// Get the borders we manually added in the `drawToken` hook, if it has any.
|
// Get the borders we manually added in the `drawToken` hook, if it has any.
|
||||||
let borders = token.children.filter((child) => child.borderType);
|
let borders = token.children.filter((child) => child.borderType);
|
||||||
// console.debug("↓↓↓ set_border_visibility ↓↓↓");
|
|
||||||
// console.debug(token)
|
|
||||||
for (let border of borders) {
|
for (let border of borders) {
|
||||||
if (border.borderType === BorderTypes.Active) {
|
if (border.borderType === BorderTypes.Active) {
|
||||||
border.visible = !played;
|
border.visible = !played;
|
||||||
|
@ -96,7 +95,6 @@ function token_set_border_visibility(token, played) {
|
||||||
border.visible = played;
|
border.visible = played;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.debug("↑↑↑ set_border_visibility ↑↑↑");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,8 +125,6 @@ function token_remote_set_border_visibility(scene_id, token_id, played) {
|
||||||
* @returns {boolean} If the token has played in the current or requested round
|
* @returns {boolean} If the token has played in the current or requested round
|
||||||
*/
|
*/
|
||||||
function token_has_played(token, round = -1) {
|
function token_has_played(token, round = -1) {
|
||||||
// console.debug("↓↓↓ token_has_played ↓↓↓");
|
|
||||||
// console.debug(token.inCombat)
|
|
||||||
/**
|
/**
|
||||||
* When we change scene, the token might not be updated with the combat
|
* When we change scene, the token might not be updated with the combat
|
||||||
* data, so we might need to go check ourselves if they are not set.
|
* data, so we might need to go check ourselves if they are not set.
|
||||||
|
@ -166,15 +162,12 @@ function token_has_played(token, round = -1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let round_turns_taken = combat?.flags.projectfu.CombatantsTurnTaken[round < 0 ? combat?.round : round]
|
let round_turns_taken = combat?.flags.projectfu.CombatantsTurnTaken[round < 0 ? combat?.round : round]
|
||||||
// console.debug(`Testing played for round : ${combat?.round}`)
|
|
||||||
console.debug(round_turns_taken)
|
|
||||||
|
|
||||||
// No token has taken a turn, or all turns were reverted.
|
// No token has taken a turn, or all turns were reverted.
|
||||||
if (!round_turns_taken || round_turns_taken.length === 0) {
|
if (!round_turns_taken || round_turns_taken.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.debug("↑↑↑ token_has_played ↑↑↑");
|
|
||||||
// Token might have played, let's search now.
|
// Token might have played, let's search now.
|
||||||
return round_turns_taken.includes(combatant.id)
|
return round_turns_taken.includes(combatant.id)
|
||||||
}
|
}
|
||||||
|
@ -210,7 +203,6 @@ function token_combat_visibility_remote_update(scene_id, token_id, round) {
|
||||||
*/
|
*/
|
||||||
function combat_hook_update_token_borders(combat, data) {
|
function combat_hook_update_token_borders(combat, data) {
|
||||||
// Turns is the array of *tokens having turns in this encounter*.
|
// Turns is the array of *tokens having turns in this encounter*.
|
||||||
// console.debug("↓↓↓ combat_hook_update_token_borders ↓↓↓");
|
|
||||||
for (let combatant of combat.turns) {
|
for (let combatant of combat.turns) {
|
||||||
// The combat passed by the hook is still on the previous round or turn, which would make the check
|
// The combat passed by the hook is still on the previous round or turn, which would make the check
|
||||||
// use the previous round rather than the new one. Use the round contained in data instead,
|
// use the previous round rather than the new one. Use the round contained in data instead,
|
||||||
|
@ -218,7 +210,6 @@ function combat_hook_update_token_borders(combat, data) {
|
||||||
socket.executeForEveryone(SocketMessages.CombatUpdateBorder,
|
socket.executeForEveryone(SocketMessages.CombatUpdateBorder,
|
||||||
combatant.sceneId, combatant.tokenId, data.round).then();
|
combatant.sceneId, combatant.tokenId, data.round).then();
|
||||||
}
|
}
|
||||||
// console.debug("↑↑↑ combat_hook_update_token_borders ↑↑↑");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function combat_border_main() {
|
function combat_border_main() {
|
||||||
|
@ -279,18 +270,9 @@ function combat_border_main() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let has_played_turn = token_has_played(drawn_token);
|
let has_played_turn = token_has_played(drawn_token);
|
||||||
// console.log(drawn_token)
|
|
||||||
// console.log(`Is in combat ? ${drawn_token.inCombat}`)
|
|
||||||
// console.log(`Combatant ? ${drawn_token.combatant}`)
|
|
||||||
// console.log(`Combat ?`)
|
|
||||||
// console.log(drawn_token.combatant.combat);
|
|
||||||
// console.log(game.combats.combats)
|
|
||||||
|
|
||||||
const token_size = drawn_token.getSize();
|
const token_size = drawn_token.getSize();
|
||||||
drawn_token.addChild(create_new_border(BorderTypes.Active, token_size.width, token_size.height, !has_played_turn));
|
drawn_token.addChild(create_new_border(BorderTypes.Active, token_size.width, token_size.height, !has_played_turn));
|
||||||
drawn_token.addChild(create_new_border(BorderTypes.Played, token_size.width, token_size.height, has_played_turn));
|
drawn_token.addChild(create_new_border(BorderTypes.Played, token_size.width, token_size.height, has_played_turn));
|
||||||
|
|
||||||
// console.log("============")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -305,10 +287,8 @@ function combat_border_main() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.debug("↓↓↓ Registering ↓↓↓")
|
|
||||||
Hooks.on("combatTurn", combat_hook_update_token_borders);
|
Hooks.on("combatTurn", combat_hook_update_token_borders);
|
||||||
Hooks.on("combatRound", combat_hook_update_token_borders);
|
Hooks.on("combatRound", combat_hook_update_token_borders);
|
||||||
// console.debug("↑↑↑ Registering ↑↑↑")
|
|
||||||
|
|
||||||
// No Foundry hook on end of combat, so use Fabula Ultima's.
|
// No Foundry hook on end of combat, so use Fabula Ultima's.
|
||||||
Hooks.on(FUHooks.COMBAT_EVENT, (combat_event) => {
|
Hooks.on(FUHooks.COMBAT_EVENT, (combat_event) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue