Adjusted weather values

Reduced chance of fog
Reduced chance of constant cloud
Adjusted when rain is allowed to occur relative to cloud cover
Adding temp values for new seasons
This commit is contained in:
Dev 2024-11-10 22:54:11 +00:00
parent f16c145523
commit a06a3cfbfc
2 changed files with 28 additions and 8 deletions

View File

@ -3,8 +3,8 @@
"weather": {
"generateWeatherAmountHours": 24,
"clouds": {
"values": [-1, 0.03, 0, 0.5, 1],
"weights": [100, 22, 15, 5, 4]
"values": [-1, -0.8, -0.5, 0.1, 0, 0.15, 0.4, 1],
"weights": [100, 22, 22, 15, 15, 15, 5, 4]
},
"windSpeed": {
"values": [0, 1, 2, 3, 4],
@ -27,7 +27,7 @@
"max": 1
},
"fog": {
"values": [0.002, 0.004, 0.008, 0.012, 0.087],
"values": [0.0013, 0.0018, 0.002, 0.004, 0.006],
"weights": [35, 6, 4, 3, 1]
},
"temp": {
@ -72,6 +72,26 @@
}
},
"4": {
"day": {
"min": 3,
"max": 11
},
"night": {
"min": -2,
"max": 8
}
},
"5": {
"day": {
"min": -4,
"max": 7
},
"night": {
"min": -10,
"max": 3
}
},
"6": {
"day": {
"min": 0,
"max": 24

View File

@ -83,17 +83,17 @@ export class WeatherGenerator {
const clouds = this.getWeightedClouds();
// Force rain to off if no clouds
const rain = clouds <= 2 ? 1 : this.getWeightedRain();
const rain = clouds <= 0.6 ? 0 : this.getWeightedRain();
const result: IWeather = {
cloud: clouds,
wind_speed: this.getWeightedWindSpeed(),
wind_direction: this.getWeightedWindDirection(),
wind_gustiness: this.getRandomFloat("windGustiness"),
wind_gustiness: this.getRandomFloat("windGustiness", 2),
rain: rain,
rain_intensity: rain > 1 ? this.getRandomFloat("rainIntensity") : 0,
fog: this.getWeightedFog(),
temp: 0, // TODO - lower value at night / take into account season
temp: 0,
pressure: this.getRandomFloat("pressure"),
time: "",
date: "",
@ -177,11 +177,11 @@ export class WeatherGenerator {
).item;
}
protected getRandomFloat(node: string): number {
protected getRandomFloat(node: string, precision = 3): number {
return Number.parseFloat(
this.randomUtil
.getFloat(this.weatherConfig.weather[node].min, this.weatherConfig.weather[node].max)
.toPrecision(3),
.toPrecision(precision),
);
}
}