Offload labels, nametags, mousecam, and scoreboard
This commit is contained in:
2
meta.xml
2
meta.xml
@@ -142,7 +142,7 @@
|
|||||||
<script src="scripts/client/item.js" type="client" language="javascript" />
|
<script src="scripts/client/item.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/job.js" type="client" language="javascript" />
|
<script src="scripts/client/job.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/keybind.js" type="client" language="javascript" />
|
<script src="scripts/client/keybind.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/label.js" type="client" language="javascript" />
|
//<script src="scripts/client/label.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/locale.js" type="client" language="javascript" />
|
<script src="scripts/client/locale.js" type="client" language="javascript" />
|
||||||
<!--<script src="scripts/client/logo.js" type="client" language="javascript" />-->
|
<!--<script src="scripts/client/logo.js" type="client" language="javascript" />-->
|
||||||
<script src="scripts/client/main.js" type="client" language="javascript" />
|
<script src="scripts/client/main.js" type="client" language="javascript" />
|
||||||
|
|||||||
@@ -79,11 +79,11 @@ function onResourceReady(event, resource) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onProcess(event, deltaTime) {
|
function onProcess(event, deltaTime) {
|
||||||
if(localPlayer == null) {
|
if (localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isSpawned) {
|
if (!isSpawned) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,21 +116,21 @@ function onKeyUp(event, keyCode, scanCode, keyModifiers) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onDrawnHUD(event) {
|
function onDrawnHUD(event) {
|
||||||
if(!renderHUD) {
|
if (!renderHUD) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(localPlayer == null) {
|
if (localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
processSmallGameMessageRendering();
|
processSmallGameMessageRendering();
|
||||||
processScoreBoardRendering();
|
//processScoreBoardRendering();
|
||||||
processLabelRendering();
|
processLabelRendering();
|
||||||
processLogoRendering();
|
//processLogoRendering();
|
||||||
processItemActionRendering();
|
processItemActionRendering();
|
||||||
processSkinSelectRendering();
|
processSkinSelectRendering();
|
||||||
processNameTagRendering();
|
//processNameTagRendering();
|
||||||
processInteriorLightsRendering();
|
processInteriorLightsRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ function onLocalPlayerExitedVehicle(event, vehicle, seat) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
|
||||||
sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
if(inVehicleSeat) {
|
if (inVehicleSeat) {
|
||||||
parkedVehiclePosition = false;
|
parkedVehiclePosition = false;
|
||||||
parkedVehicleHeading = false;
|
parkedVehicleHeading = false;
|
||||||
}
|
}
|
||||||
@@ -167,11 +167,11 @@ function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
|
|||||||
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
//if(inVehicleSeat == 0) {
|
//if(inVehicleSeat == 0) {
|
||||||
//setVehicleEngine(vehicle, false);
|
//setVehicleEngine(vehicle, false);
|
||||||
//if(!inVehicle.engine) {
|
//if(!inVehicle.engine) {
|
||||||
// parkedVehiclePosition = inVehicle.position;
|
// parkedVehiclePosition = inVehicle.position;
|
||||||
// parkedVehicleHeading = inVehicle.heading;
|
// parkedVehicleHeading = inVehicle.heading;
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,12 +181,12 @@ function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healt
|
|||||||
//let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
|
//let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
|
||||||
//let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
|
//let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
|
||||||
//logToConsole(LOG_DEBUG, `[VRR.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
//logToConsole(LOG_DEBUG, `[VRR.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
||||||
if(!isNull(damagedEntity) && !isNull(damagerEntity)) {
|
if (!isNull(damagedEntity) && !isNull(damagerEntity)) {
|
||||||
if(damagedEntity.isType(ELEMENT_PLAYER)) {
|
if (damagedEntity.isType(ELEMENT_PLAYER)) {
|
||||||
if(damagedEntity == localPlayer) {
|
if (damagedEntity == localPlayer) {
|
||||||
//if(!weaponDamageEnabled[damagerEntity.name]) {
|
//if(!weaponDamageEnabled[damagerEntity.name]) {
|
||||||
preventDefaultEventAction(event);
|
preventDefaultEventAction(event);
|
||||||
sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
|
sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healt
|
|||||||
|
|
||||||
function onLocalPlayerEnterSphere(event, sphere) {
|
function onLocalPlayerEnterSphere(event, sphere) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
|
||||||
if(sphere == jobRouteLocationSphere) {
|
if (sphere == jobRouteLocationSphere) {
|
||||||
enteredJobRouteSphere();
|
enteredJobRouteSphere();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ function onMouseWheel(event, mouseId, deltaCoordinates, flipped) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onEntityProcess(event, entity) {
|
function onEntityProcess(event, entity) {
|
||||||
if(!isSpawned) {
|
if (!isSpawned) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,34 +12,29 @@
|
|||||||
// CREDITS TO LUCASC190 FOR MAKING THE MOUSE CAMERA
|
// CREDITS TO LUCASC190 FOR MAKING THE MOUSE CAMERA
|
||||||
// WALKING CODE ADDED BY VORTREX
|
// WALKING CODE ADDED BY VORTREX
|
||||||
|
|
||||||
function SetStandardControlsEnabled(bEnabled)
|
function SetStandardControlsEnabled(bEnabled) {
|
||||||
{
|
if (typeof gta == "undefined") {
|
||||||
if(typeof gta == "undefined") {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.standardControls === undefined)
|
if (game.standardControls === undefined) {
|
||||||
{
|
|
||||||
logToConsole(LOG_WARN, "game.standardControls not implemented");
|
logToConsole(LOG_WARN, "game.standardControls not implemented");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
game.standardControls = bEnabled;
|
game.standardControls = bEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetCurrentPlayerIndex()
|
function GetCurrentPlayerIndex() {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetPlayerPed(uiIndex)
|
function GetPlayerPed(uiIndex) {
|
||||||
{
|
|
||||||
if (uiIndex >= 1)
|
if (uiIndex >= 1)
|
||||||
throw new Error("player index out of range");
|
throw new Error("player index out of range");
|
||||||
return localPlayer;
|
return localPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetPedVehicle(pPed)
|
function GetPedVehicle(pPed) {
|
||||||
{
|
|
||||||
return pPed.vehicle;
|
return pPed.vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +44,7 @@ let ENTITYTYPE_PED = 3;
|
|||||||
let ENTITYTYPE_OBJECT = 4;
|
let ENTITYTYPE_OBJECT = 4;
|
||||||
let ENTITYTYPE_DUMMY = 5;
|
let ENTITYTYPE_DUMMY = 5;
|
||||||
|
|
||||||
function GetEntityType(Entity)
|
function GetEntityType(Entity) {
|
||||||
{
|
|
||||||
if (Entity.isType(ELEMENT_BUILDING))
|
if (Entity.isType(ELEMENT_BUILDING))
|
||||||
return ENTITYTYPE_BUILDING;
|
return ENTITYTYPE_BUILDING;
|
||||||
if (Entity.isType(ELEMENT_VEHICLE))
|
if (Entity.isType(ELEMENT_VEHICLE))
|
||||||
@@ -64,79 +58,66 @@ function GetEntityType(Entity)
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetPlaceableMatrix(pPlaceable)
|
function GetPlaceableMatrix(pPlaceable) {
|
||||||
{
|
|
||||||
if (pPlaceable == GetCamera())
|
if (pPlaceable == GetCamera())
|
||||||
return game.cameraMatrix;
|
return game.cameraMatrix;
|
||||||
return pPlaceable.matrix;
|
return pPlaceable.matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetEntityModel(pEntity)
|
function GetEntityModel(pEntity) {
|
||||||
{
|
|
||||||
return pEntity;
|
return pEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetModelBoundingSphere(usModel)
|
function GetModelBoundingSphere(usModel) {
|
||||||
{
|
|
||||||
return [usModel.boundingRadius, usModel.boundingCentre.x, usModel.boundingCentre.y, usModel.boundingCentre.z];
|
return [usModel.boundingRadius, usModel.boundingCentre.x, usModel.boundingCentre.y, usModel.boundingCentre.z];
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetMouseSpeed()
|
function GetMouseSpeed() {
|
||||||
{
|
|
||||||
if (gui.cursorEnabled)
|
if (gui.cursorEnabled)
|
||||||
return [0,0];
|
return [0, 0];
|
||||||
let MouseSpeed = game.getMouseSpeed();
|
let MouseSpeed = game.getMouseSpeed();
|
||||||
return [MouseSpeed.x,-MouseSpeed.y];
|
return [MouseSpeed.x, -MouseSpeed.y];
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetMouseSensitivity()
|
function GetMouseSensitivity() {
|
||||||
{
|
if (game.getMouseSensitivity === undefined) {
|
||||||
if (game.getMouseSensitivity === undefined)
|
|
||||||
{
|
|
||||||
//logToConsole(LOG_ERROR, "game.getMouseSensitivity not implemented");
|
//logToConsole(LOG_ERROR, "game.getMouseSensitivity not implemented");
|
||||||
return [0.0025,0.003];
|
return [0.0025, 0.003];
|
||||||
}
|
}
|
||||||
let MouseSensitivity = game.getMouseSensitivity();
|
let MouseSensitivity = game.getMouseSensitivity();
|
||||||
return [MouseSensitivity.x,MouseSensitivity.y];
|
return [MouseSensitivity.x, MouseSensitivity.y];
|
||||||
}
|
}
|
||||||
|
|
||||||
let GetCamera;
|
let GetCamera;
|
||||||
{
|
{
|
||||||
const Camera = Symbol();
|
const Camera = Symbol();
|
||||||
|
|
||||||
GetCamera = function()
|
GetCamera = function () {
|
||||||
{
|
|
||||||
return Camera;
|
return Camera;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function AreEntityCollisionsEnabled(pEntity)
|
function AreEntityCollisionsEnabled(pEntity) {
|
||||||
{
|
|
||||||
return pEntity.collisionsEnabled;
|
return pEntity.collisionsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetEntityCollisionsEnabled(pEntity, bCollisionsEnabled)
|
function SetEntityCollisionsEnabled(pEntity, bCollisionsEnabled) {
|
||||||
{
|
|
||||||
pEntity.collisionsEnabled = bCollisionsEnabled;
|
pEntity.collisionsEnabled = bCollisionsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ProcessLineOfSight(vecStartX, vecStartY, vecStartZ, vecEndX, vecEndY, vecEndZ, bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera)
|
function ProcessLineOfSight(vecStartX, vecStartY, vecStartZ, vecEndX, vecEndY, vecEndZ, bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera) {
|
||||||
{
|
if (game.processLineOfSight === undefined) {
|
||||||
if (game.processLineOfSight === undefined)
|
|
||||||
{
|
|
||||||
logToConsole(LOG_WARN, "game.processLineOfSight not implemented");
|
logToConsole(LOG_WARN, "game.processLineOfSight not implemented");
|
||||||
return [null];
|
return [null];
|
||||||
}
|
}
|
||||||
let Result = game.processLineOfSight([vecStartX, vecStartY, vecStartZ], [vecEndX, vecEndY, vecEndZ], bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera);
|
let Result = game.processLineOfSight([vecStartX, vecStartY, vecStartZ], [vecEndX, vecEndY, vecEndZ], bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera);
|
||||||
if (Result == null)
|
if (Result == null)
|
||||||
return [null];
|
return [null];
|
||||||
return [Result.position.x, Result.position.y ,Result.position.z, Result.normal.x, Result.normal.y ,Result.normal.z, Result.entity];
|
return [Result.position.x, Result.position.y, Result.position.z, Result.normal.x, Result.normal.y, Result.normal.z, Result.entity];
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetPlaceableMatrix(pPlaceable, mat)
|
function SetPlaceableMatrix(pPlaceable, mat) {
|
||||||
{
|
if (pPlaceable == GetCamera()) {
|
||||||
if (pPlaceable == GetCamera())
|
|
||||||
{
|
|
||||||
game.setCameraMatrix(mat);
|
game.setCameraMatrix(mat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -149,20 +130,17 @@ let GetTickCount;
|
|||||||
{
|
{
|
||||||
let FrameCount = 0;
|
let FrameCount = 0;
|
||||||
|
|
||||||
setInterval(() =>
|
setInterval(() => {
|
||||||
{
|
|
||||||
++FrameCount;
|
++FrameCount;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
let GTAFrameCount = 0;
|
let GTAFrameCount = 0;
|
||||||
|
|
||||||
addEventHandler("OnProcess", (event, deltaTime) =>
|
addEventHandler("OnProcess", (event, deltaTime) => {
|
||||||
{
|
|
||||||
++GTAFrameCount;
|
++GTAFrameCount;
|
||||||
});
|
});
|
||||||
|
|
||||||
GetTickCount = function(bGTA, bFrames)
|
GetTickCount = function (bGTA, bFrames) {
|
||||||
{
|
|
||||||
if (bFrames)
|
if (bFrames)
|
||||||
return bGTA ? GTAFrameCount : FrameCount;
|
return bGTA ? GTAFrameCount : FrameCount;
|
||||||
else
|
else
|
||||||
@@ -170,16 +148,16 @@ let GetTickCount;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function easingSinusoidalInOut(t,b,c,d)//TODO: Move this to MathUtil.js
|
function easingSinusoidalInOut(t, b, c, d)//TODO: Move this to MathUtil.js
|
||||||
{
|
{
|
||||||
return -c/2 * (Math.cos((Math.PI)*t/d) - 1) + b;
|
return -c / 2 * (Math.cos((Math.PI) * t / d) - 1) + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: extract
|
//TODO: extract
|
||||||
|
|
||||||
function applyMultiplierTimeStep(m,t)//TODO: Move this to MathUtil.js
|
function applyMultiplierTimeStep(m, t)//TODO: Move this to MathUtil.js
|
||||||
{
|
{
|
||||||
return Math.max(Math.min(1.0-(1.0-m)*(t),1),0);
|
return Math.max(Math.min(1.0 - (1.0 - m) * (t), 1), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: getOffset
|
//TODO: getOffset
|
||||||
@@ -192,8 +170,7 @@ function applyMultiplierTimeStep(m,t)//TODO: Move this to MathUtil.js
|
|||||||
//TODO: confirm
|
//TODO: confirm
|
||||||
|
|
||||||
const identityMatrix = new Matrix4x4();
|
const identityMatrix = new Matrix4x4();
|
||||||
if (identityMatrix.setIdentity === undefined)
|
if (identityMatrix.setIdentity === undefined) {
|
||||||
{
|
|
||||||
identityMatrix.m11 = 1;
|
identityMatrix.m11 = 1;
|
||||||
identityMatrix.m12 = 0;
|
identityMatrix.m12 = 0;
|
||||||
identityMatrix.m13 = 0;
|
identityMatrix.m13 = 0;
|
||||||
@@ -230,72 +207,62 @@ cameraIdentityMatrix.m42 = 0;
|
|||||||
cameraIdentityMatrix.m43 = 0;
|
cameraIdentityMatrix.m43 = 0;
|
||||||
cameraIdentityMatrix.m44 = 1;
|
cameraIdentityMatrix.m44 = 1;
|
||||||
|
|
||||||
function createMultipliedMatrix()
|
function createMultipliedMatrix() {
|
||||||
{
|
|
||||||
let matrix = new Matrix4x4();
|
let matrix = new Matrix4x4();
|
||||||
matrix.setMultiply.apply(matrix, arguments);
|
matrix.setMultiply.apply(matrix, arguments);
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createXRotationMatrix(x)
|
function createXRotationMatrix(x) {
|
||||||
{
|
|
||||||
let matrix = new Matrix4x4();
|
let matrix = new Matrix4x4();
|
||||||
matrix.setRotateX(x);
|
matrix.setRotateX(x);
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createYRotationMatrix(x)
|
function createYRotationMatrix(x) {
|
||||||
{
|
|
||||||
let matrix = new Matrix4x4();
|
let matrix = new Matrix4x4();
|
||||||
matrix.setRotateY(x);
|
matrix.setRotateY(x);
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createZRotationMatrix(z)
|
function createZRotationMatrix(z) {
|
||||||
{
|
|
||||||
let matrix = new Matrix4x4();
|
let matrix = new Matrix4x4();
|
||||||
matrix.setRotateZ(z);
|
matrix.setRotateZ(z);
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTranslationMatrix(x,y,z)
|
function createTranslationMatrix(x, y, z) {
|
||||||
{
|
|
||||||
let matrix = new Matrix4x4();
|
let matrix = new Matrix4x4();
|
||||||
matrix.setTranslate([x,y,z]);
|
matrix.setTranslate([x, y, z]);
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: createScaleMatrix
|
//TODO: createScaleMatrix
|
||||||
|
|
||||||
function getDotProduct(x,y,z,x2,y2,z2)
|
function getDotProduct(x, y, z, x2, y2, z2) {
|
||||||
{
|
return x * x2 + y * y2 + z * z2;
|
||||||
return x*x2 + y*y2 + z*z2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCrossProduct(x,y,z,x2,y2,z2)
|
function getCrossProduct(x, y, z, x2, y2, z2) {
|
||||||
{
|
return [y * z2 - z * y2, z * x2 - x * z2, x * y2 - y * x2];
|
||||||
return [y*z2-z*y2, z*x2-x*z2, x*y2-y*x2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLength(x,y,z)
|
function getLength(x, y, z) {
|
||||||
{
|
return Math.sqrt(getDotProduct(x, y, z, x, y, z));
|
||||||
return Math.sqrt(getDotProduct(x,y,z,x,y,z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalise(x,y,z)
|
function normalise(x, y, z) {
|
||||||
{
|
let length = getLength(x, y, z);
|
||||||
let length = getLength(x,y,z);
|
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
throw new Error("an attempt was made to normalise a three dimensional vector with a length of zero");
|
throw new Error("an attempt was made to normalise a three dimensional vector with a length of zero");
|
||||||
return [x/length, y/length, z/length];
|
return [x / length, y / length, z / length];
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLookAtLHMatrix(eyeX, eyeY, eyeZ, atX, atY, atZ, upX,upY,upZ)
|
function createLookAtLHMatrix(eyeX, eyeY, eyeZ, atX, atY, atZ, upX, upY, upZ) {
|
||||||
{
|
|
||||||
let matrix = new Matrix4x4();
|
let matrix = new Matrix4x4();
|
||||||
let [lookX, lookY, lookZ] = normalise(atX-eyeX,atY-eyeY,atZ-eyeZ);
|
let [lookX, lookY, lookZ] = normalise(atX - eyeX, atY - eyeY, atZ - eyeZ);
|
||||||
let [rightX, rightY, rightZ] = normalise.apply(null,getCrossProduct(upX,upY,upZ,lookX, lookY, lookZ));
|
let [rightX, rightY, rightZ] = normalise.apply(null, getCrossProduct(upX, upY, upZ, lookX, lookY, lookZ));
|
||||||
[upX,upY,upZ] = getCrossProduct(lookX, lookY, lookZ,rightX, rightY, rightZ);
|
[upX, upY, upZ] = getCrossProduct(lookX, lookY, lookZ, rightX, rightY, rightZ);
|
||||||
matrix.m11 = rightX;
|
matrix.m11 = rightX;
|
||||||
matrix.m12 = rightY;
|
matrix.m12 = rightY;
|
||||||
matrix.m13 = rightZ;
|
matrix.m13 = rightZ;
|
||||||
@@ -323,10 +290,9 @@ function createLookAtLHMatrix(eyeX, eyeY, eyeZ, atX, atY, atZ, upX,upY,upZ)
|
|||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDifferenceBetweenAngles(current,target)
|
function getDifferenceBetweenAngles(current, target) {
|
||||||
{
|
let f = (((target - current) + Math.PI) / (Math.PI * 2));
|
||||||
let f = (((target-current)+Math.PI)/(Math.PI*2));
|
return ((f - Math.floor(f)) * (Math.PI * 2)) - Math.PI;
|
||||||
return ((f-Math.floor(f))*(Math.PI*2))-Math.PI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let easeCamera = false;
|
let easeCamera = false;
|
||||||
@@ -336,46 +302,41 @@ let easeStartPosX, easeStartPosY, easeStartPosZ;
|
|||||||
let easeStartLookX, easeStartLookY, easeStartLookZ;
|
let easeStartLookX, easeStartLookY, easeStartLookZ;
|
||||||
let easeStartUpX, easeStartUpY, easeStartUpZ;
|
let easeStartUpX, easeStartUpY, easeStartUpZ;
|
||||||
|
|
||||||
function getCameraPositionInfo(matrix)
|
function getCameraPositionInfo(matrix) {
|
||||||
{
|
|
||||||
return [matrix.m41, matrix.m42, matrix.m43, matrix.m21, matrix.m22, matrix.m23, matrix.m31, matrix.m32, matrix.m33];
|
return [matrix.m41, matrix.m42, matrix.m43, matrix.m21, matrix.m22, matrix.m23, matrix.m31, matrix.m32, matrix.m33];
|
||||||
}
|
}
|
||||||
|
|
||||||
function startCameraEase()
|
function startCameraEase() {
|
||||||
{
|
|
||||||
easeCamera = true;
|
easeCamera = true;
|
||||||
easeStartTicks = GetTickCount(true,false);
|
easeStartTicks = GetTickCount(true, false);
|
||||||
easeDuration = 1000;
|
easeDuration = 1000;
|
||||||
let matrix = GetPlaceableMatrix(GetCamera());
|
let matrix = GetPlaceableMatrix(GetCamera());
|
||||||
[easeStartPosX, easeStartPosY, easeStartPosZ, easeStartLookX, easeStartLookY, easeStartLookZ, easeStartUpX, easeStartUpY, easeStartUpZ] = getCameraPositionInfo(matrix);
|
[easeStartPosX, easeStartPosY, easeStartPosZ, easeStartLookX, easeStartLookY, easeStartLookZ, easeStartUpX, easeStartUpY, easeStartUpZ] = getCameraPositionInfo(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyCameraEase(matrix)
|
function applyCameraEase(matrix) {
|
||||||
{
|
|
||||||
if (!easeCamera)
|
if (!easeCamera)
|
||||||
return matrix;
|
return matrix;
|
||||||
let ease = (GetTickCount(true,false)-easeStartTicks)/easeDuration;
|
let ease = (GetTickCount(true, false) - easeStartTicks) / easeDuration;
|
||||||
if (ease < 1)
|
if (ease < 1) {
|
||||||
{
|
ease = easingSinusoidalInOut(ease, 0, 1, 1);
|
||||||
ease = easingSinusoidalInOut(ease,0,1,1);
|
|
||||||
let [newPosX, newPosY, newPosZ, newLookX, newLookY, newLookZ, newUpX, newUpY, newUpZ] = getCameraPositionInfo(matrix);
|
let [newPosX, newPosY, newPosZ, newLookX, newLookY, newLookZ, newUpX, newUpY, newUpZ] = getCameraPositionInfo(matrix);
|
||||||
let easePosX = easeStartPosX+(newPosX-easeStartPosX)*ease;
|
let easePosX = easeStartPosX + (newPosX - easeStartPosX) * ease;
|
||||||
let easePosY = easeStartPosY+(newPosY-easeStartPosY)*ease;
|
let easePosY = easeStartPosY + (newPosY - easeStartPosY) * ease;
|
||||||
let easePosZ = easeStartPosZ+(newPosZ-easeStartPosZ)*ease;
|
let easePosZ = easeStartPosZ + (newPosZ - easeStartPosZ) * ease;
|
||||||
let easeLookX = easeStartLookX+(newLookX-easeStartLookX)*ease;
|
let easeLookX = easeStartLookX + (newLookX - easeStartLookX) * ease;
|
||||||
let easeLookY = easeStartLookY+(newLookY-easeStartLookY)*ease;
|
let easeLookY = easeStartLookY + (newLookY - easeStartLookY) * ease;
|
||||||
let easeLookZ = easeStartLookZ+(newLookZ-easeStartLookZ)*ease;
|
let easeLookZ = easeStartLookZ + (newLookZ - easeStartLookZ) * ease;
|
||||||
let easeUpX = easeStartUpX+(newUpX-easeStartUpX)*ease;
|
let easeUpX = easeStartUpX + (newUpX - easeStartUpX) * ease;
|
||||||
let easeUpY = easeStartUpY+(newUpY-easeStartUpY)*ease;
|
let easeUpY = easeStartUpY + (newUpY - easeStartUpY) * ease;
|
||||||
let easeUpZ = easeStartUpZ+(newUpZ-easeStartUpZ)*ease;
|
let easeUpZ = easeStartUpZ + (newUpZ - easeStartUpZ) * ease;
|
||||||
return createLookAtLHMatrix(easePosX,easePosY,easePosZ,easePosX+easeLookX,easePosY+easeLookY,easePosZ+easeLookZ,easeUpX,easeUpY,easeUpZ);
|
return createLookAtLHMatrix(easePosX, easePosY, easePosZ, easePosX + easeLookX, easePosY + easeLookY, easePosZ + easeLookZ, easeUpX, easeUpY, easeUpZ);
|
||||||
}
|
}
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isCameraEasing()
|
function isCameraEasing() {
|
||||||
{
|
return easeCamera && GetTickCount(true, false) < (easeStartTicks + easeDuration);
|
||||||
return easeCamera && GetTickCount(true,false) < (easeStartTicks+easeDuration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let oldCameraTarget = null;
|
let oldCameraTarget = null;
|
||||||
@@ -383,14 +344,12 @@ let OldPosition = null;//2019 Lucas was here!
|
|||||||
let cameraRotZ;
|
let cameraRotZ;
|
||||||
let cameraRotY;
|
let cameraRotY;
|
||||||
|
|
||||||
function getCameraTarget()
|
function getCameraTarget() {
|
||||||
{
|
|
||||||
let playerPed = GetPlayerPed(GetCurrentPlayerIndex());
|
let playerPed = GetPlayerPed(GetCurrentPlayerIndex());
|
||||||
let vehicle = GetPedVehicle(playerPed);
|
let vehicle = GetPedVehicle(playerPed);
|
||||||
if (vehicle != null)
|
if (vehicle != null)
|
||||||
return vehicle;
|
return vehicle;
|
||||||
if (playerPed != null)
|
if (playerPed != null) {
|
||||||
{
|
|
||||||
//if (playerPed.health <= 1)//Breaks because of fade//2019 Lucas was here!
|
//if (playerPed.health <= 1)//Breaks because of fade//2019 Lucas was here!
|
||||||
// return null;
|
// return null;
|
||||||
return playerPed;
|
return playerPed;
|
||||||
@@ -398,59 +357,52 @@ function getCameraTarget()
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRelativeToTarget(target)
|
function isRelativeToTarget(target) {
|
||||||
{
|
|
||||||
if (GetEntityType(target) == ENTITYTYPE_PED)
|
if (GetEntityType(target) == ENTITYTYPE_PED)
|
||||||
return false;
|
return false;
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
function isClipped(target)
|
function isClipped(target) {
|
||||||
{
|
|
||||||
if (GetEntityType(target) == ENTITYTYPE_PED)
|
if (GetEntityType(target) == ENTITYTYPE_PED)
|
||||||
return true;
|
return true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//2019 Lucas was here!
|
//2019 Lucas was here!
|
||||||
function ShouldReturnToRestRotation(Target)
|
function ShouldReturnToRestRotation(Target) {
|
||||||
{
|
|
||||||
if (GetEntityType(Target) == ENTITYTYPE_PED)
|
if (GetEntityType(Target) == ENTITYTYPE_PED)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCameraRestRotation(target)
|
function getCameraRestRotation(target) {
|
||||||
{
|
|
||||||
let targetMatrix = GetPlaceableMatrix(target);
|
let targetMatrix = GetPlaceableMatrix(target);
|
||||||
let rotZ;
|
let rotZ;
|
||||||
if (isRelativeToTarget(target))
|
if (isRelativeToTarget(target))
|
||||||
rotZ = 0;
|
rotZ = 0;
|
||||||
else
|
else
|
||||||
rotZ = -Math.atan2(targetMatrix.m21,targetMatrix.m22);
|
rotZ = -Math.atan2(targetMatrix.m21, targetMatrix.m22);
|
||||||
let rotY = -0.2;
|
let rotY = -0.2;
|
||||||
return [rotZ, rotY];
|
return [rotZ, rotY];
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetCameraRotation()
|
function resetCameraRotation() {
|
||||||
{
|
|
||||||
[cameraRotZ, cameraRotY] = getCameraRestRotation(getCameraTarget());
|
[cameraRotZ, cameraRotY] = getCameraRestRotation(getCameraTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
//2019 Lucas was here!
|
//2019 Lucas was here!
|
||||||
let DeltaTime = 0;
|
let DeltaTime = 0;
|
||||||
addEventHandler("OnProcess", (event, deltaTime) =>
|
addEventHandler("OnProcess", (event, deltaTime) => {
|
||||||
{
|
|
||||||
DeltaTime = deltaTime;
|
DeltaTime = deltaTime;
|
||||||
if(!localPlayer) {
|
if (!localPlayer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let IdleTime = 0;//2019 Lucas was here!
|
let IdleTime = 0;//2019 Lucas was here!
|
||||||
|
|
||||||
function processReturnToRestRotation()
|
function processReturnToRestRotation() {
|
||||||
{
|
|
||||||
//resetCameraRotation();//2019 Lucas was here!
|
//resetCameraRotation();//2019 Lucas was here!
|
||||||
|
|
||||||
//2019 Lucas was here!
|
//2019 Lucas was here!
|
||||||
@@ -458,37 +410,32 @@ function processReturnToRestRotation()
|
|||||||
if (!ShouldReturnToRestRotation(Target))
|
if (!ShouldReturnToRestRotation(Target))
|
||||||
return;
|
return;
|
||||||
IdleTime += DeltaTime;
|
IdleTime += DeltaTime;
|
||||||
if (IdleTime > 1.5)
|
if (IdleTime > 1.5) {
|
||||||
{
|
|
||||||
let Velocity = Target.velocity;
|
let Velocity = Target.velocity;
|
||||||
let Matrix = Target.matrix;
|
let Matrix = Target.matrix;
|
||||||
let Speed = getDotProduct(Velocity.x,Velocity.y,Velocity.z,Matrix.getElement(1*4+0),Matrix.getElement(1*4+1),Matrix.getElement(1*4+2));
|
let Speed = getDotProduct(Velocity.x, Velocity.y, Velocity.z, Matrix.getElement(1 * 4 + 0), Matrix.getElement(1 * 4 + 1), Matrix.getElement(1 * 4 + 2));
|
||||||
let AbsSpeed = Math.abs(Speed);
|
let AbsSpeed = Math.abs(Speed);
|
||||||
let Multiplier = Math.min(AbsSpeed/0.75, 1);
|
let Multiplier = Math.min(AbsSpeed / 0.75, 1);
|
||||||
if (Multiplier != 0)
|
if (Multiplier != 0) {
|
||||||
{
|
|
||||||
let [TargetCameraRotZ2, TargetCameraRotY2] = getCameraRestRotation(Target);
|
let [TargetCameraRotZ2, TargetCameraRotY2] = getCameraRestRotation(Target);
|
||||||
if (Speed < 0)
|
if (Speed < 0)
|
||||||
TargetCameraRotZ2 += Math.PI;
|
TargetCameraRotZ2 += Math.PI;
|
||||||
let TimeStep = game.timeStep/50*60;
|
let TimeStep = game.timeStep / 50 * 60;
|
||||||
cameraRotZ += getDifferenceBetweenAngles(cameraRotZ,TargetCameraRotZ2)*applyMultiplierTimeStep(1/20,TimeStep)*Multiplier;
|
cameraRotZ += getDifferenceBetweenAngles(cameraRotZ, TargetCameraRotZ2) * applyMultiplierTimeStep(1 / 20, TimeStep) * Multiplier;
|
||||||
cameraRotY += getDifferenceBetweenAngles(cameraRotY,TargetCameraRotY2)*applyMultiplierTimeStep(1/20,TimeStep)*Multiplier;
|
cameraRotY += getDifferenceBetweenAngles(cameraRotY, TargetCameraRotY2) * applyMultiplierTimeStep(1 / 20, TimeStep) * Multiplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelReturnToRestRotation()
|
function cancelReturnToRestRotation() {
|
||||||
{
|
|
||||||
IdleTime = 0;//2019 Lucas was here!
|
IdleTime = 0;//2019 Lucas was here!
|
||||||
}
|
}
|
||||||
|
|
||||||
let distance;
|
let distance;
|
||||||
let zIncrease;
|
let zIncrease;
|
||||||
|
|
||||||
function getCameraOffsetInfo(target)
|
function getCameraOffsetInfo(target) {
|
||||||
{
|
if (GetEntityType(target) == ENTITYTYPE_PED) {
|
||||||
if (GetEntityType(target) == ENTITYTYPE_PED)
|
|
||||||
{
|
|
||||||
let distance = 4;
|
let distance = 4;
|
||||||
let zIncrease = 0.8;
|
let zIncrease = 0.8;
|
||||||
let offsetX = 0;
|
let offsetX = 0;
|
||||||
@@ -507,8 +454,7 @@ function getCameraOffsetInfo(target)
|
|||||||
let offsetX;
|
let offsetX;
|
||||||
let offsetY;
|
let offsetY;
|
||||||
let offsetZ;
|
let offsetZ;
|
||||||
if (radius <= 3.0535011291504)
|
if (radius <= 3.0535011291504) {
|
||||||
{
|
|
||||||
minDistance = 4;
|
minDistance = 4;
|
||||||
maxDistance = 8;
|
maxDistance = 8;
|
||||||
minZIncrease = 0.5;
|
minZIncrease = 0.5;
|
||||||
@@ -516,8 +462,7 @@ function getCameraOffsetInfo(target)
|
|||||||
minRadius = 2;
|
minRadius = 2;
|
||||||
maxRadius = 3.0535011291504;
|
maxRadius = 3.0535011291504;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
minDistance = 8;
|
minDistance = 8;
|
||||||
maxDistance = 16;
|
maxDistance = 16;
|
||||||
minZIncrease = 1;
|
minZIncrease = 1;
|
||||||
@@ -528,66 +473,59 @@ function getCameraOffsetInfo(target)
|
|||||||
offsetX = 0;
|
offsetX = 0;
|
||||||
offsetY = 0;
|
offsetY = 0;
|
||||||
offsetZ = 0;
|
offsetZ = 0;
|
||||||
distance = minDistance+(radius-minRadius)/(maxRadius-minRadius)*(maxDistance-minDistance);
|
distance = minDistance + (radius - minRadius) / (maxRadius - minRadius) * (maxDistance - minDistance);
|
||||||
zIncrease = minZIncrease+(radius-minRadius)/(maxRadius-minRadius)*(maxZIncrease-minZIncrease);
|
zIncrease = minZIncrease + (radius - minRadius) / (maxRadius - minRadius) * (maxZIncrease - minZIncrease);
|
||||||
return [distance, zIncrease, offsetX, offsetY, offsetZ];
|
return [distance, zIncrease, offsetX, offsetY, offsetZ];
|
||||||
}
|
}
|
||||||
|
|
||||||
function update()
|
function update() {
|
||||||
{
|
|
||||||
let target = getCameraTarget();
|
let target = getCameraTarget();
|
||||||
if (target != null)
|
if (target != null) {
|
||||||
{
|
if (oldCameraTarget != target) {
|
||||||
if (oldCameraTarget != target)
|
|
||||||
{
|
|
||||||
//if (oldCameraTarget != null)//2019 Lucas was here!
|
//if (oldCameraTarget != null)//2019 Lucas was here!
|
||||||
let Position = target.position;
|
let Position = target.position;
|
||||||
if (OldPosition == null || getLength(Position.x-OldPosition.x,Position.y-OldPosition.y,Position.z-OldPosition.z) < 10)
|
if (OldPosition == null || getLength(Position.x - OldPosition.x, Position.y - OldPosition.y, Position.z - OldPosition.z) < 10)
|
||||||
startCameraEase()
|
startCameraEase()
|
||||||
resetCameraRotation()
|
resetCameraRotation()
|
||||||
}
|
}
|
||||||
let [mouseSpeedX, mouseSpeedY] = GetMouseSpeed();
|
let [mouseSpeedX, mouseSpeedY] = GetMouseSpeed();
|
||||||
let [mouseSensitivityX, mouseSensitivityY] = GetMouseSensitivity();
|
let [mouseSensitivityX, mouseSensitivityY] = GetMouseSensitivity();
|
||||||
mouseSpeedX = mouseSpeedX*mouseSensitivityX*2;
|
mouseSpeedX = mouseSpeedX * mouseSensitivityX * 2;
|
||||||
mouseSpeedY = mouseSpeedY*mouseSensitivityY*2;
|
mouseSpeedY = mouseSpeedY * mouseSensitivityY * 2;
|
||||||
if (mouseSpeedX == 0 && mouseSpeedY == 0)
|
if (mouseSpeedX == 0 && mouseSpeedY == 0) {
|
||||||
{
|
|
||||||
processReturnToRestRotation();
|
processReturnToRestRotation();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
cameraRotZ = cameraRotZ - mouseSpeedX;
|
||||||
cameraRotZ = cameraRotZ-mouseSpeedX;
|
cameraRotY = cameraRotY - mouseSpeedY;
|
||||||
cameraRotY = cameraRotY-mouseSpeedY;
|
|
||||||
cancelReturnToRestRotation();
|
cancelReturnToRestRotation();
|
||||||
}
|
}
|
||||||
cameraRotY = Math.max(cameraRotY,-Math.PI/2+0.01);
|
cameraRotY = Math.max(cameraRotY, -Math.PI / 2 + 0.01);
|
||||||
if (GetEntityType(target) != ENTITYTYPE_PED)
|
if (GetEntityType(target) != ENTITYTYPE_PED)
|
||||||
cameraRotY = Math.min(cameraRotY,Math.PI/8.5);//2019 Lucas was here!
|
cameraRotY = Math.min(cameraRotY, Math.PI / 8.5);//2019 Lucas was here!
|
||||||
else
|
else
|
||||||
cameraRotY = Math.min(cameraRotY,Math.PI/4);
|
cameraRotY = Math.min(cameraRotY, Math.PI / 4);
|
||||||
let camera = GetCamera();
|
let camera = GetCamera();
|
||||||
let targetMatrix = GetPlaceableMatrix(target);
|
let targetMatrix = GetPlaceableMatrix(target);
|
||||||
let [distance, zIncrease, offsetX, offsetY, offsetZ] = getCameraOffsetInfo(target);
|
let [distance, zIncrease, offsetX, offsetY, offsetZ] = getCameraOffsetInfo(target);
|
||||||
let offsetTranslationMatrix = createTranslationMatrix(offsetX, offsetY, offsetZ);
|
let offsetTranslationMatrix = createTranslationMatrix(offsetX, offsetY, offsetZ);
|
||||||
targetMatrix = createMultipliedMatrix(offsetTranslationMatrix,targetMatrix);
|
targetMatrix = createMultipliedMatrix(offsetTranslationMatrix, targetMatrix);
|
||||||
let targetPosX, targetPosY, targetPosZ;
|
let targetPosX, targetPosY, targetPosZ;
|
||||||
if (isRelativeToTarget(target))
|
if (isRelativeToTarget(target))
|
||||||
[targetPosX, targetPosY, targetPosZ] = [0,0,0];
|
[targetPosX, targetPosY, targetPosZ] = [0, 0, 0];
|
||||||
else
|
else
|
||||||
[targetPosX, targetPosY, targetPosZ] = [targetMatrix.m41,targetMatrix.m42,targetMatrix.m43];
|
[targetPosX, targetPosY, targetPosZ] = [targetMatrix.m41, targetMatrix.m42, targetMatrix.m43];
|
||||||
let distanceTranslationMatrix = createTranslationMatrix(0,-distance,0);
|
let distanceTranslationMatrix = createTranslationMatrix(0, -distance, 0);
|
||||||
targetPosZ = targetPosZ+zIncrease;
|
targetPosZ = targetPosZ + zIncrease;
|
||||||
let targetTranslationMatrix = createTranslationMatrix(targetPosX, targetPosY, targetPosZ);
|
let targetTranslationMatrix = createTranslationMatrix(targetPosX, targetPosY, targetPosZ);
|
||||||
let offsetRotationX = createXRotationMatrix(cameraRotY);
|
let offsetRotationX = createXRotationMatrix(cameraRotY);
|
||||||
let offsetRotationZ = createZRotationMatrix(cameraRotZ);
|
let offsetRotationZ = createZRotationMatrix(cameraRotZ);
|
||||||
let cameraMatrix = createMultipliedMatrix(cameraIdentityMatrix,distanceTranslationMatrix,offsetRotationX,offsetRotationZ,targetTranslationMatrix);
|
let cameraMatrix = createMultipliedMatrix(cameraIdentityMatrix, distanceTranslationMatrix, offsetRotationX, offsetRotationZ, targetTranslationMatrix);
|
||||||
if (isRelativeToTarget(target))
|
if (isRelativeToTarget(target)) {
|
||||||
{
|
cameraMatrix = createMultipliedMatrix(cameraMatrix, targetMatrix);
|
||||||
cameraMatrix = createMultipliedMatrix(cameraMatrix,targetMatrix);
|
targetTranslationMatrix = createMultipliedMatrix(targetTranslationMatrix, targetMatrix);
|
||||||
targetTranslationMatrix = createMultipliedMatrix(targetTranslationMatrix,targetMatrix);
|
|
||||||
}
|
}
|
||||||
if (isClipped(target))
|
if (isClipped(target)) {
|
||||||
{
|
|
||||||
let startX = targetTranslationMatrix.m41;
|
let startX = targetTranslationMatrix.m41;
|
||||||
let startY = targetTranslationMatrix.m42;
|
let startY = targetTranslationMatrix.m42;
|
||||||
let startZ = targetTranslationMatrix.m43;
|
let startZ = targetTranslationMatrix.m43;
|
||||||
@@ -603,17 +541,16 @@ function update()
|
|||||||
let ignoreSomeObjectsForCamera = true;
|
let ignoreSomeObjectsForCamera = true;
|
||||||
let collisionsEnabled = AreEntityCollisionsEnabled(target);
|
let collisionsEnabled = AreEntityCollisionsEnabled(target);
|
||||||
if (collisionsEnabled)
|
if (collisionsEnabled)
|
||||||
SetEntityCollisionsEnabled(target,false);
|
SetEntityCollisionsEnabled(target, false);
|
||||||
let [positionX,positionY,positionZ,normalX,normalY,normalZ,targetEntity] = ProcessLineOfSight(startX,startY,startZ,endX,endY,endZ,checkBuildings,checkVehicles,checkPeds,checkObjects,checkDummies,checkSeeThroughStuff,ignoreSomeObjectsForCamera);
|
let [positionX, positionY, positionZ, normalX, normalY, normalZ, targetEntity] = ProcessLineOfSight(startX, startY, startZ, endX, endY, endZ, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, checkSeeThroughStuff, ignoreSomeObjectsForCamera);
|
||||||
if (collisionsEnabled)
|
if (collisionsEnabled)
|
||||||
SetEntityCollisionsEnabled(target,true);
|
SetEntityCollisionsEnabled(target, true);
|
||||||
if (positionX != null)
|
if (positionX != null) {
|
||||||
{
|
|
||||||
//2019 Lucas was here!
|
//2019 Lucas was here!
|
||||||
let Distance = 0.3;
|
let Distance = 0.3;
|
||||||
positionX += normalX*Distance;
|
positionX += normalX * Distance;
|
||||||
positionY += normalY*Distance;
|
positionY += normalY * Distance;
|
||||||
positionZ += normalZ*Distance;
|
positionZ += normalZ * Distance;
|
||||||
|
|
||||||
cameraMatrix.m41 = positionX;
|
cameraMatrix.m41 = positionX;
|
||||||
cameraMatrix.m42 = positionY;
|
cameraMatrix.m42 = positionY;
|
||||||
@@ -622,7 +559,7 @@ function update()
|
|||||||
}
|
}
|
||||||
if (isCameraEasing())
|
if (isCameraEasing())
|
||||||
cameraMatrix = applyCameraEase(cameraMatrix);
|
cameraMatrix = applyCameraEase(cameraMatrix);
|
||||||
SetPlaceableMatrix(camera,cameraMatrix);
|
SetPlaceableMatrix(camera, cameraMatrix);
|
||||||
UpdateCamera(camera);
|
UpdateCamera(camera);
|
||||||
}
|
}
|
||||||
oldCameraTarget = target;
|
oldCameraTarget = target;
|
||||||
@@ -630,9 +567,8 @@ function update()
|
|||||||
return target != null;
|
return target != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
addEventHandler("OnCameraProcess", (event) =>
|
addEventHandler("OnCameraProcess", (event) => {
|
||||||
{
|
if (mouseCameraEnabled) {
|
||||||
if(mouseCameraEnabled) {
|
|
||||||
update();
|
update();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function addAllNetworkHandlers() {
|
|||||||
addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
|
addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
|
||||||
addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
||||||
addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
||||||
addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
||||||
addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
|
addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
|
||||||
addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
|
addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
|
||||||
addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
|
addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
|
||||||
@@ -119,10 +119,8 @@ function addAllNetworkHandlers() {
|
|||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
|
addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
|
||||||
addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera);
|
|
||||||
addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
|
addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
|
||||||
addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
|
addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
|
||||||
addNetworkEventHandler("vrr.logo", setServerLogoRenderState);
|
|
||||||
addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
|
addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
|
||||||
addNetworkEventHandler("vrr.runCode", runClientCode);
|
addNetworkEventHandler("vrr.runCode", runClientCode);
|
||||||
addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
|
addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
|
||||||
@@ -135,9 +133,6 @@ function addAllNetworkHandlers() {
|
|||||||
addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
|
addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
|
||||||
addNetworkEventHandler("vrr.logLevel", setLogLevel);
|
addNetworkEventHandler("vrr.logLevel", setLogLevel);
|
||||||
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
||||||
addNetworkEventHandler("vrr.nametag", updatePlayerNameTag);
|
|
||||||
addNetworkEventHandler("vrr.nametagDistance", setNameTagDistance);
|
|
||||||
addNetworkEventHandler("vrr.ping", updatePlayerPing);
|
|
||||||
addNetworkEventHandler("vrr.anim", makePedPlayAnimation);
|
addNetworkEventHandler("vrr.anim", makePedPlayAnimation);
|
||||||
addNetworkEventHandler("vrr.stopAnim", makePedStopAnimation);
|
addNetworkEventHandler("vrr.stopAnim", makePedStopAnimation);
|
||||||
addNetworkEventHandler("vrr.forceAnim", forcePedAnimation);
|
addNetworkEventHandler("vrr.forceAnim", forcePedAnimation);
|
||||||
@@ -166,7 +161,7 @@ function sendResourceStartedSignalToServer() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendResourceStoppedSignalToServer() {
|
function sendResourceStoppedSignalToServer() {
|
||||||
if(isConnected) {
|
if (isConnected) {
|
||||||
sendNetworkEventToServer("vrr.clientStopped");
|
sendNetworkEventToServer("vrr.clientStopped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,14 +172,14 @@ function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardS
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
||||||
renderHUD = hudState;
|
renderHUD = hudState;
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.displayCash(hudState);
|
natives.displayCash(hudState);
|
||||||
natives.displayAmmo(hudState);
|
natives.displayAmmo(hudState);
|
||||||
natives.displayHud(hudState);
|
natives.displayHud(hudState);
|
||||||
natives.displayRadar(hudState);
|
natives.displayRadar(hudState);
|
||||||
natives.displayAreaName(hudState);
|
natives.displayAreaName(hudState);
|
||||||
} else {
|
} else {
|
||||||
if(typeof setHUDEnabled != "undefined") {
|
if (typeof setHUDEnabled != "undefined") {
|
||||||
setHUDEnabled(hudState);
|
setHUDEnabled(hudState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,8 +197,8 @@ function onServerSpawnedLocalPlayer(state) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
||||||
isSpawned = state;
|
isSpawned = state;
|
||||||
setUpInitialGame();
|
setUpInitialGame();
|
||||||
if(state) {
|
if (state) {
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
calledDeathEvent = false;
|
calledDeathEvent = false;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
@@ -243,7 +238,7 @@ function tellServerItemActionDelayComplete() {
|
|||||||
|
|
||||||
function sendServerClientInfo() {
|
function sendServerClientInfo() {
|
||||||
let clientVersion = "0.0.0.0";
|
let clientVersion = "0.0.0.0";
|
||||||
if(typeof CLIENT_VERSION_MAJOR != "undefined") {
|
if (typeof CLIENT_VERSION_MAJOR != "undefined") {
|
||||||
clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
|
clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
|
||||||
}
|
}
|
||||||
sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
|
sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
|
||||||
@@ -282,7 +277,7 @@ function updateInteriorLightsState(state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function forceSyncElementProperties(elementId) {
|
function forceSyncElementProperties(elementId) {
|
||||||
if(getElementFromId(elementId) == null) {
|
if (getElementFromId(elementId) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +287,7 @@ function forceSyncElementProperties(elementId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setElementCollisionsEnabled(elementId, state) {
|
function setElementCollisionsEnabled(elementId, state) {
|
||||||
if(getElementFromId(elementId) == null) {
|
if (getElementFromId(elementId) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +297,7 @@ function setElementCollisionsEnabled(elementId, state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerArmour(armour) {
|
function setLocalPlayerArmour(armour) {
|
||||||
if(typeof localPlayer.armour != "undefined") {
|
if (typeof localPlayer.armour != "undefined") {
|
||||||
localPlayer.armour = armour;
|
localPlayer.armour = armour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,8 +317,8 @@ function setLogLevel(level) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerInfiniteRun(state) {
|
function setLocalPlayerInfiniteRun(state) {
|
||||||
if(localPlayer != null) {
|
if (localPlayer != null) {
|
||||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -333,7 +328,7 @@ function setLocalPlayerInfiniteRun(state) {
|
|||||||
|
|
||||||
function setLocalPlayerSkin(skinId) {
|
function setLocalPlayerSkin(skinId) {
|
||||||
logToConsole(LOG_INFO, `[VRR.Server] Setting locale player skin to ${skinId}`);
|
logToConsole(LOG_INFO, `[VRR.Server] Setting locale player skin to ${skinId}`);
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||||
} else {
|
} else {
|
||||||
localPlayer.skin = skinId;
|
localPlayer.skin = skinId;
|
||||||
@@ -343,7 +338,7 @@ function setLocalPlayerSkin(skinId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function makePedHoldObject(pedId, modelIndex) {
|
function makePedHoldObject(pedId, modelIndex) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -357,11 +352,11 @@ function sendLocalPlayerNetworkIdToServer() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setCutsceneInterior(cutsceneName) {
|
function setCutsceneInterior(cutsceneName) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(cutsceneName == "") {
|
if (cutsceneName == "") {
|
||||||
natives.clearCutscene();
|
natives.clearCutscene();
|
||||||
} else {
|
} else {
|
||||||
if(natives.isInteriorScene()) {
|
if (natives.isInteriorScene()) {
|
||||||
natives.clearCutscene();
|
natives.clearCutscene();
|
||||||
}
|
}
|
||||||
natives.initCutscene(cutsceneName);
|
natives.initCutscene(cutsceneName);
|
||||||
@@ -372,16 +367,16 @@ function setCutsceneInterior(cutsceneName) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function makeLocalPlayerPedSpeak(speechName) {
|
function makeLocalPlayerPedSpeak(speechName) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
// if player is in vehicle, allow megaphone (if last arg is "1", it will cancel megaphone echo)
|
// if player is in vehicle, allow megaphone (if last arg is "1", it will cancel megaphone echo)
|
||||||
// Only speeches with _MEGAPHONE will have the bullhorn effect
|
// Only speeches with _MEGAPHONE will have the bullhorn effect
|
||||||
// Afaik it only works on police voices anyway
|
// Afaik it only works on police voices anyway
|
||||||
if(localPlayer.vehicle != null) {
|
if (localPlayer.vehicle != null) {
|
||||||
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 0);
|
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 0);
|
||||||
} else {
|
} else {
|
||||||
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 1);
|
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 1);
|
||||||
}
|
}
|
||||||
} else if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
} else if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||||
// Don't have a way to get the ped ref ID and can't use ped in arg
|
// Don't have a way to get the ped ref ID and can't use ped in arg
|
||||||
//game.SET_CHAR_SAY(game.GET_PLAYER_ID(), int);
|
//game.SET_CHAR_SAY(game.GET_PLAYER_ID(), int);
|
||||||
}
|
}
|
||||||
@@ -390,7 +385,7 @@ function makeLocalPlayerPedSpeak(speechName) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerAsCopState(state) {
|
function setLocalPlayerAsCopState(state) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.setPlayerAsCop(natives.getPlayerId(), state);
|
natives.setPlayerAsCop(natives.getPlayerId(), state);
|
||||||
natives.setPoliceIgnorePlayer(natives.getPlayerId(), state);
|
natives.setPoliceIgnorePlayer(natives.getPlayerId(), state);
|
||||||
}
|
}
|
||||||
@@ -399,7 +394,7 @@ function setLocalPlayerAsCopState(state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function serverRequestedLocalPlayerSpawn(skinId, position) {
|
function serverRequestedLocalPlayerSpawn(skinId, position) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.createPlayer(skinId, position);
|
natives.createPlayer(skinId, position);
|
||||||
//if(isCustomCameraSupported()) {
|
//if(isCustomCameraSupported()) {
|
||||||
// game.restoreCamera(true);
|
// game.restoreCamera(true);
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
function initClientScripts() {
|
function initClientScripts() {
|
||||||
initGUIScript();
|
initGUIScript();
|
||||||
initNameTagScript();
|
//initNameTagScript();
|
||||||
initScoreBoardScript();
|
initScoreBoardScript();
|
||||||
initMessagingScript();
|
initMessagingScript();
|
||||||
initServerScript();
|
initServerScript();
|
||||||
initLogoScript();
|
//initLogoScript();
|
||||||
initLabelScript();
|
//initLabelScript();
|
||||||
initChatBoxScript();
|
initChatBoxScript();
|
||||||
initAFKScript();
|
initAFKScript();
|
||||||
initKeyBindScript();
|
initKeyBindScript();
|
||||||
@@ -25,8 +25,8 @@ function initClientScripts() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setUpInitialGame() {
|
function setUpInitialGame() {
|
||||||
if(getGame() == VRR_GAME_GTA_III) {
|
if (getGame() == VRR_GAME_GTA_III) {
|
||||||
logToConsole(LOG_DEBUG|LOG_WARN, "Setting up initial game stuff for GTA III ...");
|
logToConsole(LOG_DEBUG | LOG_WARN, "Setting up initial game stuff for GTA III ...");
|
||||||
|
|
||||||
// Turn off unlimited sprint
|
// Turn off unlimited sprint
|
||||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||||
@@ -44,8 +44,8 @@ function setUpInitialGame() {
|
|||||||
|
|
||||||
// Provided by mouse camera script (mousecam.js)
|
// Provided by mouse camera script (mousecam.js)
|
||||||
SetStandardControlsEnabled(true);
|
SetStandardControlsEnabled(true);
|
||||||
} else if(getGame() == VRR_GAME_GTA_VC) {
|
} else if (getGame() == VRR_GAME_GTA_VC) {
|
||||||
logToConsole(LOG_DEBUG|LOG_WARN, "Setting up initial game stuff for GTA Vice City ...");
|
logToConsole(LOG_DEBUG | LOG_WARN, "Setting up initial game stuff for GTA Vice City ...");
|
||||||
|
|
||||||
// Turn off unlimited sprint
|
// Turn off unlimited sprint
|
||||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||||
@@ -87,8 +87,8 @@ function setUpInitialGame() {
|
|||||||
|
|
||||||
// Provided by mouse camera script (mousecam.js)
|
// Provided by mouse camera script (mousecam.js)
|
||||||
SetStandardControlsEnabled(true);
|
SetStandardControlsEnabled(true);
|
||||||
} else if(getGame() == VRR_GAME_GTA_SA) {
|
} else if (getGame() == VRR_GAME_GTA_SA) {
|
||||||
logToConsole(LOG_DEBUG|LOG_WARN, "Setting up initial game stuff for GTA San Andreas ...");
|
logToConsole(LOG_DEBUG | LOG_WARN, "Setting up initial game stuff for GTA San Andreas ...");
|
||||||
// Turn weapon skills down a bit
|
// Turn weapon skills down a bit
|
||||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
|
||||||
@@ -124,7 +124,7 @@ function setUpInitialGame() {
|
|||||||
|
|
||||||
// Disables taxi/vigilante/etc and other start mission triggers
|
// Disables taxi/vigilante/etc and other start mission triggers
|
||||||
game.onMission = true;
|
game.onMission = true;
|
||||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
} else if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.allowEmergencyServices(false);
|
natives.allowEmergencyServices(false);
|
||||||
natives.setCreateRandomCops(true);
|
natives.setCreateRandomCops(true);
|
||||||
natives.setMaxWantedLevel(0);
|
natives.setMaxWantedLevel(0);
|
||||||
@@ -186,7 +186,7 @@ function setUpInitialGame() {
|
|||||||
|
|
||||||
// Some last steps
|
// Some last steps
|
||||||
//natives.loadAllObjectsNow();
|
//natives.loadAllObjectsNow();
|
||||||
} else if(getGame() == VRR_GAME_MAFIA_ONE) {
|
} else if (getGame() == VRR_GAME_MAFIA_ONE) {
|
||||||
game.mapEnabled = false;
|
game.mapEnabled = false;
|
||||||
game.setTrafficEnabled(false);
|
game.setTrafficEnabled(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ function addAllNetworkHandlers() {
|
|||||||
|
|
||||||
function updatePlayerNameTag(client) {
|
function updatePlayerNameTag(client) {
|
||||||
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
|
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
|
||||||
sendNetworkEventToPlayer("vrr.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
|
sendNetworkEventToPlayer("agrp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -101,7 +101,7 @@ function updateAllPlayerNameTags() {
|
|||||||
|
|
||||||
function updatePlayerPing(client) {
|
function updatePlayerPing(client) {
|
||||||
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
|
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
|
||||||
sendNetworkEventToPlayer("vrr.ping", null, getPlayerName(client), getPlayerPing(client));
|
sendNetworkEventToPlayer("agrp.ping", null, getPlayerName(client), getPlayerPing(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -193,7 +193,7 @@ function setPlayerControlState(client, state) {
|
|||||||
|
|
||||||
function updatePlayerShowLogoState(client, state) {
|
function updatePlayerShowLogoState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||||
sendNetworkEventToPlayer("vrr.logo", client, state);
|
sendNetworkEventToPlayer("agrp.serverLogo", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -435,14 +435,14 @@ function sendPlayerStopJobRoute(client) {
|
|||||||
|
|
||||||
function sendPlayerMouseCameraToggle(client) {
|
function sendPlayerMouseCameraToggle(client) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("vrr.mouseCamera", client);
|
sendNetworkEventToPlayer("agrp.mouseCamera", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerMouseCameraState(client, state) {
|
function setPlayerMouseCameraState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("vrr.mouseCameraForce", client, state);
|
sendNetworkEventToPlayer("agrp.mouseCameraForce", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1194,7 +1194,7 @@ function tellPlayerToSpawn(client, skinId, position) {
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
function sendNameTagDistanceToClient(client, distance) {
|
function sendNameTagDistanceToClient(client, distance) {
|
||||||
sendNetworkEventToPlayer("vrr.nameTagDistance", client, distance);
|
sendNetworkEventToPlayer("agrp.nameTagDistance", client, distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user