Dusty_Wings

Gridded Ranger

Apr 9th, 2016
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.88 KB | None | 0 0
  1. @name Gridded Ranger
  2. @inputs
  3. @outputs
  4. @persist Back:vector Co Notes:array Sound:string
  5. @trigger
  6. runOnTick(1)
  7.  
  8. Holos = 30
  9. Scale = 5
  10. Out = 12
  11. Out2 = 12
  12. Up = 12
  13.  
  14. Sound = "synth/saw.wav"
  15. #59 = Low C
  16.  
  17. # A# D# D# F  F  G2 A#2 G2 D# A# D# D# F  F  G2 D# A# D# D# F  F  G2 A#2 G2 D# C2 F  G#2 G2 D#
  18. # 57 62 62 64 64 66 69  66 62 57 62 62 64 64 66 62 57 62 62 64 64 66 69  66 62 71 64 67  66 62
  19.  
  20.  
  21. if(first())
  22. {
  23. Notes = array(57,62,62,64,64,66,69,66,62,57,62,62,64,64,66,62,57,62,62,64,64,66,69,66,62,71,64,67,66,62)
  24. #print(Notes:count():toString())
  25. for(I=1,Holos)
  26. {
  27. holoCreate(I)  
  28. holoModel(I,"plane")
  29. holoColor(I,vec(0,255,0))
  30. holoScale(I,vec(1,1,1)*Scale)  
  31. holoPos(I,entity():pos())
  32. holoMaterial(I,"Lights/white005")
  33.  
  34. }  
  35. Back = entity():pos()
  36. }
  37.  
  38. O = owner()
  39.  
  40. XDist = abs(Back:x()-O:pos():x())
  41. YDist = abs(Back:y()-O:pos():y())
  42.  
  43. rangerFilter(owner())
  44. rangerHitWater(1)
  45. rangerFilter(owner():vehicle())
  46. R = rangerOffset(1000000,owner():pos(),vec(0,0,-1))
  47. RHit = R:hitNormal()
  48. RPos = R:position()
  49. UpSet = vec(0,0,RPos:z())+RHit
  50. Ang = RHit:toAngle()+ang(90,0,0)
  51.  
  52. if(XDist>=Scale*Out)
  53. {
  54. Pitch = 2^((Notes[Co,number]+Up)/12)
  55. soundPlay(1,100,Sound)
  56. soundPitch(1,Pitch)    
  57.  
  58. Co=Co%Holos+1
  59. if(abs(Back:x()-O:pos():x())!=Back:x()-O:pos():x())
  60. {
  61. holoPos(Co,Back:setZ(0)+vec(Scale*Out,0,0)+UpSet)
  62. holoAng(Co,Ang)
  63. Back = Back+vec(Scale*Out2,0,0)
  64. }
  65. else
  66. {
  67. holoPos(Co,Back:setZ(0)-vec(Scale*Out,0,0)+UpSet)
  68. holoAng(Co,Ang)
  69. Back = Back-vec(Scale*Out2,0,0)    
  70. }
  71. }
  72.  
  73. if(YDist>=Scale*Out)
  74. {
  75. Pitch = 2^((Notes[Co,number]+Up)/12)
  76. soundPlay(1,100,Sound)
  77. soundPitch(1,Pitch)    
  78.  
  79. Co=Co%Holos+1
  80. if(abs(Back:y()-O:pos():y())!=Back:y()-O:pos():y())
  81. {
  82. holoPos(Co,Back:setZ(0)+vec(0,Scale*Out,0)+UpSet)
  83. holoAng(Co,Ang)
  84. Back = Back+vec(0,Scale*Out2,0)
  85. }
  86. else
  87. {
  88. holoPos(Co,Back:setZ(0)-vec(0,Scale*Out,0)+UpSet)
  89. holoAng(Co,Ang)
  90. Back = Back-vec(0,Scale*Out2,0)    
  91. }
  92. }
Add Comment
Please, Sign In to add comment