Ellye

[MV] Default Volume

Sep 21st, 2020
769
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*:
  2.  * @plugindesc Change default volume
  3.  * @author Ellye
  4.  *
  5.  *
  6.  * @param volume
  7.  * @desc Desired default volume
  8.  * @default 40
  9.  */
  10. (function() {
  11.     function toNumber(str, def) {
  12.         return isNaN(str) ? def : +(str || def);
  13.     }
  14.    
  15.     var parameters = PluginManager.parameters('default_volume');
  16.     var volume = toNumber(parameters['volume'], 40);
  17.    
  18.     //Volume padrao
  19.     ConfigManager.readVolume = function(config, name) {
  20.         var value = config[name];
  21.         if (value !== undefined) {
  22.             return Number(value).clamp(0, 100);
  23.         } else {
  24.             return volume;
  25.         }
  26.     };
  27.    
  28. })();
RAW Paste Data