From 086d34b6b2b9da22e2850b1845dc2aab29723ecc Mon Sep 17 00:00:00 2001 From: Fernando-A-Rocha Date: Thu, 1 Aug 2024 17:10:14 +0100 Subject: [PATCH] add object example with shared txd Thank you @THEGizmoOfficial <3 --- .../models/object/1337/big_box/40001.col | Bin 0 -> 264 bytes .../models/object/1337/big_box/40001.dff | Bin 0 -> 1807 bytes .../models/object/1337/big_box/40001.txt | 1 + newmodels_reborn/models/object/1337/boxes.txd | Bin 0 -> 11132 bytes .../models/object/1337/small_box/40002.col | Bin 0 -> 264 bytes .../models/object/1337/small_box/40002.dff | Bin 0 -> 1809 bytes .../models/object/1337/small_box/40002.txt | 1 + .../scripts/core/server_logic.lua | 92 +++++++++++------- 8 files changed, 59 insertions(+), 35 deletions(-) create mode 100644 newmodels_reborn/models/object/1337/big_box/40001.col create mode 100644 newmodels_reborn/models/object/1337/big_box/40001.dff create mode 100644 newmodels_reborn/models/object/1337/big_box/40001.txt create mode 100644 newmodels_reborn/models/object/1337/boxes.txd create mode 100644 newmodels_reborn/models/object/1337/small_box/40002.col create mode 100644 newmodels_reborn/models/object/1337/small_box/40002.dff create mode 100644 newmodels_reborn/models/object/1337/small_box/40002.txt diff --git a/newmodels_reborn/models/object/1337/big_box/40001.col b/newmodels_reborn/models/object/1337/big_box/40001.col new file mode 100644 index 0000000000000000000000000000000000000000..fd769361fe35f5878ea0fa175ec81bdaed301114 GIT binary patch literal 264 zcmYk0%?-jZ4255QNG}Y*46s0?!VQTLkb0>&apAxWoEU;ZGFi)KO4K;ApY!=SN`E;Y zOEjKd(B19QC0!_Vh&*?tF2s52KDp|<}83xzNC literal 0 HcmV?d00001 diff --git a/newmodels_reborn/models/object/1337/big_box/40001.dff b/newmodels_reborn/models/object/1337/big_box/40001.dff new file mode 100644 index 0000000000000000000000000000000000000000..96cd6d382479f5285ef694dcb69ec082a9b8897b GIT binary patch literal 1807 zcmd5+yG|QH6g|eq5FU(v1?YEyD6gfd-XfQ+MX0J^;+`^WGm-J$LALe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~cjq`-p>g`kjpq@ILutlO_>)9%PJk6_d`ZV=R<~M zbOxN+*^&rwuP${u6)lt}rt`rY6t~y?5$5+ohB~Rj=Xyo^qGhd}Gssc1Egtz~9weXrITE)aRt}p0uJCC$Z-2 oo7vv?U{KTyj0$Q&F`15rqU`a>;`?9Dk+S_3HG++$z<_G|U*y#@R{#J2 literal 0 HcmV?d00001 diff --git a/newmodels_reborn/models/object/1337/small_box/40002.dff b/newmodels_reborn/models/object/1337/small_box/40002.dff new file mode 100644 index 0000000000000000000000000000000000000000..88f228371503f437d2994a78e582e2c2fa824fe3 GIT binary patch literal 1809 zcmd5+%}$d+6g~X|EVh17XbZOTBMTSC1)8`asSDF}6CVHs3?X1maN~||!2@*R1DNO= z;Jz=y1Gsi)f_$Dc^IgAb({{}yr}x}@&)m*@Gjk&VrFkGp3e6n(L&7+z8&&?E5*FVJ zI1qQ7=>N}bKjDzHK&%p~dH4HW{z1w=e|&#_zJK`X%Q^$k=dwR7rUEVU5fKHsU#zA= zFOYK^*kN9}e!rjGC-{#w_<5UL@}tE=E)nE`jbAZzZ94Lofa!hQ>*J2M1L|EJr}KJT z`}$_%q4!N^R`pchbY^GjDL0+j5k1p>U(!j;F>5_cXL_9(kVny7j}qp=L&gHi(DhhE z#hq>yk-Gs)s9~A$71Z5TYG4gb`s--nF>M&07ZoctxzY}OeZhDJN@|Cl^@kw?#Wlc8M^0LM)Cp!(&3d$QF zw_(n>Y{-WTJh2~yH6;1Q)nM4qa23Q_DW{<>Np8O1x&FYr$GRGEM>p*)VRecrpUdTV zBeTYMcyW4kcJbkOmoddnN9t~^tZJyiX&67?WfQNKvb8I(JGhfVzJ_9|ts1J&Defg` zU)rl)Lz!44)UYdrnzZYSv`d6uMvYh@)M)EOgU}0EBh+8@O7v~ogkH)9u}N$Z+k{@s tUpD7(kALWYWn6pd^?I+n-EMN9p#45e*Qf6orJTkMeM^n;^HEHD`UmQ1&rARS literal 0 HcmV?d00001 diff --git a/newmodels_reborn/models/object/1337/small_box/40002.txt b/newmodels_reborn/models/object/1337/small_box/40002.txt new file mode 100644 index 0000000..ec6e287 --- /dev/null +++ b/newmodels_reborn/models/object/1337/small_box/40002.txt @@ -0,0 +1 @@ +txd=object/1337/boxes.txd \ No newline at end of file diff --git a/newmodels_reborn/scripts/core/server_logic.lua b/newmodels_reborn/scripts/core/server_logic.lua index 91d5451..e7448ef 100644 --- a/newmodels_reborn/scripts/core/server_logic.lua +++ b/newmodels_reborn/scripts/core/server_logic.lua @@ -1,8 +1,15 @@ +-- Apologies for the excess if statements, I'll clean this up later. + local CUSTOM_MODEL_SETTINGS = { ["disableAutoFree"] = true, ["disableTXDTextureFiltering"] = true, ["enableDFFAlphaTransparency"] = true, } +-- Additionally, model settings .txt can contain path to txd, dff, and col files. + +local function stringStartswith(str, start) + return str:sub(1, #start) == start +end local function loadModels() if not pathIsDirectory("models") then @@ -14,7 +21,6 @@ local function loadModels() end for _, modelType in pairs({"vehicle", "object", "ped"}) do local modelTypePath = "models/" .. modelType - -- Directory is optional, user might not have any custom models for this type if pathIsDirectory(modelTypePath) then local filesAndFoldersHere = pathListDir(modelTypePath) if not filesAndFoldersHere then @@ -37,42 +43,57 @@ local function loadModels() local fileType = string.sub(thisFileName, -3) if (fileType == "dff" or fileType == "txd" or fileType == "col" or fileType == "txt") then local customModel = tonumber(string.sub(thisFileName, 1, -5)) - if not customModel then - return false, "invalid " .. modelType .. " custom model: " .. thisFileName - end - if not customModelInfo[customModel] then - if isDefaultID(modelType, customModel) then - return false, "custom " .. modelType .. " model is a default ID: " .. customModel - end - if customModels[customModel] then - return false, "duplicate " .. modelType .. " custom model: " .. customModel - end - customModelInfo[customModel] = {} - end - if fileType == "txt" then - local file = fileOpen(thisFullPath, true) - if not file then - return false, "failed to open file: " .. thisFullPath - end - local info = fileGetContents(file, false) - fileClose(file) - if not info then - return false, "failed to read file: " .. thisFullPath - end - local customModelSettings = {} - local lines = split(info, "\n") - for _, settingName in pairs(lines) do - settingName = settingName:gsub("\r", "") - local settingType = CUSTOM_MODEL_SETTINGS[settingName] - if settingType then - customModelSettings[settingName] = true + if customModel then + if not customModelInfo[customModel] then + if isDefaultID(modelType, customModel) then + return false, "custom " .. modelType .. " model is a default ID: " .. customModel + end + if customModels[customModel] then + return false, "duplicate " .. modelType .. " custom model: " .. customModel end + customModelInfo[customModel] = {} end - customModelInfo[customModel].settings = customModelSettings - else - customModelInfo[customModel][fileType] = thisFullPath - if name then - customModelInfo[customModel].name = name + if fileType == "txt" then + local file = fileOpen(thisFullPath, true) + if not file then + return false, "failed to open file: " .. thisFullPath + end + local info = fileGetContents(file, false) + fileClose(file) + if not info then + return false, "failed to read file: " .. thisFullPath + end + local customModelSettings = {} + local lines = split(info, "\n") + for _, settingStr in pairs(lines) do + settingStr = settingStr:gsub("\r", "") + if CUSTOM_MODEL_SETTINGS[settingStr] then + customModelSettings[settingStr] = true + else + for _, settingModelType in pairs({"txd", "dff", "col"}) do + if stringStartswith(settingStr, settingModelType.."=") then + local settingModelPath = settingStr:sub(5) + local settingModelFullPath = "models/" .. settingModelPath + if not fileExists(settingModelFullPath) then + return false, "setting " .. settingModelType .. " file not found: " .. settingModelPath + end + if customModelInfo[customModel][settingModelType] then + return false, "duplicate " .. settingModelType .. " file for custom " .. modelType .. " model: " .. customModel + end + customModelInfo[customModel][settingModelType] = settingModelFullPath + end + end + end + end + customModelInfo[customModel].settings = customModelSettings + else + if customModelInfo[customModel][fileType] then + return false, "duplicate " .. fileType .. " file for custom " .. modelType .. " model: " .. customModel + end + customModelInfo[customModel][fileType] = thisFullPath + if name then + customModelInfo[customModel].name = name + end end end end @@ -109,6 +130,7 @@ local function loadModels() name = info.name or "Unnamed", settings = info.settings or {}, } + if modelType == "object" then iprint(customModels[customModel]) end end end end