Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando-A-Rocha committed Aug 1, 2024
1 parent 20686f2 commit 3316c04
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
3 changes: 2 additions & 1 deletion newmodels_reborn/core/shared_exported.lua
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions newmodels_reborn/core/shared_local.lua
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
-- Shared custom models table:
customModels = {}
12 changes: 5 additions & 7 deletions newmodels_reborn/optional/compatibility/server_funcs.lua
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = { ... }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = { ... }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 2 additions & 12 deletions newmodels_reborn/optional/compatibility/shared_exported.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

-- Backwards compatibility with newmodels 3.3.0

-- Configurable variables
-- Configurable variables ---------------------------------------------------------------------------------------------------------------------

OLD_DATA_NAMES = {
ped = "skinID",
Expand All @@ -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

Expand All @@ -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]
Expand All @@ -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
Expand All @@ -70,7 +67,6 @@ function getModDataFromID(id)
return mod, customInfo.type
end

-- Exported
function getModList()
local modList = {}
for id, customInfo in pairs(customModels) do
Expand All @@ -79,7 +75,6 @@ function getModList()
return modList
end

-- Exported
function getBaseModel(element)
if not isClientsideScript then
return getElementModel(element)
Expand All @@ -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
Expand All @@ -114,7 +107,6 @@ function isRightModType(et, modEt)
return false
end

-- Exported
function checkModelID(id, elementType)
assert(tonumber(id), "Non-number ID passed")
assert(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3316c04

Please sign in to comment.