From ad00a3f70007d780728c3e724086b4b72769e30b Mon Sep 17 00:00:00 2001 From: sladecraven Date: Tue, 12 Jan 2021 20:58:30 +0100 Subject: [PATCH] #93 - Option de controle des bruitages --- module/rdd-audio.js | 12 +++++++----- module/rdd-main.js | 11 +++++++++-- module/rdd-utility.js | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/module/rdd-audio.js b/module/rdd-audio.js index 1b3d6e18..28dfaa67 100644 --- a/module/rdd-audio.js +++ b/module/rdd-audio.js @@ -9,11 +9,13 @@ export class RdDAudio { /* -------------------------------------------- */ static PlayContextAudio(context) { - let audioData = context2file[context]; - if ( audioData ) { - let audioPath = "systems/foundryvtt-reve-de-dragon/sounds/" + audioData.file; - console.log(`wfrp4e | Playing Sound: ${audioPath}`) - AudioHelper.play({ src: audioPath }, audioData.isGlobal); + if (game.settings.get("foundryvtt-reve-de-dragon", "activer-sons-audio") ) { + let audioData = context2file[context]; + if ( audioData ) { + let audioPath = "systems/foundryvtt-reve-de-dragon/sounds/" + audioData.file; + console.log(`wfrp4e | Playing Sound: ${audioPath}`) + AudioHelper.play({ src: audioPath }, audioData.isGlobal); + } } } } diff --git a/module/rdd-main.js b/module/rdd-main.js index 892866e5..18be45a1 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -171,8 +171,15 @@ Hooks.once("init", async function() { default: true, type: Boolean }); - - //game.settings.get("","") to retrieve it and game.settings.set("","", ) + /* -------------------------------------------- */ + game.settings.register("foundryvtt-reve-de-dragon", "activer-sons-audio", { + name: "Activer les bruitages intégrés", + hint: "Si activé, certaines actions en jeu déclenchent un son d'ambiance", + scope: "world", + config: true, + default: true, + type: Boolean + }); /* -------------------------------------------- */ // Set an initiative formula for the system diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 3d930c7d..f3dcea1d 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -60,7 +60,7 @@ const taille2derivee = { 1: { poids: "moins de 1kg", plusdom:-5, sconst: 0.5, s 30: { poids: "901-1000", plusdom:+9, sconst: 10, sust: 15 }, 31: { poids: "1001-1500", plusdom:+10, sconst: 10, sust: 16 }, 32: { poids: "1501-2000", plusdom:+11, sconst: 10, sust: 17 } - } + }; /* -------------------------------------------- */ function _buildAllSegmentsFatigue(max) {