Skip to content

Commit

Permalink
Updated: Hooks factorization
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdvideo1234 committed May 14, 2018
1 parent a89505b commit 4025e1a
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions lua/autorun/gearassembly_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local asmlib = gearasmlib

------ CONFIGURE ASMLIB ------
asmlib.InitBase("gear","assembly")
asmlib.SetOpVar("TOOL_VERSION","5.215")
asmlib.SetOpVar("TOOL_VERSION","5.216")
asmlib.SetIndexes("V",1,2,3)
asmlib.SetIndexes("A",1,2,3)
asmlib.SetIndexes("S",4,5,6,7)
Expand Down Expand Up @@ -155,7 +155,7 @@ if(CLIENT) then
if(not devmode) then
return asmlib.StatusLog(nil,"RESET_VARIABLES: Developer mode disabled") end
asmlib.SetLogControl(asmlib.GetAsmVar("logsmax" , "INT"), asmlib.GetAsmVar("logfile" , "STR"))
if(bgskids == "reset cvars") then -- Reset the limit also
if(bgskids == "reset cvars") then -- Reset also the maximum spawned pieces
oPly:ConCommand("sbox_max"..asmlib.GetOpVar("CVAR_LIMITNAME").." 1500\n")
local anchor = asmlib.GetOpVar("MISS_NOID")..
asmlib.GetOpVar("OPSYM_REVSIGN")..
Expand Down Expand Up @@ -196,8 +196,7 @@ if(CLIENT) then
asmlib.PrintInstance("RESET_VARIABLES: Variables reset complete")
elseif(bgskids:sub(1,7) == "delete ") then
local tPref = (" "):Explode(bgskids:sub(8,-1))
for iCnt = 1, #tPref do
local vPr = tPref[iCnt]
for iCnt = 1, #tPref do local vPr = tPref[iCnt]
asmlib.RemoveDSV("PIECES",vPr)
asmlib.LogInstance("RESET_VARIABLES: Match <"..vPr..">")
end
Expand All @@ -209,16 +208,11 @@ if(CLIENT) then
function(oPly,oCom,oArgs)
local frUsed, nCount = asmlib.GetFrequentModels(oArgs[1])
if(not asmlib.IsExistent(frUsed)) then
return asmlib.StatusLog(nil,"OPEN_FRAME: Failed to retrieve most frequent models ["..tostring(oArgs[1]).."]")
end
local defTable = asmlib.GetOpVar("DEFTABLE_PIECES")
if(not defTable) then
return asmlib.StatusLog(nil,"OPEN_FRAME: Retrieving most frequent models failed ["..tostring(oArgs[1]).."]") end
local defTable = asmlib.GetOpVar("DEFTABLE_PIECES"); if(not defTable) then
return StatusLog(nil,"OPEN_FRAME: Missing definition for table PIECES") end
local pnFrame = vguiCreate("DFrame")
if(not IsValid(pnFrame)) then
pnFrame:Remove()
return asmlib.StatusLog(nil,"OPEN_FRAME: Failed to create base frame")
end
local pnFrame = vguiCreate("DFrame"); if(not IsValid(pnFrame)) then
pnFrame:Remove(); return asmlib.StatusLog(nil,"OPEN_FRAME: Failed to create base frame") end
local pnElements = asmlib.MakeContainer("FREQ_VGUI")
pnElements:Insert(1,{Label = { "DButton" ,languageGetPhrase("tool."..gsToolNameL..".pn_export_lb") , languageGetPhrase("tool."..gsToolNameL..".pn_export")}})
pnElements:Insert(2,{Label = { "DListView" ,languageGetPhrase("tool."..gsToolNameL..".pn_routine_lb"), languageGetPhrase("tool."..gsToolNameL..".pn_routine")}})
Expand All @@ -233,14 +227,12 @@ if(CLIENT) then
if(not IsValid(vItem.Panel)) then
asmlib.LogInstance("OPEN_FRAME: Failed to create ID #"..tonumber(iNdex))
iNdex, vItem = 1, nil
while(iNdex <= iSize) do
vItem, sItem = pnElements:Select(iNdex), ""
while(iNdex <= iSize) do vItem, sItem = pnElements:Select(iNdex), ""
if(IsValid(vItem.Panel)) then vItem.Panel:Remove(); sItem = "and panel " end
pnElements:Delete(iNdex)
asmlib.LogInstance("OPEN_FRAME: Deleted entry "..sItem.."ID #"..tonumber(iNdex))
iNdex = iNdex + 1
end
pnFrame:Remove(); collectgarbage()
end; pnFrame:Remove(); collectgarbage()
return StatusLog(nil,"OPEN_FRAME: Invalid panel created. Frame removed")
end
vItem.Panel:SetName(vItem.Label[2])
Expand Down

0 comments on commit 4025e1a

Please sign in to comment.