From cf6970e3e17874fcaa44599887189268b2a6bff0 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Wed, 9 Mar 2022 02:49:53 -0600 Subject: [PATCH] Debug logging --- scripts/client/business.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/client/business.js b/scripts/client/business.js index 3bcee937..3eb7aee8 100644 --- a/scripts/client/business.js +++ b/scripts/client/business.js @@ -24,19 +24,25 @@ class BusinessData { // =========================================================================== function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) { + logToConsole(LOG_DEBUG, `[VRR.Business] Received business ${businessId} (${name}) from server`); if(getGame() == VRR_GAME_GTA_IV) { if(getBusinessData(businessId) != false) { + logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} already exists. Checking blip ...`); if(blipModel == -1) { + logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been removed by the server`); natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId); getBusinessData(businessId).blipId = -1; //businesses.splice(getBusinessData(businessId).index, 1); //setAllBusinessDataIndexes(); } else { + logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been changed by the server`); if(getBusinessData(businessId).blipId != -1) { + logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been modified by the server`); natives.setBlipCoordinates(getBusinessData(businessId).blipId, getBusinessData(businessId).entrancePosition); natives.changeBlipSprite(getBusinessData(businessId).blipId, getBusinessData(businessId).blipModel); natives.changeBlipNameFromAscii(getBusinessData(businessId).blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`); } else { + logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server`); let blipId = natives.addBlipForCoord(entrancePosition); if(blipId) { getBusinessData(businessId).blipId = blipId; @@ -46,8 +52,10 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel } } } else { + logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} doesn't exist. Adding ...`); + let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems); if(blipModel != -1) { - let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems); + logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server`); let blipId = natives.addBlipForCoord(entrancePosition); if(blipId) { tempBusinessData.blipId = blipId; @@ -55,9 +63,9 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel natives.setBlipMarkerLongDistance(blipId, false); natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`); } - businesses.push(tempBusinessData); - setAllBusinessDataIndexes(); } + businesses.push(tempBusinessData); + setAllBusinessDataIndexes(); } } }