Advertisement
RedDeadlyCreeper

Naval Dipping Sonar E2

Dec 1st, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.05 KB | None | 0 0
  1. @name RDC Dipping Sonar V1.0
  2. @inputs ToggleDeploy Seat:entity Active
  3. @outputs TPos:vector Deploying TDepth
  4. @persist Deploying Deploy SEnt:entity I Tube1 Tube2 Tube3 Tube4 Tube5 Height Sonar FOV Base UWater Tracker Ents:array
  5. @trigger
  6. interval(100)
  7. if(duped()|dupefinished())
  8. {
  9. reset()
  10. }
  11. elseif(first())
  12. {
  13. CamOffset=vec(0,0,2.5)
  14. MainColor=vec(230,230,230)
  15. RopeColor=vec(55)
  16. MainMat="sprops/textures/sprops_cfiber1"
  17.  
  18. I=1
  19.  
  20. Base=I
  21. holoCreate(I) #CIWS stand left
  22. holoPos(I, entity():toWorld(vec(0,0,0)))
  23. holoAng(I, entity():toWorld(ang(0)))
  24. holoAlpha(I,0)
  25. holoParent(I,entity())
  26. I++
  27. Tube1=I
  28. holoCreate(I) #CIWS stand left
  29. holoPos(I, holoEntity(Base):toWorld(vec(0,0,-4)))
  30. holoAng(I, holoEntity(Base):toWorld(ang(0)))
  31. holoScale(I, vec(0.05,0.05,2))
  32. holoColor(I,RopeColor)
  33. holoModel(I, "hq_cylinder")
  34. holoMaterial(I,MainMat)
  35. holoParent(I,holoEntity(Base))
  36. I++
  37.  
  38. Tube2=I
  39. holoCreate(I) #CIWS stand left
  40. holoPos(I, holoEntity(Tube1):toWorld(vec(0,0,0)))
  41. holoAng(I, entity():toWorld(ang(0)))
  42. holoScale(I, vec(0.05,0.05,2))
  43. holoColor(I,RopeColor)
  44. holoModel(I, "hq_cylinder")
  45. holoMaterial(I,MainMat)
  46. holoParent(I,holoEntity(Tube1))
  47. I++
  48.  
  49. Tube3=I
  50. holoCreate(I) #CIWS stand left
  51. holoPos(I, holoEntity(Tube2):toWorld(vec(0,0,0)))
  52. holoAng(I, entity():toWorld(ang(0)))
  53. holoScale(I, vec(0.05,0.05,2))
  54. holoColor(I,RopeColor)
  55. holoModel(I, "hq_cylinder")
  56. holoMaterial(I,MainMat)
  57. holoParent(I,holoEntity(Tube2))
  58. I++
  59.  
  60. Tube4=I
  61. holoCreate(I) #CIWS stand left
  62. holoPos(I, holoEntity(Tube3):toWorld(vec(0,0,0)))
  63. holoAng(I, entity():toWorld(ang(0)))
  64. holoScale(I, vec(0.05,0.05,2))
  65. holoColor(I,RopeColor)
  66. holoModel(I, "hq_cylinder")
  67. holoMaterial(I,MainMat)
  68. holoParent(I,holoEntity(Tube3))
  69. I++
  70.  
  71. Tube5=I
  72. holoCreate(I) #CIWS stand left
  73. holoPos(I, holoEntity(Tube4):toWorld(vec(0,0,0)))
  74. holoAng(I, entity():toWorld(ang(0)))
  75. holoScale(I, vec(0.05,0.05,2))
  76. holoColor(I,RopeColor)
  77. holoModel(I, "hq_cylinder")
  78. holoMaterial(I,MainMat)
  79. holoParent(I,holoEntity(Tube4))
  80. I++
  81.  
  82. Sonar=I
  83. SEnt=holoCreate(I) #CIWS stand left
  84. holoPos(I, holoEntity(Tube5):toWorld(vec(0,0,-20)))
  85. holoAng(I, entity():toWorld(ang(0)))
  86. holoScale(I, vec(0.4))
  87. holoColor(I,MainColor)
  88. holoModel(I, "models/props_junk/propane_tank001a.mdl")
  89. holoMaterial(I,MainMat)
  90. holoParent(I,holoEntity(Tube5))
  91. I++
  92.  
  93. Tracker=I
  94. holoCreate(I) #Base
  95. holoPos(I, vec(0))
  96. # holoAng(I, entity():toWorld(ang(0,0,0)))
  97. holoScale(I, vec(1,1,50))
  98. holoModel(I,"models/sprops/cylinders/size_5/cylinder_12x480.mdl")
  99. holoAlpha(I,100)
  100. holoColor(I,vec(255,0,0))
  101. # holoParent(I,entity())
  102. I++
  103.  
  104. holoAlpha(Tube1,0)
  105. holoAlpha(Tube2,0)
  106. holoAlpha(Tube3,0)
  107. holoAlpha(Tube4,0)
  108. holoAlpha(Tube5,0)
  109.  
  110. holoVisible(Tracker,players(),0)
  111.  
  112.  
  113. function adjustMastHeight(InHeight)
  114. {
  115. holoPos(Tube1, holoEntity(Base):toWorld(vec(0,0,-InHeight-8)))
  116. holoPos(Tube2, holoEntity(Tube1):toWorld(vec(0,0,-InHeight-8)))
  117. holoPos(Tube3, holoEntity(Tube2):toWorld(vec(0,0,-InHeight-8)))
  118. holoPos(Tube4, holoEntity(Tube3):toWorld(vec(0,0,-InHeight-8)))
  119. holoPos(Tube5, holoEntity(Tube4):toWorld(vec(0,0,-InHeight-8)))
  120. }
  121. Height=-13
  122. adjustMastHeight(Height)
  123.  
  124. # rangerPersist(1)
  125. # rangerIgnoreWorld(1)
  126. }
  127.  
  128. if(ToggleDeploy&~ToggleDeploy)
  129. {
  130. Deploy=!Deploy
  131. Deploying=1
  132. if(Deploy)
  133. {
  134. soundStop("MovingSound")
  135. entity():soundPlay("MovingSound",0,"acf_extra/airfx/gear_up.wav")
  136. soundPitch("MovingSound",150)
  137. }
  138. else
  139. {
  140. soundStop("MovingSound")
  141. entity():soundPlay("MovingSound",0,"acf_extra/airfx/gear_up.wav")
  142. soundPitch("MovingSound",80)
  143. }
  144. }
  145.  
  146. if(Deploying&Deploy) #Deploy
  147. {
  148. Height=clamp(Height+0.75,-13,4)
  149. adjustMastHeight(Height)
  150. if(Height==4)
  151. {
  152. Deploying=0
  153. soundStop("MovingSound")
  154. entity():soundPlay("Latch",0,"acf_extra/airfx/weapon_select.wav")
  155. soundPitch("Latch",80)
  156. }
  157. if(Height>=-8)
  158. {
  159. holoAlpha(Tube1,255)
  160. holoAlpha(Tube2,255)
  161. holoAlpha(Tube3,255)
  162. holoAlpha(Tube4,255)
  163. holoAlpha(Tube5,255)
  164. }
  165. }
  166. elseif(Deploying&!Deploy) #Retract
  167. {
  168. Height=clamp(Height-0.5,-13,4)
  169. adjustMastHeight(Height)
  170. if(Height==-13)
  171. {
  172. Deploying=0
  173. soundStop("MovingSound")
  174. entity():soundPlay("Latch",0,"acf_extra/airfx/TOW_reload.wav")
  175. soundPitch("Latch",80)
  176. }
  177. if(Height<=-9)
  178. {
  179. holoAlpha(Tube1,0)
  180. holoAlpha(Tube2,0)
  181. holoAlpha(Tube3,0)
  182. holoAlpha(Tube4,0)
  183. holoAlpha(Tube5,0)
  184. }
  185. }
  186.  
  187. holoAng(Base,ang(0))
  188. UWater=SEnt:isUnderWater()
  189. if(~Active&Active)
  190. {
  191. holoVisible(Tracker,players(),0)
  192. holoVisible(Tracker,Seat:driver(),1)
  193. }
  194. if(changed(UWater))
  195. {
  196. stoptimer("SonarPulse")
  197. timer("SonarPulse",500)
  198. }
  199. if(SEnt:isUnderWater())
  200. {
  201. if(clk("SonarPulse"))
  202. {
  203. soundStop("Pulse")
  204. entity():soundPlay("Pulse",1.5,"npc/scanner/combat_scan4.wav")
  205. soundPitch("Pulse",150) #Dip Pitch
  206. #soundPitch("Pulse",125) #Ship Pitch
  207.  
  208. #rangerOffsetHull(Mine:toWorld(vec(0,0,74)),Mine:toWorld(vec(0,0,80)),vec(70))
  209. findIncludeClass("prop_physics")
  210. findInBox(SEnt:toWorld(vec(-2000)),SEnt:toWorld(vec(2000,2000,0)))
  211. TEnt=findClosest(SEnt:pos())
  212. rangerIgnoreWorld(1)
  213. if(TEnt:isValid()&entity():vel():length()<40)
  214. {
  215. Dist=TEnt:pos():distance(SEnt:pos())
  216. TPos=SEnt:toWorld(SEnt:toLocal(TEnt:pos())*vec(1+random(-1,1)*Dist/4500,1+random(-1,1)*Dist/4500,1+random(-1,1)*Dist/8000))
  217. TVel=TEnt:vel()*vec(1+random(-1,1)*Dist/8000,1+random(-1,1)*Dist/8000,1+random(-1,1)*Dist/8000)
  218. TDepth=(SEnt:pos():z()-TPos:z())
  219. soundStop("Echo")
  220. TEnt:soundPlay("Echo",1,"npc/scanner/combat_scan4.wav")
  221. soundPitch("Echo",110) #Dip Pitch
  222. holoPos(Tracker,TPos)
  223. }
  224. timer("SonarPulse",3000)
  225. }
  226. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement