Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. @name EZTankTurret
  2. @inputs [Pod,Cam,EGP]:wirelink [Gun,Chair,Base]:entity Active GunReady NextWeapon PrevWeapon
  3. @persist Elevation Depression Yaw RotateSpeed FOV LocalVel
  4. @persist Rangefinder:ranger [ScreenRes,Res]:vector2 CamOffset:vector
  5. @outputs [Inertia,Hold]:angle CamL:entity User:entity
  6. @persist Active Mouse1 Mouse2 Reload Shift
  7. @persist HudColor:vector HudColor2:vector CamDist RealisticGunMovement
  8.  
  9. runOnTick(1)
  10. if(first()||dupefinished()){
  11. #MADE BY SPIDER, EDIT BY SIR DOBBERS#
  12. ###########------------------VARIARBLES-----------------############
  13.  
  14. #Hud
  15. HudColor=vec(0,255,0)
  16. HudColor2=vec(255,0,0)
  17.  
  18. #Gun
  19. Elevation=100
  20. Depression=30
  21. Yaw=180
  22. RotateSpeed=8
  23.  
  24. RealisticGunMovement=1
  25.  
  26. #Cam
  27. CamOffset=vec(-8,0,80)
  28. CamDist=-10
  29.  
  30. ###########---------------------END---------------------############
  31.  
  32. holoCreate(1)
  33. holoAlpha(1,0)
  34. Hold = entity():toLocal(Gun:angles())
  35. Inertia = shiftL(ang(Gun:inertia()))
  36. }
  37.  
  38. if (~PrevWeapon|~NextWeapon) {
  39. FOV = clamp(FOV + (NextWeapon - PrevWeapon) * 35,20,90)
  40. }
  41. if (~Active) {
  42. FOV=50
  43. }
  44.  
  45. if (Active){
  46. Position=Base:pos()+CamOffset
  47. Cam["FOV",number]=FOV
  48. Cam["Position",vector]=Position
  49. if (~Active){
  50. Gun:soundPlay(1,0,"")
  51. soundPitch(1,0)
  52.  
  53. Cam["Activated",number]=1
  54. Cam["Parent",entity]=entity()
  55. Cam["Distance",number]=CamDist
  56.  
  57. #EGP Stuff
  58. User = Chair:driver()
  59. ScreenRes=egpScrSize(Chair:driver())
  60. Res=ScreenRes/2
  61.  
  62. #Forward Gun Tracker
  63. EGP:egp3DTracker(2,vec(0,0,0))
  64. EGP:egpParent(2,holoEntity(1))
  65.  
  66. EGP:egpCircle(3,vec2(0,0),vec2(2,2))
  67. EGP:egpColor(3,HudColor2)
  68. EGP:egpParent(3,2)
  69.  
  70. #Chevron
  71. EGP:egpPoly(4, Res, Res + vec2(0,0), Res + vec2(20,17), Res + vec2(0,0), Res + vec2(-20, 17), Res + vec2(-0, 0))
  72. EGP:egpColor(4,vec(255,0,0))
  73.  
  74. #Marks below Chevron
  75. EGP:egpCircle(5,Res+vec2(0,30),vec2(5,1))
  76. EGP:egpColor(5,HudColor)
  77.  
  78. EGP:egpCircle(6,Res+vec2(0,50),vec2(5,1))
  79. EGP:egpColor(6,HudColor)
  80.  
  81. EGP:egpCircle(7,Res+vec2(0,70),vec2(5,1))
  82. EGP:egpColor(7,HudColor)
  83.  
  84. rangerFilter(Gun)
  85. rangerFilter(entity():getConstraints())
  86. rangerPersist(1)
  87.  
  88. #Gun Stuff
  89. Inertia = shiftL(ang(Gun:inertia()))
  90. }
  91. EGP:egpColor(4,vec(255*!GunReady,200*GunReady,0))
  92. holoPos(1,rangerOffset(9999999999,Gun:pos()+Gun:forward()*100,Gun:forward()):position())
  93.  
  94. #Ang Force Stuff
  95. Mouse2=User:keyAttack2()
  96. if (Mouse2 & $Mouse2){
  97. Hold = entity():toLocal(Gun:angles())
  98. }
  99. Angle = Chair:toLocal(User:eyeAngles())
  100. Ranger = rangerOffset(9999999999,Position,Angle:forward())
  101. GunAng = entity():toWorld(Hold)*Mouse2+(Ranger:pos() - Gun:pos()):toAngle()*!Mouse2
  102.  
  103. LocalVel=entity():toLocal(Gun:angles()):yaw()
  104. soundPitch(1,(abs($LocalVel)>0.3)*80)
  105. }
  106. else{
  107. soundPitch(1,0)
  108. if (~Active){
  109. Hold = entity():toLocal(Gun:angles())
  110. }
  111. GunAng = entity():toWorld(Hold)
  112. }
  113.  
  114. Force = Gun:toWorld(clamp(Gun:toLocal(GunAng),ang(-RotateSpeed),ang(RotateSpeed)))
  115. Clamped = clamp(entity():toLocal(Force),ang(-Elevation,-Yaw,-1),ang(Depression,Yaw,1))
  116. LocalToGun = Gun:toLocal(entity():toWorld(Clamped))
  117. Gun:applyAngForce((LocalToGun * 250 - Gun:angVel() * 47 + entity():angVel() * 47 * (abs(Gun:toLocal(GunAng):yaw())>5)*RealisticGunMovement) * Inertia) #250, 47
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement