Add some JSDoc info for intellisense

This commit is contained in:
Vortrex
2022-01-20 03:11:44 -06:00
parent 3bed5e5ef7
commit 2130c783bc
7 changed files with 40 additions and 3 deletions

View File

@@ -83,6 +83,10 @@ function showAnimationListCommand(command, params, client) {
// ===========================================================================
/**
* @param {number} animationSlot - The slot index of the animation
* @return {Array} The animation's data (array)
*/
function getAnimationData(animationSlot, gameId = getServerGame()) {
return getGameData().animations[gameId][animationSlot];
}

View File

@@ -1506,6 +1506,10 @@ function getBusinessOwnerTypeText(ownerType) {
// ===========================================================================
/**
* @param {number} businessId - The data index of the business
* @return {BusinessData} The business's data (class instance)
*/
function getBusinessData(businessId) {
if(typeof getServerData().businesses[businessId] != null) {
return getServerData().businesses[businessId];

View File

@@ -887,6 +887,10 @@ function deleteClan(clanId) {
// ===========================================================================
/**
* @param {number} clanId - The data index of the clan
* @return {ClanData} The clan's data (class instance)
*/
function getClanData(clanId) {
if(typeof getServerData().clans[clanId] != null) {
return getServerData().clans[clanId];

View File

@@ -1116,6 +1116,10 @@ function isPlayerInAnyHouse(client) {
// ===========================================================================
/**
* @param {number} houseIndex - The data index of the house
* @return {HouseData} The house's data (class instance)
*/
function getHouseData(houseId) {
if(typeof getServerData().houses[houseId] != "undefined") {
return getServerData().houses[houseId];

View File

@@ -8,13 +8,19 @@
// ===========================================================================
function initNPCScript() {
loadNPCsFromDatabase();
getServerData().npcs = loadNPCsFromDatabase();
setAllNPCDataIndexes();
spawnAllNPCs();
}
// ===========================================================================
function getNPCData(ped) {
/**
* @param {number} npcId - The data index of the NPC
* @return {NPCData} The NPC's data (class instancee)
*/
function getNPCData(npcId) {
return ped.getData("vrr.dataIndex");
}
@@ -187,7 +193,14 @@ function spawnNPC(npcIndex) {
let civilian = createGameCivilian(getNPCData(npcIndex).model, getNPCData(npcIndex).spawnPosition, getNPCData(npcIndex).spawnRotation);
if(civilian) {
civilian.setData("vrr.dataIndex", npcIndex);
getNPCData(npcIndex).ped = civilian;
}
}
// ===========================================================================
// ===========================================================================
function spawnAllNPCs() {
for(let i in getServerData().npcs) {
spawnNPC(npcIndex);
}
}

View File

@@ -57,6 +57,10 @@ function getGameAreas(gameId) {
// ===========================================================================
/**
* @param {Client} client - The client
* @return {ClientData} The player/client's data (class instancee)
*/
function getPlayerData(client) {
if(client != null) {
return getServerData().clients[client.index];

View File

@@ -189,6 +189,10 @@ function spawnAllVehicles() {
// ===========================================================================
/**
* @param {Vehicle} vehicle - The vehicle element
* @return {VehicleData} The vehicles's data (class instance)
*/
function getVehicleData(vehicle) {
if(isVehicleObject(vehicle)) {
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");