diff --git a/lua/autorun/trackassembly_init.lua b/lua/autorun/trackassembly_init.lua index 92e94b29..c1e2eea8 100644 --- a/lua/autorun/trackassembly_init.lua +++ b/lua/autorun/trackassembly_init.lua @@ -85,7 +85,7 @@ local asmlib = trackasmlib; if(not asmlib) then -- Module present ------------ CONFIGURE ASMLIB ------------ asmlib.InitBase("track","assembly") -asmlib.SetOpVar("TOOL_VERSION","8.738") +asmlib.SetOpVar("TOOL_VERSION","8.739") asmlib.SetIndexes("V" ,1,2,3) asmlib.SetIndexes("A" ,1,2,3) asmlib.SetIndexes("WV",1,2,3) diff --git a/lua/trackassembly/trackasmlib.lua b/lua/trackassembly/trackasmlib.lua index 28c65f74..60d20c54 100644 --- a/lua/trackassembly/trackasmlib.lua +++ b/lua/trackassembly/trackasmlib.lua @@ -105,6 +105,7 @@ local mathSqrt = math and math.sqrt local mathFloor = math and math.floor local mathClamp = math and math.Clamp local mathAtan2 = math and math.atan2 +local mathRemap = math and math.Remap local mathRound = math and math.Round local mathRandom = math and math.random local drawRoundedBox = draw and draw.RoundedBox @@ -397,7 +398,7 @@ function GetOwner(oEnt) ows = oEnt.player; if(IsPlayer(ows)) then return ows else ows = nil end ows = oEnt.Owner; if(IsPlayer(ows)) then return ows else ows = nil end ows = oEnt.owner; if(IsPlayer(ows)) then return ows else ows = nil end - if(set) then -- Duplicator die functions are registered + if(set) then -- Duplicator the functions are registered set = set.GetCountUpdate; ows = (set.Args and set.Args[1] or nil) if(IsPlayer(ows)) then return ows else ows = nil end set = set.undo1; ows = (set.Args and set.Args[1] or nil) @@ -834,6 +835,7 @@ function InitBase(sName, sPurp) SetOpVar("TABLE_WSIDADDON", {}) SetOpVar("ARRAY_GHOST",{Size=0, Slot=GetOpVar("MISS_NOMD")}) SetOpVar("TABLE_CATEGORIES",{}) + SetOpVar("CLIPBOARD_TEXT","") SetOpVar("TREE_KEYPANEL","#$@KEY&*PAN*&OBJ@$#") end; LogInstance("Success"); return true end @@ -1803,7 +1805,7 @@ function SetComboBoxList(cPanel, sVar) end -- Copy the combo box content shown pItem.OnSelect = function(pnSelf, nInd, sVal, anyData) SetAsmConvar(nil, sVar, anyData) - end -- Apply the settinc to the specified variable + end -- Apply the setting to the specified variable for iD = 1, #tSet do local sI = tSet[iD] local sIco = ToIcon(sNam.."_"..sI:lower()) local sPrv = (sBase.."_"..sI:lower()) @@ -1831,7 +1833,7 @@ function SetNumSlider(cPanel, sVar, vDig, vMin, vMax, vDev) -- Read minimum value form the first available if(not IsHere(nMin)) then nMin, nDum = GetBorder(sKey) if(not IsHere(nMin)) then nMin = GetAsmConvar(sVar, "MIN") - if(not IsHere(nMin)) then -- Mininum bound is not located + if(not IsHere(nMin)) then -- Minimum bound is not located nMin = -mathAbs(2 * mathFloor(GetAsmConvar(sVar, "FLT"))) LogInstance("(L) Miss "..GetReport1(sKey)) else LogInstance("(L) Cvar "..GetReport2(sKey, nMin)) end @@ -1874,15 +1876,53 @@ function SetButtonSlider(cPanel, sVar, nMin, nMax, nDec, tBtn) pPanel:SetSlider(sKey, languageGetPhrase(sBase.."_con"), languageGetPhrase(sBase)) pPanel:Configure(nMin, nMax, tConv[sKey], nDec) for iD = 1, #tBtn do - local vBtn, sTip = tBtn[iD] - local sTxt = tostring(vBtn.N):Trim() - if(vBtn.T) then - if(vBtn.T == syRev) then - sTip = languageGetPhrase(sBase.."_bas"..sTxt) - elseif(vBtn.T == syDis) then - sTip = languageGetPhrase("tool."..sTool..".buttonas"..sTxt) - else - sTip = tostring(vBtn.T):Trim() + local vBtn = tBtn[iD] -- Button info + local sTxt = tostring(vBtn.N or syDis):Trim() + local sTip = tostring(vBtn.T or syDis):Trim() + if(sTip:sub(1,1) == syRev) then + sTip = languageGetPhrase(sBase.."_bas"..sTxt) + elseif(sTip:sub(1,1) == syDis) then + sTip = languageGetPhrase("tool."..sTool..".buttonas"..sTxt) + end + if(sTxt:sub(1,1) == syRev) then + local sVam = sTxt:sub(2,-1) + if(tonumber(sVam)) then + local nAmt = (tonumber(sVam) or 0) + if(not vBtn.L) then + vBtn.L=function(pB, pS, nS) pS:SetValue(-nAmt) end + end + if(not vBtn.R) then + vBtn.R=function(pB, pS, nS) pS:SetValue(nAmt) end + end + sTip = languageGetPhrase("tool."..sTool..".buttonas"..syRev).." "..nAmt + elseif(sVam == "D") then + if(not vBtn.L) then + vBtn.L=function(pB, pS, nS) pS:SetValue(pS:GetDefaultValue()) end + end + if(not vBtn.R) then + vBtn.R=function(pB, pS, nS) SetClipboardText(pS:GetDefaultValue()) end + end + elseif(sVam == "M") then + if(not vBtn.L) then + vBtn.L=function(pB, pS, nS) pS:SetValue(tonumber(GetOpVar("CLIPBOARD_TEXT")) or 0) end + end + if(not vBtn.R) then + vBtn.R=function(pB, pS, nS) SetClipboardText(nS); SetOpVar("CLIPBOARD_TEXT", nS) end + end + end + elseif(sTxt == "+/-") then + if(not vBtn.L) then + vBtn.L=function(pB, pS, nS) pS:SetValue(-nS) end + end + if(not vBtn.R) then + vBtn.R=function(pB, pS, nS) pS:SetValue(mathRemap(nS, pS:GetMin(), pS:GetMax(), pS:GetMax(), pS:GetMin())) end + end + elseif(sTxt == "<>") then + if(not vBtn.L) then + vBtn.L=function(pB, pS, nS) pS:SetValue(GetSnap(nS,-GetAsmConvar("incsnpang","FLT"))) end + end + if(not vBtn.R) then + vBtn.R=function(pB, pS, nS) pS:SetValue(GetSnap(nS, GetAsmConvar("incsnpang","FLT"))) end end end pPanel:SetButton(sTxt, sTip) diff --git a/lua/vgui/dasminsliderbutton.lua b/lua/vgui/dasminsliderbutton.lua index 2b7f98a2..23c7a852 100644 --- a/lua/vgui/dasminsliderbutton.lua +++ b/lua/vgui/dasminsliderbutton.lua @@ -167,9 +167,15 @@ function PANEL:SetAction(fLef, fRgh, vIdx) local iIdx = self:GetButtonID(vIdx) if(iIdx == 0) then return self end local pBut, pSer = self.Array[iIdx], self.Slider - pBut.DoClick = function() - local pS, sE = pcall(fLef, pBut, pSer, pSer:GetValue()) - if(not pS) then error("["..pBut:GetText().."]: "..sE) end + if(fLef) then + pBut.DoClick = function() + local pS, sE = pcall(fLef, pBut, pSer, pSer:GetValue()) + if(not pS) then error("["..pBut:GetText().."]: "..sE) end + end + else + if(not pBut.DoClick) then + pBut.DoClick = function() SetClipboardText(pBut:GetText()) end + end end if(fRgh) then pBut.DoRightClick = function() @@ -177,7 +183,9 @@ function PANEL:SetAction(fLef, fRgh, vIdx) if(not pS) then error("["..pBut:GetText().."]: "..sE) end end else - pBut.DoRightClick = function() SetClipboardText(pBut:GetText()) end + if(not pBut.DoRightClick) then + pBut.DoRightClick = function() SetClipboardText(pBut:GetText()) end + end end; return self end diff --git a/lua/weapons/gmod_tool/stools/trackassembly.lua b/lua/weapons/gmod_tool/stools/trackassembly.lua index d993dd71..da226d95 100644 --- a/lua/weapons/gmod_tool/stools/trackassembly.lua +++ b/lua/weapons/gmod_tool/stools/trackassembly.lua @@ -2462,24 +2462,12 @@ function TOOL.BuildCPanel(CPanel) asmlib.SetNumSlider(CPanel, "angsnap" , iMaxDec) asmlib.SetButton(CPanel, "resetvars") local tBAng = { -- Button interactive slider ( angle offsets ) - {N="<>" , T = "#", -- Left click to decrease, right to increase - L=function(pB, pS, nS) pS:SetValue(asmlib.GetSnap(nS,-asmlib.GetAsmConvar("incsnpang","FLT"))) end, - R=function(pB, pS, nS) pS:SetValue(asmlib.GetSnap(nS, asmlib.GetAsmConvar("incsnpang","FLT"))) end}, - {N="+/-" , T = "#", L=function(pB, pS, nS) pS:SetValue(-nS) end}, - {N="@M" , T = "#", L=function(pB, pS, nS) SetClipboardText(nS) end}, - {N="@D" , T = "#", L=function(pB, pS, nS) pS:SetValue(pS:GetDefaultValue()) end}, - {N="@45" , T = "#", L=function(pB, pS, nS) pS:SetValue(asmlib.GetSign((nS < 0) and nS or (nS+1))* 45) end}, - {N="@90" , T = "#", L=function(pB, pS, nS) pS:SetValue(asmlib.GetSign((nS < 0) and nS or (nS+1))* 90) end}, - {N="@135", T = "#", L=function(pB, pS, nS) pS:SetValue(asmlib.GetSign((nS < 0) and nS or (nS+1))*135) end}, - {N="@180", T = "#", L=function(pB, pS, nS) pS:SetValue(asmlib.GetSign((nS < 0) and nS or (nS+1))*180) end} - } + {N="<>" }, {N="+/-"}, {N="@M" }, {N="@D" }, + {N="@45"}, {N="@90"}, {N="@135"}, {N="@180"} + } -- Use the same initialization table for multiple BIS local tBpos = { -- Button interactive slider ( position offsets ) - {N="<>" , T = "#", -- Left click to decrease, right to increase - L=function(pB, pS, nS) pS:SetValue(asmlib.GetSnap(nS,-asmlib.GetAsmConvar("incsnplin","FLT"))) end, - R=function(pB, pS, nS) pS:SetValue(asmlib.GetSnap(nS, asmlib.GetAsmConvar("incsnplin","FLT"))) end}, - {N="+/-", T = "#", L=function(pB, pS, nS) pS:SetValue(-nS) end}, - {N="@M" , T = "#", L=function(pB, pS, nS) SetClipboardText(nS) end}, - {N="@D" , T = "#", L=function(pB, pS, nS) pS:SetValue(pS:GetDefaultValue()) end} + {N="<>" }, {N="+/-"}, {N="@M" }, {N="@D" }, + {N="@25"}, {N="@50"}, {N="@75" }, {N="@100"} } -- Use the same initialization table for multiple BIS asmlib.SetButtonSlider(CPanel, "nextpic", -gnMaxRot, gnMaxRot, iMaxDec, tBAng) asmlib.SetButtonSlider(CPanel, "nextyaw", -gnMaxRot, gnMaxRot, iMaxDec, tBAng) diff --git a/resource/localization/bg/trackassembly.properties b/resource/localization/bg/trackassembly.properties index cc2f9466..7a349049 100644 --- a/resource/localization/bg/trackassembly.properties +++ b/resource/localization/bg/trackassembly.properties @@ -257,10 +257,7 @@ tool.trackassembly.buttonas<>=Намали/Увеличи tool.trackassembly.buttonas+/-=Обърни знака tool.trackassembly.buttonas@M=Запомни стойност tool.trackassembly.buttonas@D=Дефолтна стойност -tool.trackassembly.buttonas@45=Обнови 45 -tool.trackassembly.buttonas@90=Обнови 90 -tool.trackassembly.buttonas@135=Обнови 135 -tool.trackassembly.buttonas@180=Обнови 180 +tool.trackassembly.buttonas@=Приложи стойност\: sbox_maxasmtracks=Променете тук за да настроите нещата които са създадени от инструмента на сървъра sbox_maxasmtracks_con=Общо сегменти\: Cleanup_asmtracks=Сглобени парчета трасе diff --git a/resource/localization/en/trackassembly.properties b/resource/localization/en/trackassembly.properties index 28d977d5..7d46bd12 100644 --- a/resource/localization/en/trackassembly.properties +++ b/resource/localization/en/trackassembly.properties @@ -257,10 +257,7 @@ tool.trackassembly.buttonas<>=Decrement/Increment tool.trackassembly.buttonas+/-=Negate value tool.trackassembly.buttonas@M=Memorize value tool.trackassembly.buttonas@D=Default value -tool.trackassembly.buttonas@45=Update 45 -tool.trackassembly.buttonas@90=Update 90 -tool.trackassembly.buttonas@135=Update 135 -tool.trackassembly.buttonas@180=Update 180 +tool.trackassembly.buttonas@=Apply value\: sbox_maxasmtracks=Change this to adjust the things spawned via track assembly tool on the server sbox_maxasmtracks_con=Total segments\: Cleanup_asmtracks=Assembled track pieces diff --git a/resource/localization/ru/trackassembly.properties b/resource/localization/ru/trackassembly.properties index d6e9d8d8..55e13c0d 100644 --- a/resource/localization/ru/trackassembly.properties +++ b/resource/localization/ru/trackassembly.properties @@ -119,10 +119,7 @@ tool.trackassembly.buttonas<>=Уменьшить/Увеличить tool.trackassembly.buttonas+/-=Начение по умолчаниюз tool.trackassembly.buttonas@M=Запомнить стоимость tool.trackassembly.buttonas@D=Значение по умолчанию -tool.trackassembly.buttonas@45=Обновить 45 -tool.trackassembly.buttonas@90=Обновить 90 -tool.trackassembly.buttonas@135=Обновить 135 -tool.trackassembly.buttonas@180=Обновить 180 +tool.trackassembly.buttonas@=Применять стоимость\: Cleanup_asmtracks=Собранные куски дороги Cleaned_asmtracks=Все куски дороги очищены SBoxLimit_asmtracks=Вы достигли предела созданных кусков дороги!