Chance of snow by month

This commit is contained in:
Vortrex
2022-10-25 22:40:44 -05:00
parent 49dd7c0e21
commit ee4d4e3621
2 changed files with 19 additions and 2 deletions

View File

@@ -246,6 +246,7 @@ let globalConfig = {
fishingCastMaxStrength: 100,
fishingCastMinStrength: 30,
jobRouteLocationSphereRadius: 3,
monthlyChanceOfSnow: [90, 50, 10, 0, 0, 0, 0, 0, 0, 0, 50, 90],
};
// ===========================================================================

View File

@@ -133,8 +133,13 @@ function thirtyMinuteTimerFunction() {
if (getClients().length > 0) {
checkPayDays();
}
saveServerDataToDatabase();
if (isGameFeatureSupported("snow")) {
checkSnowChance();
}
checkInactiveVehicleRespawns();
saveServerDataToDatabase();
}
// ===========================================================================
@@ -262,7 +267,7 @@ function checkServerGameTime() {
game.time.minute = getServerConfig().minute;
}
updateTimeRule();
updateServerRules();
}
// ===========================================================================
@@ -336,3 +341,14 @@ function checkInactiveVehicleRespawns() {
}
// ===========================================================================
function checkSnowChance() {
let date = new Date();
let shouldBeSnowing = getRandomBoolWithProbability(getGlobalConfig().monthlyChanceOfSnow[date.getMonths()]);
getServerConfig().groundSnow = shouldBeSnowing;
getServerConfig().fallingSnow = shouldBeSnowing;
updatePlayerSnowState(null);
}
// ===========================================================================