diff --git a/lua/autorun/trackassembly_init.lua b/lua/autorun/trackassembly_init.lua index 2c6b9f05..0383b057 100644 --- a/lua/autorun/trackassembly_init.lua +++ b/lua/autorun/trackassembly_init.lua @@ -84,7 +84,7 @@ local asmlib = trackasmlib; if(not asmlib) then -- Module present ------------ CONFIGURE ASMLIB ------------ asmlib.InitBase("track","assembly") -asmlib.SetOpVar("TOOL_VERSION","8.766") +asmlib.SetOpVar("TOOL_VERSION","8.767") ------------ CONFIGURE GLOBAL INIT OPVARS ------------ @@ -1659,10 +1659,10 @@ asmlib.CreateTable("PIECES",{ local noTY = asmlib.GetOpVar("MISS_NOTP") local noSQL = asmlib.GetOpVar("MISS_NOSQL") local trCls = asmlib.GetOpVar("TRACE_CLASS") - arLine[2] = asmlib.GetVacant(arLine[2], true, noTY, asmlib.Categorize()) - arLine[3] = asmlib.GetVacant(arLine[3], true, noMD, asmlib.ModelToName(arLine[1])) - arLine[8] = asmlib.GetVacant(arLine[8], true, noSQL, noSQL) - if(not (asmlib.IsNull(arLine[8]) or trCls[arLine[8]] or asmlib.IsBlank(arLine[8]))) then + arLine[2] = asmlib.GetEmpty(arLine[2], nil, 2, asmlib.Categorize(), noTY) + arLine[3] = asmlib.GetEmpty(arLine[3], nil, 2, asmlib.ModelToName(arLine[1]), noMD) + arLine[8] = asmlib.GetEmpty(arLine[8], nil, 2, noSQL, noSQL) + if(not (asmlib.IsNull(arLine[8]) or asmlib.IsBlank(arLine[8]) or trCls[arLine[8]])) then asmlib.LogInstance("Register trace "..asmlib.GetReport2(arLine[8],arLine[1]),vSrc) trCls[arLine[8]] = true; -- Register the class provided to the trace hit list end; return true @@ -1786,7 +1786,7 @@ asmlib.CreateTable("PHYSPROPERTIES",{ Trigs = { Record = function(arLine, vSrc) local noTY = asmlib.GetOpVar("MISS_NOTP") - arLine[1] = asmlib.GetVacant(arLine[1],true,noTY,asmlib.Categorize()); return true + arLine[1] = asmlib.GetEmpty(arLine[1],nil,asmlib.Categorize(),noTY); return true end }, Cache = { diff --git a/lua/trackassembly/trackasmlib.lua b/lua/trackassembly/trackasmlib.lua index 5486bde0..701091c5 100644 --- a/lua/trackassembly/trackasmlib.lua +++ b/lua/trackassembly/trackasmlib.lua @@ -1594,7 +1594,7 @@ function NewPOA() return (mRaw and mRaw or sE) end function self:Decode(sStr, ...) - local bV, sS = GetVacant(sStr) -- Default to string + local bV, sS = GetEmpty(sStr) -- Default to string if(bV) then -- Check when entry data is vacant self:Set(...) -- Override with the default value provided else -- Entry data is missing use default otherwise decode the value @@ -1820,8 +1820,8 @@ function SetComboBoxClipboard(pnCombo) local sV = pnCombo:GetValue() local iD = pnCombo:GetSelectedID() local sT = pnCombo:GetOptionText(iD) - local sS = GetVacant(tostring(sT or ""), true, sS) - SetClipboardText(GetVacant(sS, true, gsNoAV)) + local sS = GetEmpty(sT, nil, 2, sV, gsNoAV) + SetClipboardText(sS) end function SetComboBoxList(cPanel, sVar) @@ -2324,25 +2324,6 @@ end ------------- VARIABLE INTERFACES -------------- ---[[ - * Returns a string term whenever it is missing or disabled - * If these conditions are not met the function returns missing token - * sBas > The string to check whenever it is disabled or missing - * vDef > The default value to return when base is not string - * vDsb > The disable value to return when the base is disabled string -]] -function GetVacant(sBas, bTer, vDef, vDsb) - local sD = GetOpVar("OPSYM_DISABLE") - local sS = tostring(sBas or "") -- Default to string - local bD = (sS:sub(1,1) == sD) -- Disabled string - local bE = (IsBlank(sS) or IsNull(sS) or bD) - if(not bTer) then return bE, sS end -- Data to be decoded - local sM = GetOpVar("MISS_NOAV") -- Not available - if(bD) then return tostring(vDsb or sM) end - if(bE) then return tostring(vDef or sM) end - return sS -- Return the base string -end - --[[ * Returns a string term whenever it is missing or disabled * If these conditions are not met the function returns missing token @@ -2628,10 +2609,11 @@ function CreateTable(sTable,defTab,bDelete,bReload) defRow[1], defRow[2] = sN, sT -- Convert settings to string and store back end local self, tabDef, tabCmd = {}, defTab, {} - local symDis, sMoDB = GetOpVar("OPSYM_DISABLE"), GetOpVar("MODE_DATABASE") + local sMoDB = GetOpVar("MODE_DATABASE") + local symDis = GetOpVar("OPSYM_DISABLE") for iCnt = 1, defTab.Size do local defCol = defTab[iCnt] - defCol[3] = GetVacant(tostring(defCol[3] or symDis), true, symDis) - defCol[4] = GetVacant(tostring(defCol[4] or symDis), true, symDis) + defCol[3] = GetEmpty(defCol[3], nil, 1, symDis) + defCol[4] = GetEmpty(defCol[4], nil, 1, symDis) end; tableInsert(libQTable, defTab.Nick) libCache[defTab.Name] = {}; libQTable[defTab.Nick] = self -- Read table definition @@ -4489,13 +4471,12 @@ function AttachAdditions(ePiece) LogInstance("Model skip <"..sMoc..">"); return true end local makTab, iCnt = GetBuilderNick("ADDITIONS"), 1; if(not IsHere(makTab)) then LogInstance("Missing table definition"); return nil end - local sD, oPOA = GetOpVar("OPSYM_DISABLE"), NewPOA() - LogInstance("PIECE:MODEL("..sMoc..")") + LogInstance("PIECE:MODEL("..sMoc..")") -- Start adding attachments while(stData[iCnt]) do -- While additions are present keep adding them local arRec = stData[iCnt]; LogInstance("PIECE:ADDITION("..iCnt..")") - local bVac, sCas = GetVacant(arRec[makTab:GetColumnName(3)]) - if(bVac) then sCas = GetOpVar("ENTITY_DEFCLASS") end - local eBonus = entsCreate(sCas); LogInstance("ents.Create("..sCas..")") + local dCass, oPOA = GetOpVar("ENTITY_DEFCLASS"), NewPOA() + local sCass = GetEmpty(arRec[makTab:GetColumnName(3)], nil, 1, dCass) + local eBonus = entsCreate(sCass); LogInstance("ents.Create("..sCass..")") if(eBonus and eBonus:IsValid()) then local sMoa = tostring(arRec[makTab:GetColumnName(2)]) if(not IsModel(sMoa, true)) then @@ -4503,14 +4484,14 @@ function AttachAdditions(ePiece) eBonus:SetModel(sMoa) LogInstance("ENT:SetModel("..sMoa..")") local oPos = arRec[makTab:GetColumnName(5)]; if(not IsString(oPos)) then LogInstance("Position mismatch "..GetReport3(iCnt, sMoc, oPos)); return false end - if(not GetVacant(oPos)) then -- Scan the extracted entry for data + if(not GetEmpty(oPos)) then -- Scan the extracted entry for data vPos:SetUnpacked(oPOA:Decode(oPos):Get()) vPos:Set(ePiece:LocalToWorld(vPos)) eBonus:SetPos(vPos); LogInstance("ENT:SetPos(DB)") else eBonus:SetPos(ePos); LogInstance("ENT:SetPos(PIECE:POS)") end local oAng = arRec[makTab:GetColumnName(6)]; if(not IsString(oAng)) then LogInstance("Angle mismatch "..GetReport(iCnt, sMoc, oAng)); return false end - if(not GetVacant(oAng)) then -- Scan the extracted entry for data + if(not GetEmpty(oAng)) then -- Scan the extracted entry for data aAng:SetUnpacked(oPOA:Decode(oAng):Get()) aAng:Set(ePiece:LocalToWorldAngles(aAng)) eBonus:SetAngles(aAng); LogInstance("ENT:SetAngles(DB)") @@ -4676,7 +4657,7 @@ function NewPiece(pPly,sModel,vPos,aAng,nMass,sBgSkIDs,clColor,sMode) if(InSpawnMargin(pPly, stData, vPos, aAng)) then LogInstance("Spawn margin stop <"..sModel..">"); return nil end local sClass = GetOpVar("ENTITY_DEFCLASS") - local ePiece = entsCreate(GetVacant(stData.Unit, true, sClass, sClass)) + local ePiece = entsCreate(GetEmpty(stData.Unit, nil, 1, sClass)) if(not (ePiece and ePiece:IsValid())) then -- Create the piece unit LogInstance("Piece invalid <"..tostring(ePiece)..">"); return nil end ePiece:SetCollisionGroup(COLLISION_GROUP_NONE) diff --git a/lua/weapons/gmod_tool/stools/trackassembly.lua b/lua/weapons/gmod_tool/stools/trackassembly.lua index ee53419b..f416832f 100644 --- a/lua/weapons/gmod_tool/stools/trackassembly.lua +++ b/lua/weapons/gmod_tool/stools/trackassembly.lua @@ -2402,7 +2402,7 @@ function TOOL.BuildCPanel(CPanel) local pComboPhysName = CPanel:ComboBox(languageGetPhrase("tool."..gsToolNameL..".phyname_con"), sName) pComboPhysName:SetTooltip(languageGetPhrase("tool."..gsToolNameL..".phyname")) - pComboPhysName:SetValue(asmlib.GetVacant(asmlib.GetAsmConvar("physmater","STR"), true, + pComboPhysName:SetValue(asmlib.GetEmpty(asmlib.GetAsmConvar("physmater","STR"), nil, 1, languageGetPhrase("tool."..gsToolNameL..".phyname_def"))) pComboPhysName.DoRightClick = function(pnSelf) asmlib.SetComboBoxClipboard(pnSelf) end pComboPhysName:Dock(TOP) -- Setting tallness gets ignored otherwise @@ -2437,7 +2437,7 @@ function TOOL.BuildCPanel(CPanel) local sName = asmlib.GetAsmConvar("bgskids", "NAM") local pText = CPanel:TextEntry(languageGetPhrase("tool."..gsToolNameL..".bgskids_con"), sName) pText:SetTooltip(languageGetPhrase("tool."..gsToolNameL..".bgskids")) - pText:SetText(asmlib.GetVacant(asmlib.GetAsmConvar("bgskids", "STR"), true, + pText:SetText(asmlib.GetEmpty(asmlib.GetAsmConvar("bgskids", "STR"), nil, 1, languageGetPhrase("tool."..gsToolNameL..".bgskids_def"))) pText:SetEnabled(false); pText:SetTall(22)