From 3316c047dcc41f8fef9a27f6eea19ca12d4ba26c Mon Sep 17 00:00:00 2001 From: Fernando-A-Rocha Date: Thu, 1 Aug 2024 11:38:13 +0100 Subject: [PATCH] comments --- newmodels_reborn/core/shared_exported.lua | 3 ++- newmodels_reborn/core/shared_local.lua | 1 + .../optional/compatibility/server_funcs.lua | 12 +++++------- .../optional/compatibility/shared_exported.lua | 14 ++------------ 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/newmodels_reborn/core/shared_exported.lua b/newmodels_reborn/core/shared_exported.lua index 182d503..61cfc8e 100644 --- a/newmodels_reborn/core/shared_exported.lua +++ b/newmodels_reborn/core/shared_exported.lua @@ -1,9 +1,10 @@ -- !! THIS SCRIPT IS ENTIRELY EXPORTED !! +local isClientsideScript = localPlayer ~= nil + VALID_ELEMENT_TYPES = { "vehicle", "ped", "player", "object", "pickup" } local resources = {} -local isClientsideScript = localPlayer ~= nil _createObject = createObject _createVehicle = createVehicle diff --git a/newmodels_reborn/core/shared_local.lua b/newmodels_reborn/core/shared_local.lua index 521e584..88f702a 100644 --- a/newmodels_reborn/core/shared_local.lua +++ b/newmodels_reborn/core/shared_local.lua @@ -1 +1,2 @@ +-- Shared custom models table: customModels = {} diff --git a/newmodels_reborn/optional/compatibility/server_funcs.lua b/newmodels_reborn/optional/compatibility/server_funcs.lua index fe696b7..36b820b 100644 --- a/newmodels_reborn/optional/compatibility/server_funcs.lua +++ b/newmodels_reborn/optional/compatibility/server_funcs.lua @@ -1,5 +1,5 @@ -- Backwards compatibility with newmodels 3.3.0 --- Exported functions from old newmodels working with the new system +-- Exported functions & serverside logic from old newmodels working with the new system local resName = getResourceName(resource) @@ -167,7 +167,7 @@ end With this one you can just pass a table of mods and it calls that function for you Also, please note that if any of your mods has an invalid parameter, an error will be output and it won't get added. ]] -function addExternalMods_IDFilenames(list, onFinishEvent) -- [Exported] +function addExternalMods_IDFilenames(list, onFinishEvent) if not sourceResource then return false, "This command is meant to be called from outside resource '" .. resName .. "'" end @@ -225,7 +225,6 @@ end The difference between this function and addExternalMod_CustomFilenames is that you pass a folder path in 'path' and it will search for ID.dff ID.txd etc ]] --- [Exported] function addExternalMod_IDFilenames(...) -- Backwards compatibility for old arguments local args = { ... } @@ -414,7 +413,7 @@ end With this one you can just pass a table of mods and it calls that function for you Also, please note that if any of your mods has an invalid parameter, an error will be output and it won't get added. ]] -function addExternalMods_CustomFileNames(list, onFinishEvent) -- [Exported] +function addExternalMods_CustomFileNames(list, onFinishEvent) if not sourceResource then return false, "This command is meant to be called from outside resource '" .. resName .. "'" end @@ -472,7 +471,6 @@ end The difference between this function and addExternalMod_IDFilenames is that you pass directly individual file paths for dff, txd and col files ]] --- [Exported] function addExternalMod_CustomFilenames(...) -- Backwards compatibility for old arguments local args = { ... } @@ -652,7 +650,7 @@ function addExternalMod_CustomFilenames(...) return true end -function removeExternalMods(list, onFinishEvent) -- [Exported] +function removeExternalMods(list, onFinishEvent) if not sourceResource then return false, "This command is meant to be called from outside resource '" .. resName .. "'" end @@ -699,7 +697,7 @@ function removeExternalMods(list, onFinishEvent) -- [Exported] return true end -function removeExternalMod(id) -- [Exported] +function removeExternalMod(id) id = tonumber(id) if not id then return false, "Missing/Invalid 'id' passed: " .. tostring(id) diff --git a/newmodels_reborn/optional/compatibility/shared_exported.lua b/newmodels_reborn/optional/compatibility/shared_exported.lua index 2467915..33c2374 100644 --- a/newmodels_reborn/optional/compatibility/shared_exported.lua +++ b/newmodels_reborn/optional/compatibility/shared_exported.lua @@ -2,7 +2,7 @@ -- Backwards compatibility with newmodels 3.3.0 --- Configurable variables +-- Configurable variables --------------------------------------------------------------------------------------------------------------------- OLD_DATA_NAMES = { ped = "skinID", @@ -19,7 +19,7 @@ OLD_BASE_DATA_NAME = "baseID" ENABLE_NANDOCRYPT = true NANDOCRYPT_EXT = ".nandocrypt" --- Exported functions from old newmodels working with the new system +-- Exported functions from old newmodels working with the new system -------------------------------------------------------------------------- local isClientsideScript = localPlayer ~= nil @@ -36,7 +36,6 @@ local function convertCustomModelInfoToOldFormat(customModel, customModelInfo) return mod end --- Exported function getDataNameFromType(elementType) if type(elementType) == "string" then return OLD_DATA_NAMES[elementType] @@ -55,12 +54,10 @@ function getCustomModelDataKey(elementOrElementType) return _getCustomModelDataKey(elementOrElementType) end --- Exported function getBaseModelDataName() return OLD_BASE_DATA_NAME end --- Exported function getModDataFromID(id) id = tonumber(id) if not id then return end @@ -70,7 +67,6 @@ function getModDataFromID(id) return mod, customInfo.type end --- Exported function getModList() local modList = {} for id, customInfo in pairs(customModels) do @@ -79,7 +75,6 @@ function getModList() return modList end --- Exported function getBaseModel(element) if not isClientsideScript then return getElementModel(element) @@ -93,14 +88,12 @@ function getBaseModel(element) end end --- Exported function isCustomModID(id) local mod, modType = getModDataFromID(id) if not mod then return false end return true, mod, modType end --- Exported function isRightModType(et, modEt) if et == modEt then return true @@ -114,7 +107,6 @@ function isRightModType(et, modEt) return false end --- Exported function checkModelID(id, elementType) assert(tonumber(id), "Non-number ID passed") assert( @@ -142,10 +134,8 @@ function checkModelID(id, elementType) end if isClientsideScript then - -- Exported function isClientReady() return true end -- Now the client is always ready :-) - -- Exported function isModAllocated(id) id = tonumber(id) if not id then return end