forked from noxious/server
Weather values randomized if no number is given as a command argument
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user