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