Lots of changes

* Add optional offset for some anims (like sitting)
* Fix int/vw chat check not working
* Disable ambience utils for now
* Add ped stop anim util
* Fix enter veh messages
* Fix radio stream not stopping when exiting vehicle
* Fix job items bugging out
* Don't save job equipment items
* Switch to inactive item slot when going on/off duty
* Fix gotospawn not working with int/vw
* Added anims for offset use
* Added element ID & syncer utils
* Fixed wrong job name being shown when setting job vehicle rank
* Added anim move type constants
* Added element collision net events
* Added is any GUI active util
* Fixed showing player list when a GUI is active
This commit is contained in:
Vortrex
2021-09-13 07:22:00 -05:00
parent cfc22a77ee
commit acfc788371
17 changed files with 319 additions and 134 deletions

View File

@@ -99,6 +99,7 @@ function onProcess(event, deltaTime) {
function onKeyUp(event, keyCode, scanCode, keyModifiers) {
processSkinSelectKeyPress(keyCode);
//processKeyDuringAnimation();
}
// ===========================================================================

View File

@@ -1139,6 +1139,46 @@ let switchCharacterSelect = function(firstName, lastName, cash, clan, lastPlayed
characterSelect.window.shown = true;
}
let isAnyGUIActive = function() {
if(infoDialog.window.shown) {
return true;
}
if(yesNoDialog.window.shown) {
return true;
}
if(errorDialog.window.shown) {
return true;
}
if(register.window.shown) {
return true;
}
if(login.window.shown) {
return true;
}
if(newCharacter.window.shown) {
return true;
}
if(characterSelect.window.shown) {
return true;
}
if(twoFactorAuth.window.shown) {
return true;
}
if(listDialog.window.shown) {
return true;
}
return false;
}
// ===========================================================================
addNetworkHandler("vrr.showLogin", function() {

View File

@@ -47,6 +47,7 @@ let streamingRadioElement = false;
let enterPropertyKey = null;
let inAnimation = false;
let forcedAnimation = null;
let calledDeathEvent = false;

View File

@@ -38,6 +38,10 @@ function initScoreBoardListFont() {
// ===========================================================================
function processScoreBoardRendering() {
if(isAnyGUIActive()) {
return false;
}
if(renderScoreBoard) {
if(isKeyDown(SDLK_TAB)) {
if(scoreBoardListFont != null && scoreBoardTitleFont != null) {

View File

@@ -79,12 +79,15 @@ function addAllNetworkHandlers() {
addNetworkHandler("vrr.veh.repair", repairVehicle);
addNetworkHandler("vrr.pedAnim", makePedPlayAnimation);
addNetworkHandler("vrr.pedStopAnim", makePedStopAnimation);
addNetworkHandler("vrr.hideAllGUI", hideAllGUI);
addNetworkHandler("vrr.gameScript", setGameScriptState);
addNetworkHandler("vrr.clientInfo", serverRequestedClientInfo);
addNetworkHandler("vrr.interiorLights", updateInteriorLightsState);
addNetworkHandler("vrr.syncElement", forceSyncElementProperties);
addNetworkHandler("vrr.elementPosition", setElementPosition);
addNetworkHandler("vrr.elementCollisions", setElementCollisionsEnabled);
}
// ===========================================================================
@@ -221,11 +224,24 @@ function setEnterPropertyKey(key) {
function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
if(getGame() < VRR_GAME_GTA_IV) {
if(animType == VRR_ANIMTYPE_ADD) {
getElementFromId(pedId).position = getElementFromId(pedId).position;
if(getGame() == GAME_GTA_VC || getGame() == GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
}
getElementFromId(pedId).addAnimation(animGroup, animId);
if(getElementFromId(pedId) == localPlayer) {
inAnimation = true;
setLocalPlayerControlState(false, false);
localPlayer.collisionsEnabled = false;
}
} else if(animType == VRR_ANIMTYPE_BLEND) {
getElementFromId(pedId).position = getElementFromId(pedId).position;
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
} else if(animType == VRR_ANIMTYPE_MOVEADD) {
getElementFromId(pedId).position = getElementFromId(pedId).position;
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
}
} else {
natives.requestAnims(animGroup);
@@ -281,4 +297,31 @@ function forceSyncElementProperties(elementId) {
syncElementProperties(getElementFromId(elementId));
}
// ===========================================================================
function setElementPosition(elementId, position) {
getElementFromId(elementId).position = position;
}
// ===========================================================================
function setElementCollisionsEnabled(elementId, state) {
getElementFromId(elementId).collisionsEnabled = state;
}
// ===========================================================================
function makePedStopAnimation(pedId) {
if(getGame() == GAME_GTA_VC || getGame() == GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
}
if(getElementFromId(pedId) == localPlayer) {
localPlayer.collisionsEnabled = true;
setLocalPlayerControlState(true, false);
}
}
// ===========================================================================