From dea608711345c6db1f0927af4722d8afac47f781 Mon Sep 17 00:00:00 2001 From: Deyan Dobromirov Date: Sun, 10 Dec 2017 19:37:38 +0200 Subject: [PATCH] Updated: Drawing relation assist now displays all the track ends Updated: Intersect ray clear now outputs the entity if valid --- lua/autorun/trackassembly_init.lua | 2 +- lua/trackassembly/trackasmlib.lua | 2 +- .../gmod_tool/stools/trackassembly.lua | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lua/autorun/trackassembly_init.lua b/lua/autorun/trackassembly_init.lua index 61d311b0..28ad5679 100644 --- a/lua/autorun/trackassembly_init.lua +++ b/lua/autorun/trackassembly_init.lua @@ -33,7 +33,7 @@ local asmlib = trackasmlib ------ CONFIGURE ASMLIB ------ asmlib.InitBase("track","assembly") -asmlib.SetOpVar("TOOL_VERSION","5.424") +asmlib.SetOpVar("TOOL_VERSION","5.425") asmlib.SetIndexes("V",1,2,3) asmlib.SetIndexes("A",1,2,3) asmlib.SetIndexes("S",4,5,6,7) diff --git a/lua/trackassembly/trackasmlib.lua b/lua/trackassembly/trackasmlib.lua index 3c4ce9ff..225ff0c8 100644 --- a/lua/trackassembly/trackasmlib.lua +++ b/lua/trackassembly/trackasmlib.lua @@ -3358,7 +3358,7 @@ function IntersectRayCreate(oPly, oEnt, vHit, sKey) tRay[sKey] = {Org = Vector(), Dir = Angle(), -- Local direction and origin Orw = Vector(), Diw = Angle(), -- World direction and origin ID = trID , Ent = oEnt , -- Point ID and entity relation - Key = sKey , Ply = oPly , + Key = sKey , Ply = oPly , -- Key and player to be stored POA = trPOA , Rec = trRec , Min = trMin}; stRay = tRay[sKey] else -- Update internal settings stRay.Key = sKey diff --git a/lua/weapons/gmod_tool/stools/trackassembly.lua b/lua/weapons/gmod_tool/stools/trackassembly.lua index 3a234aff..36d66d12 100644 --- a/lua/weapons/gmod_tool/stools/trackassembly.lua +++ b/lua/weapons/gmod_tool/stools/trackassembly.lua @@ -304,12 +304,13 @@ function TOOL:IntersectClear(bMute) local stRay = asmlib.IntersectRayRead(oPly, "ray_relate") if(stRay) then asmlib.IntersectRayClear(oPly, "ray_relate") - if(SERVER) then local ryEnt = stRay.Ent + if(SERVER) then local ryEnt, sRel = stRay.Ent netStart(gsLibName.."SendIntersectClear"); netWriteEntity(oPly); netSend(oPly) - if(ryEnt and ryEnt:IsValid()) then ryEnt:SetColor(conPalette:Select("w")) end - if(not bMute) then -- Send client messages when not muted - asmlib.LogInstance("TOOL:IntersectClear: Relation cleared") - asmlib.PrintNotifyPly(oPly,"Intersection relation clear !","CLEANUP") + if(ryEnt and ryEnt:IsValid()) then ryEnt:SetColor(conPalette:Select("w")) + sRel = ryEnt:EntIndex()..gsSymRev..ryEnt:GetModel():GetFileFromFilename() end + if(not bMute) then sRel = (sRel and (": "..tostring(sRel)) or "") + asmlib.LogInstance("TOOL:IntersectClear: Relation cleared"..sRel) + asmlib.PrintNotifyPly(oPly,"Intersect relation clear"..sRel.." !","CLEANUP") end -- Make sure to delete the relation on both client and server end end; return true @@ -323,8 +324,8 @@ function TOOL:IntersectRelate(oPly, oEnt, vHit) if(SERVER) then -- Only the server is allowed to define relation ray netStart(gsLibName.."SendIntersectRelate") netWriteEntity(oEnt); netWriteVector(vHit); netWriteEntity(oPly); netSend(oPly) - local femod = oEnt:GetModel():GetFileFromFilename() - asmlib.PrintNotifyPly(oPly,"Intersection relation: "..femod.." !","UNDO") + local sRel = oEnt:EntIndex()..gsSymRev..oEnt:GetModel():GetFileFromFilename() + asmlib.PrintNotifyPly(oPly,"Intersect relation set: "..sRel.." !","UNDO") stRay.Ent:SetColor(conPalette:Select("ry")) end return true end @@ -905,12 +906,12 @@ function TOOL:DrawRelateAssist(oScreen, trHit, trEnt, plyd, rm, rc) for ID = 1, trRec.Kept do local stPOA = asmlib.LocatePOA(trRec,ID); if(not stPOA) then return asmlib.StatusLog(nil,"TOOL:DrawRelateAssist: Cannot locate #"..tostring(ID)) end - asmlib.SetVector(vTmp,stPOA.O); vTmp:Rotate(trAng); vTmp:Add(trPos); vTmp:Sub(trHit) + asmlib.SetVector(vTmp,stPOA.O); vTmp:Rotate(trAng); vTmp:Add(trPos) + local pO = vTmp:ToScreen(); oScreen:DrawCircle(pO, 1.2 * nRad, "y"); vTmp:Sub(trHit) if(not trPOA or (vTmp:Length() < trLen)) then trLen, trPOA = vTmp:Length(), stPOA end end; asmlib.SetVector(vTmp,trPOA.O); vTmp:Rotate(trAng); vTmp:Add(trPos) local hP, pO = trHit:ToScreen(), vTmp:ToScreen() oScreen:DrawLine(hP, pO, "y") - oScreen:DrawCircle(pO, 1.2 * nRad, "y") oScreen:DrawCircle(hP, 0.6 * nRad) end