RedDeadlyCreeper

CTEC Submarine Depth E2

Dec 1st, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. @name RDC Submarine Water Depth Thingy V1.1
  2. @inputs Up Down Base:entity Seat:entity
  3. @outputs Depth
  4. @persist Depth Scale WaterHeight CrushDepth CanChangeDepth
  5. @trigger
  6. interval(100)
  7. if(first()|dupefinished())
  8. {
  9. Scale=10
  10. CrushDepth=200
  11. #timer("CheckDepth",5000)
  12. WaterHeight=entity():pos():z()
  13. CanChangeDepth=1
  14. CrushDepth*=39.37
  15. }
  16. #if(clk("CheckDepth"))
  17. #{
  18. rangerHitWater(1)
  19. rangerHitEntities(0)
  20.  
  21. WaterRanger=rangerOffset(8000,Base:pos()+vec(0,0,4000),vec(0,0,-1))
  22. timer("CheckDepth",5000)
  23. #}
  24. #(AvgHeight/LegCount)+vec(0,0,HoverHeight)-entity():pos()
  25. Base:applyForce(((((WaterRanger:position()-vec(0,0,Depth)-Base:pos()))-Base:vel())*Base:mass())*vec(0,0,1)+Base:vel()*vec(0,0,-0.2)*Base:mass())
  26.  
  27. if(~Down&Down&CanChangeDepth)
  28. {
  29. CanChangeDepth=0
  30. Depth=clamp(Depth+39.37,0,4800)
  31. if(Depth>CrushDepth)
  32. {
  33.  
  34. Boom=propSpawn("models/props_junk/propane_tank001a.mdl",(Base:toWorld(vec(0,0,-5))),(Base:toWorld(ang(90,0,0))),0)
  35. Boom:propBreak()
  36. Base:propDelete()
  37. }
  38. Seat:printDriver("Target Depth: "+Depth/39.37*Scale)
  39. if(changed(Depth))
  40. {
  41. Base:soundPlay("AdjustSpeed", 0, "acf_extra/vehiclefx/trans/default_shift.wav")
  42. soundVolume("AdjustSpeed",1)
  43. soundPitch("AdjustSpeed",80)
  44. }
  45. timer("DepthChange",500)
  46. }
  47. elseif(~Up&Up&CanChangeDepth)
  48. {
  49. CanChangeDepth=0
  50. Depth=clamp(Depth-39.37,0,4800)
  51. if(Depth>CrushDepth)
  52. {
  53.  
  54. Boom=propSpawn("models/props_junk/propane_tank001a.mdl",(Base:toWorld(vec(0,0,-5))),(Base:toWorld(ang(90,0,0))),0)
  55. Boom:propBreak()
  56. Base:propDelete()
  57. }
  58. Seat:printDriver("Target Depth: "+Depth/39.37*Scale)
  59. if(changed(Depth))
  60. {
  61. Base:soundPlay("AdjustSpeed", 0, "acf_extra/vehiclefx/trans/default_shift.wav")
  62. soundVolume("AdjustSpeed",1)
  63. soundPitch("AdjustSpeed",80)
  64. }
  65. timer("DepthChange",500)
  66. }
  67.  
  68. if(clk("DepthChange"))
  69. {
  70. stoptimer("DepthChange")
  71. CanChangeDepth = 1
  72. }
Add Comment
Please, Sign In to add comment