Force rain off if clouds are below or equal to 2
This commit is contained in:
parent
a9e13c7238
commit
92c64024eb
@ -79,10 +79,13 @@ export class WeatherGenerator {
|
|||||||
* @returns Randomised weather data
|
* @returns Randomised weather data
|
||||||
*/
|
*/
|
||||||
public generateWeather(): IWeather {
|
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 = {
|
const result: IWeather = {
|
||||||
cloud: this.getWeightedClouds(),
|
cloud: clouds,
|
||||||
wind_speed: this.getWeightedWindSpeed(),
|
wind_speed: this.getWeightedWindSpeed(),
|
||||||
wind_direction: this.getWeightedWindDirection(),
|
wind_direction: this.getWeightedWindDirection(),
|
||||||
wind_gustiness: this.getRandomFloat("windGustiness"),
|
wind_gustiness: this.getRandomFloat("windGustiness"),
|
||||||
|
@ -14,10 +14,12 @@ export interface IWeather {
|
|||||||
temp: number;
|
temp: number;
|
||||||
fog: number;
|
fog: number;
|
||||||
rain_intensity: number;
|
rain_intensity: number;
|
||||||
|
/** 1 - 3 light rain, 3+ 'rain' */
|
||||||
rain: number;
|
rain: number;
|
||||||
wind_gustiness: number;
|
wind_gustiness: number;
|
||||||
wind_direction: WindDirection;
|
wind_direction: WindDirection;
|
||||||
wind_speed: number;
|
wind_speed: number;
|
||||||
|
/** < -0.4 = clear day */
|
||||||
cloud: number;
|
cloud: number;
|
||||||
time: string;
|
time: string;
|
||||||
date: string;
|
date: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user