initial commit
This commit is contained in:
commit
7d4feac204
30
LICENSE
Normal file
30
LICENSE
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
Copyright (c) 2021 Revingly. All rights reserved.
|
||||||
|
|
||||||
|
Developed by: Revingly
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation files
|
||||||
|
(the "Software"), to deal with the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge,
|
||||||
|
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimers.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimers in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the names of Ereshkigal, SPT-Aki nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this Software without specific prior written permission.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
|
||||||
|
THE SOFTWARE.
|
44
README.md
Normal file
44
README.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# Choose the weather
|
||||||
|
|
||||||
|
### Choose from the list the weather you want. If you want your own weather setting then please choose 'custom' from the list and then modify the settings to your liking
|
||||||
|
|
||||||
|
If you decided to make your own custom weather settings then please choose values between min and max for each weather config part.
|
||||||
|
|
||||||
|
```json
|
||||||
|
"cloud": {
|
||||||
|
"min": -1.5,
|
||||||
|
"max": 1.5
|
||||||
|
},
|
||||||
|
"wind_speed": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 3
|
||||||
|
},
|
||||||
|
"wind_direction": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 3
|
||||||
|
},
|
||||||
|
"wind_gustiness": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 1
|
||||||
|
},
|
||||||
|
"rain": {
|
||||||
|
"min": 1,
|
||||||
|
"max": 4
|
||||||
|
},
|
||||||
|
"rain_intensity": {
|
||||||
|
"min": 0.1,
|
||||||
|
"max": 1
|
||||||
|
},
|
||||||
|
"fog": {
|
||||||
|
"min": 0.002,
|
||||||
|
"max": 0.15
|
||||||
|
},
|
||||||
|
"temp": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 16
|
||||||
|
},
|
||||||
|
"pressure": {
|
||||||
|
"min": 760,
|
||||||
|
"max": 764
|
||||||
|
}
|
||||||
|
```
|
4
package.js
Normal file
4
package.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
const { Mod } = require("./src/mod.js");
|
||||||
|
|
||||||
|
|
||||||
|
module.exports.mod = new Mod();
|
8
package.json
Normal file
8
package.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "ChooseTheWeather",
|
||||||
|
"author": "Revingly",
|
||||||
|
"license": "License",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"dependencies": {},
|
||||||
|
"main": "package.js"
|
||||||
|
}
|
15
src/config.json
Normal file
15
src/config.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"weatherTypes": ["sunny", "cloudy", "stormy", "custom"],
|
||||||
|
"weather": "stormy",
|
||||||
|
"customSettings": {
|
||||||
|
"cloud": 0,
|
||||||
|
"wind_speed": 0,
|
||||||
|
"wind_direction": 0,
|
||||||
|
"wind_gustiness": 0,
|
||||||
|
"rain": 1,
|
||||||
|
"rain_intensity": 0,
|
||||||
|
"fog": 0.001,
|
||||||
|
"temp": 0,
|
||||||
|
"pressure": 760
|
||||||
|
}
|
||||||
|
}
|
34
src/mod.js
Normal file
34
src/mod.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
class ChooseTheWeather {
|
||||||
|
constructor() {
|
||||||
|
this.mod = "Revingly-BraceTheStorm";
|
||||||
|
Logger.info(`Loading: ${this.mod}`);
|
||||||
|
WeatherController.generateWeather = this.chooseWeather;
|
||||||
|
}
|
||||||
|
|
||||||
|
chooseWeather(data) {
|
||||||
|
// Get the config file for the weather
|
||||||
|
const { weather, customSettings } = require('./config.json');
|
||||||
|
// Get the weather sets to choose from
|
||||||
|
const weatherSets = require('./weatherSet.json');
|
||||||
|
// Put the choosen weather from the config in a variable
|
||||||
|
const choosenWeather = weatherSets[weather];
|
||||||
|
|
||||||
|
// If user choose custom then we loop over the customSettings
|
||||||
|
// and add each property to the data.weather object
|
||||||
|
if (weather === "custom") {
|
||||||
|
Object.entries(customSettings).forEach(([key, value]) => {
|
||||||
|
data.weather[key] = customSettings[key];
|
||||||
|
});
|
||||||
|
} else { // If user select one of the predefined weather sets then we just add it to the data.weather
|
||||||
|
Object.entries(choosenWeather).forEach(([key, value]) => {
|
||||||
|
data.weather[key] = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.Mod = ChooseTheWeather;
|
35
src/weatherSet.json
Normal file
35
src/weatherSet.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"sunny": {
|
||||||
|
"cloud": -0.4,
|
||||||
|
"wind_speed": 0,
|
||||||
|
"wind_direction": 3,
|
||||||
|
"wind_gustiness": 0.022,
|
||||||
|
"rain": 0,
|
||||||
|
"rain_intensity": 0,
|
||||||
|
"fog": 0.004,
|
||||||
|
"temp": 18,
|
||||||
|
"pressure": 760
|
||||||
|
},
|
||||||
|
"cloudy": {
|
||||||
|
"cloud": 0.9,
|
||||||
|
"wind_speed": 1,
|
||||||
|
"wind_direction": 3,
|
||||||
|
"wind_gustiness": 0.5,
|
||||||
|
"rain": 0,
|
||||||
|
"rain_intensity": 0,
|
||||||
|
"fog": 0.02,
|
||||||
|
"temp": 10,
|
||||||
|
"pressure": 762
|
||||||
|
},
|
||||||
|
"stormy": {
|
||||||
|
"cloud": 2,
|
||||||
|
"wind_speed": 4,
|
||||||
|
"wind_direction": 8,
|
||||||
|
"wind_gustiness": 1,
|
||||||
|
"rain": 4,
|
||||||
|
"rain_intensity": 1,
|
||||||
|
"fog": 0.7,
|
||||||
|
"temp": 5,
|
||||||
|
"pressure": 764
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user