change the methods to be static

This commit is contained in:
Rev 2021-06-19 18:13:20 +09:00
parent ebe0eb7ba6
commit 834628ff0b

View File

@ -1,13 +1,14 @@
"use strict"; "use strict";
class ChooseTheWeather { class ChooseTheWeather {
constructor() { static modName = "Revingly-ChooseTheWeather";
this.mod = "Revingly-BraceTheStorm";
Logger.info(`Loading: ${this.mod}`); static init() {
WeatherController.generateWeather = this.chooseWeather.bind(this); Logger.info(`Loading: ${ChooseTheWeather.modName}`);
WeatherController.generateWeather = ChooseTheWeather.generate;
} }
chooseWeather(data) { static generate(data) {
// Get the config file for the weather // Get the config file for the weather
const { weatherTypes, weather, random, overrides} = require('./config.json'); const { weatherTypes, weather, random, overrides} = require('./config.json');
// Get the weather sets to choose from // Get the weather sets to choose from
@ -28,16 +29,16 @@ class ChooseTheWeather {
} }
} }
this.createWeather(choosenWeather, data); ChooseTheWeather.createWeather(choosenWeather, data);
return data; return data;
} }
createWeather(choosenWeather, data) { static createWeather(choosenWeather, data) {
Object.entries(choosenWeather).forEach(([key, value]) => { Object.entries(choosenWeather).forEach(([key, value]) => {
data.weather[key] = value; data.weather[key] = value;
}); });
} }
} }
module.exports.Mod = ChooseTheWeather; module.exports.ChooseTheWeather = ChooseTheWeather;