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

@@ -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);
}
}