Use elements by type util, fix snow initial state

This commit is contained in:
Vortrex
2021-11-28 22:43:16 -06:00
parent 9a53a2db76
commit dd4fb00fd0

View File

@@ -311,7 +311,7 @@ function clearLocalPlayerWeapons() {
// ===========================================================================
function getClosestVehicle(pos) {
return getVehicles().reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
return getElementsByType(ELEMENT_VEHICLE).reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
}
// ===========================================================================
@@ -352,12 +352,10 @@ function setLocalPlayerInterior(interior) {
function setSnowState(falling, ground) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
if(!isNull(snowing)) {
if(ground == true) {
forceSnowing(ground);
} else {
snowing = falling;
}
snowing = falling;
if(ground) {
forceSnowing(false);
forceSnowing(ground);
}
}