DatAmazingCheese

Commander's Order

Jan 2nd, 2017
219
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @name Commander's Order v7.5
  2. @inputs [DriverSeat CommanderSeat GunnerSeat]:entity
  3. @inputs W A S D Space Mouse1 Mouse2 Shift Alt R Active Light CamConHitpos:vector Camprop:entity
  4. @outputs Vector:vector
  5. @persist [Driver Commander]:entity
  6. @trigger Driver Commander W A S D Space Mouse1 Mouse2 Shift Alt R Active Light
  7.  
  8. #Controls;#
  9. #WASD Orders driver to move in that respective direction. Space is Brake/Clutch. Shift Alerts Driver to check gear,#
  10. #Mouse 1 Cannon (Left Click = Mouse 1 For all you plebeian Fundies.) Mouse2 MG (Right Click = Mouse 2)- Orders Gun Firing Respectively)#
  11. #R Orders Bow Gunner to fire.#
  12. #Created by [104th]CaptainCheeseDoodles#
  13. #holo "shoot here" indicator added by Fervidusletum
  14.  
  15. #wire driver to driver pod controller "entity" output (NOT CREATE ENTITY)
  16. #same for commander
  17.  
  18. #This chip is configured for 2 seats: For additional seats, Add <Seatname>:entity to the output tab, and designate the commands below
  19. #accordingly. Ex: In Gunner section, you would change DriverSeat input to GunnerSeat, or whatever you have designated it in the inputs.
  20.  
  21. if (duped()|dupefinished()) { reset() }
  22. if (first()) {
  23. local Players = players()
  24.  
  25. holoCreate(1)
  26. holoModel(1,"models/sprops/misc/alphanum/alphanum_arrow_b.mdl")
  27. holoAng(1,ang(180,0,0))
  28. holoScale(1,vec(10,1,20))
  29. holoMaterial(1,"models/debug/debugwhite")
  30. holoColor(1,vec4(255,0,0,160))
  31. holoVisible(1,Players,0)
  32.  
  33. holoCreate(2)
  34. holoModel(2,"models/sprops/misc/alphanum/alphanum_arrow_b.mdl")
  35. holoAng(2,ang(180,90,0))
  36. holoScale(2,vec(10,1,20))
  37. holoMaterial(2,"models/debug/debugwhite")
  38. holoColor(2,vec4(255,0,0,160))
  39. holoVisible(2,Players,0)
  40. holoParent(2,1)
  41. }
  42.  
  43. #will be visible to anyone who joins server after visibility is set.
  44. #to fix, just have driver or commander hop out and back in
  45. #need to periodically check for changes
  46. interval(500)
  47. if (changed(DriverSeat:driver())|changed(CommanderSeat:driver())) {
  48. local Players = players()
  49. holoVisible(1,Players,0)
  50. holoVisible(2,Players,0)
  51.  
  52. Driver = DriverSeat:driver() ?: noentity()
  53. Gunner = GunnerSeat:driver() ?: noentity()
  54. Commander = CommanderSeat:driver() ?: noentity()
  55. }
  56.  
  57.  
  58. #Driver Orders - Commander will recieve notification of order that was sent.#
  59. if (inputClk()) {
  60. if(~W&W){
  61. DriverSeat:hintDriver("Forward",4)
  62. CommanderSeat:hintDriver("Move F Order Sent",1)
  63. CommanderSeat:soundPlay(1,0.1,"buttons/blip1.wav")
  64. }
  65.  
  66.  
  67. if(~A&A){
  68. DriverSeat:hintDriver("Left",4)
  69. CommanderSeat:hintDriver("Move L Order Sent",1)
  70. CommanderSeat:soundPlay(1,0.1,"buttons/blip1.wav")
  71. }
  72.  
  73. if(~S&S){
  74. DriverSeat:hintDriver("Reverse",4)
  75. CommanderSeat:hintDriver("Move Rev. Order Sent",1)
  76. CommanderSeat:soundPlay(1,0.1,"buttons/blip1.wav")
  77. }
  78.  
  79. if(~D&D){
  80. DriverSeat:hintDriver("Right",4)
  81. CommanderSeat:hintDriver("Move R Order Sent",1)
  82. CommanderSeat:soundPlay(1,0.1,"buttons/blip1.wav")
  83. }
  84.  
  85. if(~Space&Space){
  86. DriverSeat:hintDriver("Halt/Slow/Clutch",3)
  87. CommanderSeat:hintDriver("Brake Order Sent",1)
  88. CommanderSeat:soundPlay(1,0.1,"buttons/blip1.wav")
  89. }
  90. if(~Light&Light){
  91. DriverSeat:hintDriver("Move to Designated Point",4)
  92. CommanderSeat:hintDriver("Move order sent",1)
  93. CommanderSeat:soundPlay(1,2,"buttons/bell1.wav")
  94. }
  95.  
  96. #Gunner Orders - Commander will recieve notification of order that was sent; Alt Tells gunner to Traverse Right,Control vice versa.#
  97.  
  98. if(~Mouse1&Mouse1){
  99. GunnerSeat:hintDriver("Fire 100mm",3)
  100. CommanderSeat:hintDriver("Cannon Fire Order Sent",1)
  101. CommanderSeat:soundPlay(1,0.1,"buttons/blip1.wav")
  102. }
  103. if(~Mouse2&Mouse2){
  104. GunnerSeat:hintDriver("Target This Point!",3)
  105. CommanderSeat:hintDriver("Sent",1)
  106. CommanderSeat:soundPlay(1,1.5,"buttons/button2.wav")
  107. }
  108.  
  109. #Traverse Commands#
  110. if(~Shift&Shift){
  111. GunnerSeat:hintDriver("Target Left!",3)
  112. CommanderSeat:hintDriver("Traverse Order Sent",1)
  113. CommanderSeat:soundPlay(1,0.1,"buttons/blip1.wav")
  114. }
  115.  
  116. if(~Alt&Alt){
  117. GunnerSeat:hintDriver("Target Right!",3)
  118. CommanderSeat:hintDriver("Traverse Order Sent",1)
  119. CommanderSeat:soundPlay(1,0.1,"buttons/blip1.wav")
  120. }
  121.  
  122. if (R) {CommanderSeat:soundPlay(5,32.4,"music/cossack_sandvich.wav")}else{soundStop(5)}
  123.  
  124. if (~Light&Light) {
  125. CommanderSeat:soundPlay(6,2,"buttons/bell1.wav")
  126. holoPos(1,CamConHitpos+vec(0,0,192))
  127. if (Driver) {
  128. holoVisible(1,Driver,1)
  129. holoVisible(2,Driver,1)
  130. }
  131. if (Commander) {
  132. holoVisible(1,Commander,1)
  133. holoVisible(2,Commander,1)
  134. }
  135. stoptimer("hide holo")
  136. timer("hide holo",5000)
  137. }
  138. if (~Mouse2&Mouse2) {
  139. CommanderSeat:soundPlay(6,1,"buttons/button2.wav")
  140. holoPos(1,CamConHitpos+vec(0,0,192))
  141. if (Driver) {
  142. holoVisible(1,Gunner,1)
  143. holoVisible(2,Gunner,1)
  144. }
  145. if (Commander) {
  146. holoVisible(1,Commander,1)
  147. holoVisible(2,Commander,1)
  148. }
  149. stoptimer("hide holo")
  150. timer("hide holo",5000)
  151. }
  152.  
  153. Vector=Camprop:toWorld(vec(0,22.5,60))+vec(0,0,0)
  154. #Vector adjusts as vec(Left/Right,Front/Back,Up/down)#
  155. }
  156.  
  157. if (clk("hide holo")) {
  158. if (Driver) {
  159. holoVisible(1,Driver,0)
  160. holoVisible(2,Driver,0)
  161. }
  162. if (Commander) {
  163. holoVisible(1,Commander,0)
  164. holoVisible(2,Commander,0)
  165. }
  166. if (Gunner) {
  167. holoVisible(1,Gunner,0)
  168. holoVisible(2,Gunner,0)
  169. }
  170. }
RAW Paste Data