Moved function to better location
This commit is contained in:
parent
953acb47a0
commit
ec825d990c
@ -106,21 +106,23 @@ export class WeatherGenerator {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Choose a temprature for the raid based on time of day and current season
|
||||
* @param currentSeason What season tarkov is currently in
|
||||
* @param inRaidTimestamp What time is the raid running at
|
||||
* @returns Timestamp
|
||||
*/
|
||||
protected getRaidTemperature(currentSeason: Season, inRaidTimestamp: number): number {
|
||||
// Convert timestamp to date so we can get current hour and check if its day or night
|
||||
const currentRaidTime = new Date(inRaidTimestamp);
|
||||
const seasonDayNightTempValues = this.weatherConfig.weather.temp[currentSeason];
|
||||
const minMax = this.isNightTime(currentRaidTime.getHours())
|
||||
const minMax = this.weatherHelper.isHourAtNightTime(currentRaidTime.getHours())
|
||||
? seasonDayNightTempValues.night
|
||||
: seasonDayNightTempValues.day;
|
||||
|
||||
return Number.parseFloat(this.randomUtil.getFloat(minMax.min, minMax.max).toPrecision(2));
|
||||
}
|
||||
|
||||
protected isNightTime(currentHour: number) {
|
||||
return currentHour > 21 && currentHour <= 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set IWeather date/time/timestamp values to now
|
||||
* @param weather Object to update
|
||||
|
@ -52,4 +52,8 @@ export class WeatherHelper {
|
||||
// Night if after 9pm or before 5am
|
||||
return time.getHours() > 21 || time.getHours() < 5;
|
||||
}
|
||||
|
||||
public isHourAtNightTime(currentHour: number) {
|
||||
return currentHour > 21 && currentHour <= 5;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user