Skip to content

Commit

Permalink
Updated: Export type autorun is dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdvideo1234 committed Jan 26, 2024
1 parent 33e7fb3 commit 683f295
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
2 changes: 1 addition & 1 deletion lua/autorun/trackassembly_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ local asmlib = trackasmlib; if(not asmlib) then -- Module present
------------ CONFIGURE ASMLIB ------------

asmlib.InitBase("track","assembly")
asmlib.SetOpVar("TOOL_VERSION","8.744")
asmlib.SetOpVar("TOOL_VERSION","8.745")
asmlib.SetIndexes("V" ,1,2,3)
asmlib.SetIndexes("A" ,1,2,3)
asmlib.SetIndexes("WV",1,2,3)
Expand Down
54 changes: 29 additions & 25 deletions lua/trackassembly/trackasmlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ function WorkshopID(sKey, sID)
LogInstance("Invalid "..GetReport(sKey)); return nil end
local sWS = tID[sKey] -- Read the value under the key
if(sID) then local sPS = tostring(sID or "") -- Convert argument
local nS, nE = sPS:find(GetOpVar("PATTEM_WORKSHID")) -- Check ID
local nS, nE = sPS:find(GetOpVar("PATCHK_WORKSHID")) -- Check ID
if(nS and nE) then -- The number meets the format
if(not sWS) then tID[sKey], sWS = sPS, sPS else -- Update value
LogInstance("("..sKey..") Exists "..GetReport2(sWS, sID))
Expand Down Expand Up @@ -806,12 +806,14 @@ function InitBase(sName, sPurp)
if(oEnt and oEnt:IsValid() and oEnt ~= GetOpVar("TRACE_FILTER") and
GetOpVar("TRACE_CLASS")[oEnt:GetClass()]) then return true end end })
SetOpVar("CONSTRAINT_LIST", {"Weld", "AdvBallsocket", "NoCollide"})
SetOpVar("PATTEX_CATEGORY", "%s*local%s+myCategory%s*=%s*")
SetOpVar("PATTEX_WORKSHID", "%s*asmlib%.WorkshopID%s*")
SetOpVar("PATTEX_TABLEDPS", "%s*local%s+myPieces%s*=%s*")
SetOpVar("PATTEX_TABLEDAD", "%s*local%s+myAdditions%s*=%s*")
SetOpVar("PATTEX_VARADDON", "%s*local%s+myAddon%s*=%s*")
SetOpVar("PATTEM_WORKSHID", "^%d+$")
SetOpVar("PATTEX_LOCALFMT", {"%s*local%s+", "%s*=%s*"})
SetOpVar("PATTEX_TRAKTYPE", "myType")
SetOpVar("PATTEX_CATEGORY", "myCategory")
SetOpVar("PATTEX_TABLEDPS", "myPieces")
SetOpVar("PATTEX_TABLEDAD", "myAdditions")
SetOpVar("PATTEX_VARADDON", "myAddon")
SetOpVar("PATTEX_FWRKSHID", "asmlib.WorkshopID")
SetOpVar("PATCHK_WORKSHID", "^%d+$")
SetOpVar("HOVER_TRIGGER" , {})
if(CLIENT) then
SetOpVar("TABLE_IHEADER", {name = "", stage = 0, op = 0, icon = "", icon2 = ""})
Expand Down Expand Up @@ -3967,40 +3969,42 @@ function ExportTypeAR(sType)
fE:Flush(); fE:Close(); fS:Close(); return
end
if(IsHere(qPieces) and IsHere(qPieces[1])) then
local patCateg = GetOpVar("PATTEX_CATEGORY")
local patWorks = GetOpVar("PATTEX_WORKSHID")
local patPiece = GetOpVar("PATTEX_TABLEDPS")
local patAddit = GetOpVar("PATTEX_TABLEDAD")
local patAddon = GetOpVar("PATTEX_VARADDON")
local fmSerch = GetOpVar("PATTEX_LOCALFMT")
local vrTrTyp = GetOpVar("PATTEX_TRAKTYPE")
local vrCateg = GetOpVar("PATTEX_CATEGORY")
local vrWorks = GetOpVar("PATTEX_FWRKSHID")
local vrPiece = GetOpVar("PATTEX_TABLEDPS")
local vrAddit = GetOpVar("PATTEX_TABLEDAD")
local vrAddon = GetOpVar("PATTEX_VARADDON")
local keyBuild = GetOpVar("KEYQ_BUILDER"); qPieces[keyBuild] = makP
local sLine, isEOF, isSkip, sInd, qAdditions = "", false, false, " ", {}
while(not isEOF) do
sLine, isEOF = GetStringFile(fS, true)
sLine = sLine:gsub("%s*$", "")
if(sLine:find(patAddon)) then isSkip = true
fE:Write("local myAddon = \""..sType.."\"\n")
elseif(sLine:find(patCateg)) then isSkip = true
if(sLine:find(fmSerch[1]..vrAddon..fmSerch[2])) then isSkip = true
fE:Write("local "..vrAddon.." = \""..sType.."\"\n")
elseif(sLine:find(fmSerch[1]..vrCateg..fmSerch[2])) then isSkip = true
local tCat = GetOpVar("TABLE_CATEGORIES")[sType]
if(IsTable(tCat) and tCat.Txt) then
fE:Write("local myCategory = {\n")
fE:Write(sInd:rep(1).."[myType] = {Txt = [[\n")
fE:Write("local "..vrCateg.." = {\n")
fE:Write(sInd:rep(1).."["..vrTrTyp.."] = {Txt = [[\n")
fE:Write(sInd:rep(2)..tCat.Txt:gsub("\n","\n"..sInd:rep(2)).."\n")
fE:Write(sInd:rep(1).."]]}\n")
fE:Write("}\n")
else
fE:Write("local myCategory = {}\n")
fE:Write("local "..vrCateg.." = {}\n")
end
elseif(sLine:find(patWorks)) then isSkip = true
elseif(sLine:find(vrWorks, 1, true)) then isSkip = true
local sID = WorkshopID(sType)
if(sID and sID:len() > 0) then
fE:Write("asmlib.WorkshopID(myAddon, \""..sID.."\")\n")
fE:Write(vrWorks.."("..vrAddon..", \""..sID.."\")\n")
else
fE:Write("asmlib.WorkshopID(myAddon)\n")
fE:Write(vrWorks.."("..vrAddon..")\n")
end
elseif(sLine:find(patPiece)) then isSkip = true
ExportPiecesAR(fE, qPieces, "myPieces", sInd, qAdditions)
elseif(sLine:find(patAddit)) then isSkip = true
ExportPiecesAR(fE, qAdditions, "myAdditions", sInd)
elseif(sLine:find(fmSerch[1]..vrPiece..fmSerch[2])) then isSkip = true
ExportPiecesAR(fE, qPieces, vrPiece, sInd, qAdditions)
elseif(sLine:find(fmSerch[1]..vrAddit..fmSerch[2])) then isSkip = true
ExportPiecesAR(fE, qAdditions, vrAddit, sInd)
else
if(isSkip and IsBlank(sLine:Trim())) then isSkip = false end
end
Expand Down

0 comments on commit 683f295

Please sign in to comment.