diff --git a/Randomiser/Resources/GlobalFunctions.lua b/Randomiser/Resources/GlobalFunctions.lua index 86b21f3..8afa887 100644 --- a/Randomiser/Resources/GlobalFunctions.lua +++ b/Randomiser/Resources/GlobalFunctions.lua @@ -1,3 +1,9 @@ +-- Override GetPath to fix slashes for us +OriginalGetPath = GetPath +GetPath = function () + return FixSlashes(OriginalGetPath(), false, true) +end + function GetRandomFromTbl(tbl, remove) local i = math.random(#tbl) local result = tbl[i] diff --git a/Randomiser/Resources/HandleCharModel.lua b/Randomiser/Resources/HandleCharModel.lua index fcd8450..bcdeae5 100644 --- a/Randomiser/Resources/HandleCharModel.lua +++ b/Randomiser/Resources/HandleCharModel.lua @@ -1,6 +1,6 @@ local Path = GetPath() -if SettingRandomCharacter and OrigChar and (Path:match("art\\chars\\" .. OrigChar .. "_m%.p3d") or Path:match("art\\chars\\" .. OrigChar:sub(1,1) .. ".-_m%.p3d")) then +if SettingRandomCharacter and OrigChar and (Path:match("art/chars/" .. OrigChar .. "_m%.p3d") or Path:match("art/chars/" .. OrigChar:sub(1,1) .. ".-_m%.p3d")) then local Original = ReadFile("GameData/" .. Path) local ReplacePath = "/GameData/art/chars/" .. GetRandomFromTbl(RandomCharP3DPool, false) .. ".p3d" local Replace = ReadFile(ReplacePath) @@ -18,7 +18,7 @@ else if model:len() > 6 then model = model:sub(1, 6) end - if Path:match("art\\chars\\" .. model .. "_m%.p3d") then + if Path:match("art/chars/" .. model .. "_m%.p3d") then local Original = ReadFile("GameData/" .. Path) local ReplacePath = "/GameData/art/chars/" .. GetRandomFromTbl(RandomCharP3DPool, false) .. ".p3d" local Replace = ReadFile(ReplacePath) @@ -38,7 +38,7 @@ else if model:len() > 6 then model = model:sub(1, 6) end - if Path:match("art\\chars\\" .. model .. "_m%.p3d") then + if Path:match("art/chars/" .. model .. "_m%.p3d") then local Original = ReadFile("GameData/" .. Path) local ReplacePath = "/GameData/art/chars/" .. GetRandomFromTbl(RandomCharP3DPool, false) .. ".p3d" local Replace = ReadFile(ReplacePath) @@ -59,7 +59,7 @@ else if model:len() > 6 then model = model:sub(1, 6) end - if Path:match("art\\chars\\" .. model .. "_m%.p3d") then + if Path:match("art/chars/" .. model .. "_m%.p3d") then local Original = ReadFile("GameData/" .. Path) local ReplacePath = "/GameData/art/chars/" .. GetRandomFromTbl(RandomCharP3DPool, false) .. ".p3d" local Replace = ReadFile(ReplacePath) diff --git a/Randomiser/Resources/HandleMission.lua b/Randomiser/Resources/HandleMission.lua index a4573b2..b1fb72e 100644 --- a/Randomiser/Resources/HandleMission.lua +++ b/Randomiser/Resources/HandleMission.lua @@ -223,7 +223,7 @@ elseif Lidx ~= nil then DebugPrint("Randomising " .. orig .. " to " .. carName) end end - elseif SettingDifferentCellouts and Path:match("level02\\m7l.mfk") then + elseif SettingDifferentCellouts and Path:match("level02/m7l.mfk") then NewFile = NewFile:gsub("cCellA", "cCellA1") NewFile = NewFile .. "LoadDisposableCar(\"art\\cars\\cCellA2.p3d\",\"cCellA2\",\"AI\");\r\n" NewFile = NewFile .. "LoadDisposableCar(\"art\\cars\\cCellA3.p3d\",\"cCellA3\",\"AI\");\r\n" @@ -233,7 +233,7 @@ elseif Lidx ~= nil then else MissionVehicles = {} local TmpCarPool = {table.unpack(RandomCarPoolMission)} - if Path:match("level02\\m7l.mfk") then + if Path:match("level02/m7l.mfk") then NewFile = NewFile:gsub("cCellA", "cCellA1") NewFile = NewFile .. "LoadDisposableCar(\"art\\cars\\cCellA2.p3d\",\"cCellA2\",\"AI\");\r\n" NewFile = NewFile .. "LoadDisposableCar(\"art\\cars\\cCellA3.p3d\",\"cCellA3\",\"AI\");\r\n"