diff --git a/newmodels_reborn/meta.xml b/newmodels_reborn/meta.xml index 480d9be..fe2d7cc 100644 --- a/newmodels_reborn/meta.xml +++ b/newmodels_reborn/meta.xml @@ -22,6 +22,7 @@ + diff --git a/newmodels_reborn/scripts/core/shared_exported.lua b/newmodels_reborn/scripts/core/shared_exported.lua index 626e63a..f23cfb9 100644 --- a/newmodels_reborn/scripts/core/shared_exported.lua +++ b/newmodels_reborn/scripts/core/shared_exported.lua @@ -215,7 +215,19 @@ end function getElementModel(element) assert(isElement(element), "Invalid element passed: " .. tostring(element)) assert(isValidElement(element), "Invalid element type passed: " .. getElementType(element)) - return getElementData(element, getCustomModelDataKey(element)) or _getElementModel(element) + return tonumber(getElementData(element, getCustomModelDataKey(element))) or _getElementModel(element) +end + +function getElementBaseModel(element) + if not isClientsideScript then + return getElementModel(element) + end + local customModel = tonumber(getElementData(element, getCustomModelDataKey(element))) + if not customModel then + return getElementModel(element) + end + local customModelInfo = getSharedCustomModelsTable()[customModel] + return customModelInfo and customModelInfo.baseModel or nil end -- PS. You can't set element model on a pickup diff --git a/newmodels_reborn/scripts/optional/compatibility/shared_exported.lua b/newmodels_reborn/scripts/optional/compatibility/shared_exported.lua index b9b134b..34eec0f 100644 --- a/newmodels_reborn/scripts/optional/compatibility/shared_exported.lua +++ b/newmodels_reborn/scripts/optional/compatibility/shared_exported.lua @@ -77,17 +77,7 @@ function getModList() end function getBaseModel(element) - if not isClientsideScript then - return getElementModel(element) - else - local customModel = tonumber(getElementData(element, getCustomModelDataKey(element))) - if customModel then - local customModelInfo = getSharedCustomModelsTable()[customModel] - return customModelInfo and customModelInfo.baseModel or nil - else - return getElementModel(element) - end - end + return getElementBaseModel(element) end function isCustomModID(id)