Force rain off if clouds are below or equal to 2

This commit is contained in:
Dev 2024-09-29 16:51:04 +01:00
parent a9e13c7238
commit 92c64024eb
2 changed files with 7 additions and 2 deletions

View File

@ -79,10 +79,13 @@ export class WeatherGenerator {
* @returns Randomised weather data
*/
public generateWeather(): IWeather {
const rain = this.getWeightedRain();
const clouds = this.getWeightedClouds();
// Force rain to off if no clouds
const rain = clouds <= 2 ? 1 : this.getWeightedRain();
const result: IWeather = {
cloud: this.getWeightedClouds(),
cloud: clouds,
wind_speed: this.getWeightedWindSpeed(),
wind_direction: this.getWeightedWindDirection(),
wind_gustiness: this.getRandomFloat("windGustiness"),

View File

@ -14,10 +14,12 @@ export interface IWeather {
temp: number;
fog: number;
rain_intensity: number;
/** 1 - 3 light rain, 3+ 'rain' */
rain: number;
wind_gustiness: number;
wind_direction: WindDirection;
wind_speed: number;
/** < -0.4 = clear day */
cloud: number;
time: string;
date: string;