Bunch of stuff

This commit is contained in:
Vortrex
2022-05-12 16:41:32 -05:00
parent 5e075e25f9
commit 0543a58597
16 changed files with 265 additions and 334 deletions

View File

@@ -15,4 +15,48 @@ function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2,
}
}
// ===========================================================================
function processVehiclePurchasing() {
if(vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
if(getLocalPlayerVehicle() == false) {
vehiclePurchaseState = VRR_VEHBUYSTATE_EXITVEH;
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_EXITVEH);
return false;
} else {
if(vehiclePurchasing == getLocalPlayerVehicle()) {
if(getDistance(getLocalPlayerVehicle().position, vehiclePurchasePosition) >= 25) {
vehiclePurchaseState = VRR_VEHBUYSTATE_FARENOUGH;
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
}
} else {
vehiclePurchaseState = VRR_VEHBUYSTATE_WRONGVEH;
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
}
}
}
}
// ===========================================================================
function processVehicleBurning() {
getElementsByType(ELEMENT_VEHICLE).filter(vehicle => vehicle.isSyncer && vehicle.health < 250).forEach((vehicle) => {
vehicle.health = 250;
});
}
// ===========================================================================
function setVehiclePurchaseState(state, vehicleId, position) {
vehiclePurchaseState = state;
if(vehicleId != null) {
vehiclePurchasing = getElementFromId(vehicleId);
} else {
vehiclePurchasing = null;
}
vehiclePurchasePosition = position;
}
// ===========================================================================