fixe des dés 3d

This commit is contained in:
rwanoux
2024-04-28 23:50:39 +02:00
parent 58d1be4194
commit 9cee590267
2 changed files with 15 additions and 16 deletions
+10 -10
View File
@@ -5,10 +5,10 @@
export async function initUserDice(dice3d, user) {
let baseColor = game.user.color;
let baseColor = user.color;
dice3d.addColorset({
name: 'regular_' + game.user.name,
description: "regular dice for " + game.user.name,
name: 'regular_' + user.name,
description: "regular dice for " + user.name,
category: "vermine 2047",
foreground: '#9F8003',
background: baseColor,
@@ -18,27 +18,27 @@ export async function initUserDice(dice3d, user) {
visibility: 'visible'
});
dice3d.addColorset({
name: 'human_' + game.user.name,
description: "human totem dice for " + game.user.name,
name: 'human_' + user.name,
description: "human totem dice for " + user.name,
category: "vermine 2047",
foreground: '#9F8003',
background: lightenColor(baseColor, 40),
background: lightenColor(baseColor, 60),
outline: 'black',
material: 'plastic',
visibility: 'visible'
});
dice3d.addColorset({
name: 'adapted_' + game.user.name,
description: "adapted totem dice for " + game.user.name,
name: 'adapted_' + user.name,
description: "adapted totem dice for " + user.name,
category: "vermine 2047",
foreground: '#9F8003',
background: darkenColor(baseColor, 40),
background: darkenColor(baseColor, 60),
outline: 'black',
material: 'plastic',
visibility: 'visible'
});
await game.user.setFlag("world", "diceInit", true);
await user.setFlag("world", "diceInit", true);
}
export function darkenColor(color, percent) {
+5 -6
View File
@@ -30,7 +30,9 @@ export const registerHooks = function () {
});
game.users.forEach(user => initUserDice(dice3d, user));
game.users.forEach(user => {
initUserDice(dice3d, user)
});
});
@@ -44,9 +46,9 @@ export const registerHooks = function () {
})
Hooks.on('updateUser', async () => {
Hooks.on('updateUser', async (user, updateData, options, id) => {
if (game.dice3d) {
initUserDice(game.dice3d)
initUserDice(game.dice3d, user)
}
})
@@ -64,9 +66,6 @@ export const registerHooks = function () {
$("#pause.paused figcaption").text("Communauté endormie...");
});
// Hooks.on('renderChatLog', (log, html, data) => VermineFight.chatListeners(html));
// Hooks.on('renderChatMessage', (message, html, data) => VermineFight.chatMessageHandler(message, html, data));
/**
* Create a macro when dropping an entity on the hotbar
* Item - open roll dialog for item