Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.75 KB | None | 0 0
  1.  
  2. local mat_laser = Material( "cable/redlaser" )
  3. SURF.EndingPoints = SURF.EndingPoints or 0
  4.  
  5. net.Receive("surf.create_start", function()
  6.     hook.Remove("PostDrawOpaqueRenderables", "Surf.Starting")
  7.  
  8.     local _point1 = net.ReadVector()
  9.     local _point2 = net.ReadVector()
  10.     local colorstart = Color( 0, 255, 0 )
  11.    
  12.     local p1, p2, p3, p4 = Vector( _point1.x, _point1.y, _point1.z), Vector( _point1.x, _point2.y, _point1.z), Vector( _point2.x, _point2.y, _point1.z), Vector( _point2.x, _point1.y, _point1.z)
  13.     local t1, t2, t3, t4 = Vector( _point1.x, _point1.y, _point2.z), Vector( _point1.x, _point2.y, _point2.z), Vector( _point2.x, _point2.y, _point2.z), Vector( _point2.x, _point1.y, _point2.z)
  14.    
  15.     hook.Add("PostDrawOpaqueRenderables", "Surf.Starting", function()
  16.         render.DrawLine( p1, p2, colorstart, true )
  17.         render.DrawLine( p2, p3, colorstart, true )
  18.         render.DrawLine( p3, p4, colorstart, true )
  19.         render.DrawLine( p4, p1, colorstart, true )
  20.        
  21.         render.DrawLine( t1, t2, colorstart, true )
  22.         render.DrawLine( t2, t3, colorstart, true )
  23.         render.DrawLine( t3, t4, colorstart, true )
  24.         render.DrawLine( t4, t1, colorstart, true )
  25.        
  26.         render.DrawLine( p1, t1, colorstart, true )
  27.         render.DrawLine( p2, t2, colorstart, true )
  28.         render.DrawLine( p3, t3, colorstart, true )
  29.         render.DrawLine( p4, t4, colorstart, true )
  30.     end)
  31. end)
  32.  
  33. net.Receive("surf.create_end", function()
  34.     hook.Remove("PostDrawOpaqueRenderables", "Surf.Ending")
  35.    
  36.     local _point1 = net.ReadVector()
  37.     local _point2 = net.ReadVector()
  38.     local colorend = Color( 255, 0, 0 )
  39.    
  40.     local p1, p2, p3, p4 = Vector( _point1.x, _point1.y, _point1.z), Vector( _point1.x, _point2.y, _point1.z), Vector( _point2.x, _point2.y, _point1.z), Vector( _point2.x, _point1.y, _point1.z)
  41.     local t1, t2, t3, t4 = Vector( _point1.x, _point1.y, _point2.z), Vector( _point1.x, _point2.y, _point2.z), Vector( _point2.x, _point2.y, _point2.z), Vector( _point2.x, _point1.y, _point2.z)
  42.    
  43.     hook.Add("PostDrawOpaqueRenderables", "Surf.Ending", function()
  44.         render.DrawLine( p1, p2, colorend, true )
  45.         render.DrawLine( p2, p3, colorend, true )
  46.         render.DrawLine( p3, p4, colorend, true )
  47.         render.DrawLine( p4, p1, colorend, true )
  48.        
  49.         render.DrawLine( t1, t2, colorend, true )
  50.         render.DrawLine( t2, t3, colorend, true )
  51.         render.DrawLine( t3, t4, colorend, true )
  52.         render.DrawLine( t4, t1, colorend, true )
  53.        
  54.         render.DrawLine( p1, t1, colorend, true )
  55.         render.DrawLine( p2, t2, colorend, true )
  56.         render.DrawLine( p3, t3, colorend, true )
  57.         render.DrawLine( p4, t4, colorend, true )  
  58.     end)
  59. end)
  60.  
  61. net.Receive("surf.send_map_points", function()
  62.     SURF.EndingPoints = net.ReadFloat()
  63.     print(SURF.EndingPoints)
  64. end)
  65.  
  66. concommand.Add("surf_print_points", function()
  67.     print(SURF.EndingPoints)
  68. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement