Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. @name ArTech GG5
  2. @inputs [Gun Gun2 Base TBase]:entity [Active R PrevWeapon NextWeapon Shift Light]:number [CamRanger]:ranger
  3. @outputs [Position]:vector
  4. @outputs [Weld FOV Distance FLIR]:number
  5. @outputs [Self Parent]:entity
  6. @outputs [Filter]:array
  7. @persist [Inertia Inertia2 GunAng GunAng2]:angle
  8. @persist [Offset ZoomOffset]:vector
  9. @persist [MaxElevation MaxDepression MinYaw MaxYaw RotateSpeed Unlock CamToggle Dist]:number
  10. @persist [MaxElevation2 MaxDepression2 MinYaw2 MaxYaw2 RotateSpeed2]:number
  11. @trigger Active PrevWeapon NextWeapon R Shift Light
  12. #@model models/cheeze/pcb2/pcb1.mdl
  13.  
  14. # Version 1.0.2
  15.  
  16. if ( changed(Active) ) {
  17. # Camera settings
  18. Offset = vec(0, 0, 40) # cam pos relative to turret base
  19. ZoomOffset = vec(50,-10,10) # cam pos when zoomed in relative to gun
  20. Distance = 230 # cam radius
  21.  
  22. # Main gun settings
  23. MaxElevation = 20
  24. MaxDepression = 10
  25. MinYaw = 360
  26. MaxYaw = 360
  27. RotateSpeed = 40 # Degrees per second
  28.  
  29. # Secondary gun settings - Optional and only applies if you have a second gun
  30. MaxElevation2 = 45
  31. MaxDepression2 = 10
  32. MinYaw2 = 360
  33. MaxYaw2 = 360
  34. RotateSpeed2 = 120 # Degrees per second
  35.  
  36. # Automatic settings do not touch these no reason to
  37. Self = Base
  38. Parent = TBase
  39. Filter = entity():getConstraints() # Ranger filter
  40. Filter:pushEntity(Gun)
  41. Filter:pushEntity(Base)
  42. Filter:pushEntity(TBase)
  43. Filter:pushEntity(Gun2)
  44.  
  45. GunAng = Self:toLocal(Gun:angles())
  46. GunAng2 = Self:toLocal(Gun2:angles())
  47. MinYaw *= -1
  48. MinYaw2 *= -1
  49. MaxElevation*= -1
  50. MaxElevation2*= -1
  51. RotateSpeed /= 20
  52. RotateSpeed2 /= 20
  53. Inertia = shiftL(ang(Gun:inertia())):setRoll(0)
  54. Inertia2 = shiftL(ang(Gun2:inertia())):setRoll(0)
  55. Weld = 1
  56. Unlock = 0
  57. FOV = 90
  58. Dist = Distance
  59. Position = TBase:massCenter() + Offset
  60. }
  61. elseif ( inputClk() ) {
  62. if( PrevWeapon ) { FOV = max(FOV/2, 5) }
  63. elseif ( NextWeapon ) { FOV = min(FOV*2, 90) }
  64. elseif( changed(R) & R ) {
  65. if ( Unlock ) { Unlock = 0 }
  66. else { Unlock = 1 , interval(50) }
  67. Weld = !Unlock
  68. }
  69. elseif( changed(Shift) & Shift) {
  70. CamToggle = !CamToggle
  71. Position = CamToggle ? Gun:toWorld(ZoomOffset) : TBase:massCenter() + Offset
  72. Distance = CamToggle ? 0 : Dist
  73. FOV = 90
  74. Parent = CamToggle ? Gun : TBase
  75. }
  76. elseif(changed(Light)&Light){
  77. FLIR = !FLIR
  78. }
  79. }
  80.  
  81. if ( Unlock & clk() ) {
  82. GunDir = (CamRanger:pos() - Gun:pos()):normalized()
  83. GunAng = angnorm(clamp(GunAng - clamp(heading(vec(), GunAng, Self:toLocalAxis(GunDir)), -RotateSpeed, RotateSpeed), ang(MaxElevation, MinYaw, 0), ang(MaxDepression, MaxYaw, 0)))
  84. Ang = -heading(vec(), Gun:angles(), Self:toWorld(GunAng):forward())
  85. Gun:applyAngForce((Ang* 450 - Gun:angVel() * 35) * Inertia)
  86. if(Gun2){
  87. GunDir2 = (CamRanger:pos() - Gun2:pos()):normalized()
  88. GunAng2 = angnorm(clamp(GunAng2 - clamp(heading(vec(), GunAng2, Self:toLocalAxis(GunDir2)), -RotateSpeed2, RotateSpeed2), ang(MaxElevation2, MinYaw2, 0), ang(MaxDepression2, MaxYaw2, 0)))
  89. Ang2 = -heading(vec(), Gun2:angles(), Self:toWorld(GunAng2):forward())
  90. Gun2:applyAngForce((Ang2* 450 - Gun2:angVel() * 35) * Inertia2)
  91. }
  92.  
  93. interval(50)
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement