Add player stream distance + fishing cast min/max strength to config

This commit is contained in:
Vortrex
2022-07-26 01:00:25 -05:00
parent 42bb527844
commit d1bdc069fd
2 changed files with 67 additions and 4 deletions

View File

@@ -227,6 +227,8 @@ let globalConfig = {
houseBlipStreamOutDistance: 120, houseBlipStreamOutDistance: 120,
jobBlipStreamInDistance: -1, jobBlipStreamInDistance: -1,
jobBlipStreamOutDistance: -1, jobBlipStreamOutDistance: -1,
playerStreamInDistance: -1,
playerStreamOutDistance: -1,
playerBlipStreamInDistance: -1, playerBlipStreamInDistance: -1,
playerBlipStreamOutDistance: -1, playerBlipStreamOutDistance: -1,
handcuffPlayerDistance: 3, handcuffPlayerDistance: 3,
@@ -241,6 +243,8 @@ let globalConfig = {
fishingSpotDistance: 10.0, fishingSpotDistance: 10.0,
atmDistance: 1.5, atmDistance: 1.5,
loginTimeout: 60000, loginTimeout: 60000,
fishingCastMaxStrength: 100,
fishingCastMinStrength: 30,
}; };
// =========================================================================== // ===========================================================================

View File

@@ -52,6 +52,40 @@ let fishingCollectables = [
// =========================================================================== // ===========================================================================
let fishingAnimations = {
[AGRP_GAME_GTA_III]: {
"fishingLineCasting": "bathit1",
"fishingLineReeling": "aimdown",
},
[AGRP_GAME_GTA_VC]: {
"fishingLineCasting": "frontpunch",
"fishingLineReeling": "aimdown",
},
[AGRP_GAME_GTA_SA]: {
"fishingLineCasting": "none",
"fishingLineReeling": "none",
}
};
// ===========================================================================
let fishingParticleEffects = {
[AGRP_GAME_GTA_III]: {
"fishingLineCast": [
"MediumSprayingWater",
0.2,
500
],
"fishingLineReel": [
"MediumSprayingWater",
0.2,
500
]
}
};
// ===========================================================================
function initFishingScript() { function initFishingScript() {
logToConsole(LOG_INFO, "[VRR.Fishing]: Initializing fishing script ..."); logToConsole(LOG_INFO, "[VRR.Fishing]: Initializing fishing script ...");
logToConsole(LOG_INFO, "[VRR.Fishing]: Fishing script initialized successfully!"); logToConsole(LOG_INFO, "[VRR.Fishing]: Fishing script initialized successfully!");
@@ -59,7 +93,7 @@ function initFishingScript() {
// =========================================================================== // ===========================================================================
function castFishingLineCommand(client) { function castFishingLineCommand(command, params, client) {
if (!isPlayerInFishingSpot(client)) { if (!isPlayerInFishingSpot(client)) {
messagePlayerError(client, getLocaleString(client, "CantFishHere")); messagePlayerError(client, getLocaleString(client, "CantFishHere"));
return false; return false;
@@ -70,14 +104,23 @@ function castFishingLineCommand(client) {
return false; return false;
} }
getPlayerData(client).fishingLineCastStart = getCurrentUnixTimestamp(); if (doesPlayerHaveFishingLineCast(client)) {
makePedPlayAnimation(getPlayerPed(client), getAnimationFromParams("fishingcast")); messagePlayerError(client, getLocaleString(client, "FishingLineAlreadyCast"));
return false;
}
let maxStrength = getGlobalConfig().fishingCastMaxStrength;
let minStrength = getGlobalConfig().fishingCastMinStrength;
let keyDuration = getPlayerData(client).keyBindDuration;
let strength = Math.round((maxStrength - minStrength) * (keyDuration / getGlobalConfig().fishingLineCastDuration));
castPlayerFishingLine(client, strength);
let messageText = getLocaleString(client, "FishingCastCommandHelp"); let messageText = getLocaleString(client, "FishingCastCommandHelp");
if (doesPlayerHaveKeyBindForCommand(client, "fish")) { if (doesPlayerHaveKeyBindForCommand(client, "fish")) {
messageText = getLocaleString(client, "FishingCastKeyPressHelp"); messageText = getLocaleString(client, "FishingCastKeyPressHelp");
} }
showGameMessage(client, messageText); showGameMessage(client, messageText);
} }
@@ -120,6 +163,22 @@ function doesPlayerHaveFishingLineCast(client) {
// =========================================================================== // ===========================================================================
function castPlayerFishingLine(client, strength) {
let frontPosition = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), strength * 2);
makePlayerPlayAnimation(client, getAnimationFromParams(fishingAnimations[getGame()]["fishingLineCasting"]));
setTimeout(function () {
let particleEffectName = fishingParticleEffects[getGame()].fishingLineCast[1];
showParticleEffect(frontPosition, getGameConfig().particleEffects[getGame()][particleEffectName], fishingParticleEffects[getGame()].fishingLineCast[1], fishingParticleEffects[getGame()].fishingLineCast[2]);
getPlayerData(client).fishingLineCastPosition = frontPosition;
getPlayerData(client).fishingLineState = AGRP_FISHING_LINE_STATE_CASTED;
}, strength * 10);
}
// ===========================================================================
function isPlayerInFishingSpot(client) { function isPlayerInFishingSpot(client) {
if (isPlayerOnBoat(client)) { if (isPlayerOnBoat(client)) {
return true; return true;