Skip to content

Commit

Permalink
Updated: Drawing relation assist now displays all the track ends
Browse files Browse the repository at this point in the history
Updated: Intersect ray clear now outputs the entity if valid
  • Loading branch information
dvdvideo1234 committed Dec 10, 2017
1 parent e524870 commit dea6087
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lua/autorun/trackassembly_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lua/trackassembly/trackasmlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions lua/weapons/gmod_tool/stools/trackassembly.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit dea6087

Please sign in to comment.