Advertisement
Guest User

Untitled

a guest
Aug 12th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. /*---------------------------------------------------------------------------
  2. The Entity display: draw HUD information about entities
  3. ---------------------------------------------------------------------------*/
  4. local function DrawEntityDisplay()
  5. local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_EntityDisplay")
  6. if shouldDraw == false then
  7. return
  8. end
  9.  
  10. local shootPos = localplayer:GetShootPos()
  11. local aimVec = localplayer:GetAimVector()
  12. for k, ply in pairs(player.GetAll()) do
  13. if not ply:Alive() then
  14. continue
  15. end
  16.  
  17. local hisPos = ply:GetShootPos()
  18. --ply.DarkRPVars = ply.DarkRPVars or {}
  19. --if ply.DarkRPVars.wanted then DrawWantedInfo(ply) end
  20. if GAMEMODE.Config.globalshow and ply ~= localplayer then
  21. DrawPlayerInfo(ply)
  22. elseif not GAMEMODE.Config.globalshow and hisPos:Distance(shootPos) < 400 then
  23. -- Draw when you're (almost) looking at him
  24. local pos = hisPos - shootPos
  25. local unitPos = pos:GetNormalized()
  26. if unitPos:Dot(aimVec) > 0.95 then
  27. local trace = util.QuickTrace(shootPos, pos, localplayer)
  28. if trace.Hit and trace.Entity ~= ply then
  29. return
  30. end
  31.  
  32. DrawPlayerInfo(ply)
  33. end
  34.  
  35. end
  36.  
  37. end
  38.  
  39. local tr = localplayer:GetEyeTrace()
  40. if IsValid(tr.Entity) and tr.Entity:IsOwnable() and tr.Entity:GetPos():Distance(localplayer:GetPos()) < 200 then
  41. tr.Entity:DrawOwnableInfo()
  42. end
  43.  
  44. end
  45.  
  46. /*---------------------------------------------------------------------------
  47. Actual HUDPaint hook
  48. ---------------------------------------------------------------------------*/
  49. function GM:HUDPaint()
  50. DrawHUD()
  51. DrawEntityDisplay()
  52. self.BaseClass:HUDPaint()
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement