1
0
forked from noxious/server

Weather values randomized if no number is given as a command argument

This commit is contained in:
2025-01-23 13:42:26 -06:00
parent d7ac70662a
commit edb7836e55
3 changed files with 19 additions and 10 deletions

View File

@ -48,18 +48,18 @@ class WeatherManager {
}
}
public async setRainValue(value? : number): Promise<void> {
if (value === undefined) {
value = this.weatherState.rainPercentage > 0 ? 0 : this.randomWeatherValue('rain')
public async setRainValue(value : number | null): Promise<void> {
if (value === null) {
value = this.randomWeatherValue('rain')
}
this.updateWeatherProperty('rain', value)
await this.saveAndEmitWeather()
}
public async setFogValue(value? : number): Promise<void> {
if (value === undefined) {
value = this.weatherState.fogDensity > 0 ? 0 : this.randomWeatherValue('fog')
public async setFogValue(value : number | null): Promise<void> {
if (value === null) {
value = this.randomWeatherValue('fog')
}
this.updateWeatherProperty('fog', value)
@ -127,7 +127,7 @@ class WeatherManager {
let world = await worldRepository.getFirst()
if (!world) world = new World()
//left them in here because the
//the data model still contains the booleans
await world
.setRainPercentage(this.weatherState.rainPercentage)
.setIsRainEnabled(this.weatherState.rainPercentage > 0)