Advertisement
Dusty_Wings

Mecha Man (lol)

Apr 9th, 2016
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.19 KB | None | 0 0
  1. @name HoloMech!
  2. @inputs Pod:wirelink
  3. @outputs
  4. @persist Legs:array INC FL BL RL LL Ang:angle
  5. @persist Props:array
  6. @trigger
  7. if(duped()){reset()}
  8. runOnTick(1)
  9.  
  10. Vehicle = Pod["Entity",entity]
  11. W = Pod["W",number]
  12. A = Pod["A",number]
  13. D = Pod["D",number]
  14. Click = Pod["Mouse1",number]
  15.  
  16. Speed = 3
  17. GoSpeed = 5
  18.  
  19. if(first())
  20. {
  21.  
  22. for(I=1,20)
  23. {
  24. holoCreate(I)  
  25. holoModel(I,"dome2")
  26. holoScale(I,vec(1,1,1)*2)
  27. }  
  28. holoModel(1,"hqicosphere2")
  29. holoScale(1,vec(1,1,1)*4)
  30. holoPos(1,entity():pos()+vec(0,0,100))
  31.    
  32. for(I=6,13)
  33. {
  34. holoModel(I,"hqcylinder")
  35. holoScaleUnits(I,vec(3,3,100))    
  36. }
  37.    
  38. holoModel(14,"hqcylinder")    
  39. holoPos(14,holoEntity(1):pos()+vec(0,0,25))
  40. holoParent(14,1)
  41.  
  42. holoPos(15,holoEntity(14):pos()+vec(0,0,60))
  43. holoAng(15,ang(180,0,0))
  44. holoScale(15,vec(1,1,1)*10)
  45. holoParent(15,1)
  46.  
  47. holoPos(16,holoEntity(15):pos()+vec(0,0,-1))
  48. holoScale(16,vec(1,1,1.5)*10)
  49. holoParent(16,1)
  50. holoMaterial(16,"models/props_combine/health_charger_glass")
  51.  
  52. Legs = array(
  53. holoEntity(1):pos()+holoEntity(1):forward()*50,
  54. holoEntity(1):pos()+holoEntity(1):forward()*-50,
  55. holoEntity(1):pos()+holoEntity(1):right()*50,
  56. holoEntity(1):pos()+holoEntity(1):right()*-50)    
  57.  
  58. for(I=1,15)
  59. {
  60. holoColor(I,vec(0,0,0))    
  61. }
  62. holoColor(17,vec(0,0,0))
  63. holoPos(17,holoEntity(16):pos()+vec(0,0,82))
  64. holoScale(17,vec(2,2,1)*2)
  65. holoParent(17,16)
  66.  
  67. holoColor(18,vec(0,0,0))
  68. holoModel(18,"hqcylinder")
  69. holoScale(18,vec(1,1,2))
  70. holoPos(18,holoEntity(17):pos()+vec(0,0,20))
  71. holoParent(18,17)
  72.  
  73. holoColor(19,vec(0,0,0))
  74. holoModel(19,"hqicosphere2")
  75. holoScale(19,vec(2,2,2))
  76. holoPos(19,holoEntity(18):pos()+vec(0,0,20))
  77. holoParent(19,18)
  78.  
  79. holoColor(20,vec(0,0,0))
  80. holoModel(20,"hqtorus2")
  81. holoScale(20,vec(1,1,10))
  82. holoAng(20,ang(90,0,0))
  83. holoPos(20,holoEntity(19):pos()+holoEntity(19):forward()*24)
  84. holoParent(20,19)
  85.  
  86. #rangerPersist(1)
  87. rangerHitWater(1)
  88. }
  89.  
  90. if(W|FL>1|BL>1|RL>1|LL>1|owner():lastSaid()=="auto"&holoEntity(1):pos():distance(owner():shootPos())>200)
  91. {
  92. INC=INC+GoSpeed
  93.  
  94. if(INC<=100)
  95. {
  96. Legs[1,vector]=Legs[1,vector]+holoEntity(16):forward()*Speed  
  97.  
  98. Div = INC/100
  99. FL = sin(Div*180)*10
  100. }
  101.  
  102. if(INC>=100&INC<=200)
  103. {
  104. Legs[2,vector]=Legs[2,vector]+holoEntity(16):forward()*Speed  
  105.  
  106. Div = INC/100
  107. BL = abs(sin(Div*180)*10)
  108. }
  109.  
  110. if(INC>=200&INC<=300)
  111. {
  112. Legs[3,vector]=Legs[3,vector]+holoEntity(16):forward()*Speed  
  113.  
  114. Div = INC/100
  115. RL = abs(sin(Div*180)*10)
  116. }
  117.  
  118. if(INC>=300&INC<=400)
  119. {
  120. Legs[4,vector]=Legs[4,vector]+holoEntity(16):forward()*Speed  
  121.  
  122. Div = INC/100
  123. LL = abs(sin(Div*180)*10)
  124. }
  125.  
  126.  
  127. if(INC>=400)
  128. {
  129. INC = 0    
  130. }
  131. }
  132.  
  133. F = rangerOffset(2000,Legs[1,vector]:setZ(holoEntity(1):pos():z()),vec(0,0,-1))
  134. B = rangerOffset(2000,Legs[2,vector]:setZ(holoEntity(1):pos():z()),vec(0,0,-1))
  135. R = rangerOffset(2000,Legs[3,vector]:setZ(holoEntity(1):pos():z()),vec(0,0,-1))
  136. L = rangerOffset(2000,Legs[4,vector]:setZ(holoEntity(1):pos():z()),vec(0,0,-1))
  137.  
  138. holoPos(2,F:position()+vec(0,0,FL))
  139. holoPos(3,B:position()+vec(0,0,BL))
  140. holoPos(4,R:position()+vec(0,0,RL))
  141. holoPos(5,L:position()+vec(0,0,LL))
  142.  
  143. holoAng(2,F:hitNormal():toAngle()+ang(90,0,0))
  144. holoAng(3,B:hitNormal():toAngle()+ang(90,0,0))
  145. holoAng(4,R:hitNormal():toAngle()+ang(90,0,0))
  146. holoAng(5,L:hitNormal():toAngle()+ang(90,0,0))
  147.  
  148. Avg = holoEntity(2):pos()+holoEntity(3):pos()+holoEntity(4):pos()+holoEntity(5):pos()
  149. holoPos(1,Avg/4+vec(0,0,75))
  150.  
  151. for(I=1,4)
  152. {
  153.  
  154. Distance = 200
  155. #Pos=rangerOffset(1000,Legs[I,vector],vec(0,0,-1)):position()
  156. Pos = holoEntity(I+1):pos()
  157. Dist_vec=(holoEntity(1):pos()-Pos)
  158. Dist=Dist_vec:length()
  159. Ang=Dist_vec:toAngle()
  160.  
  161. Ang2=ang(-asin(Dist/(Distance)),0,0)
  162.  
  163. holoPos(I+5,holoEntity(1):pos()+(Ang+Ang2):up()*Distance/4)
  164. holoAng(I+5,Ang+Ang2)
  165. holoPos(I+5+4,Pos+(Ang-Ang2):up()*Distance/4)
  166. holoAng(I+5+4,Ang-Ang2)
  167.      
  168. }
  169.  
  170. if(A|owner():lastSaid()=="auto"&holoEntity(1):bearing(owner():shootPos())<1)
  171. {
  172. holoAng(1,holoEntity(1):angles()+ang(0,1,0))
  173. }
  174.  
  175. if(D|owner():lastSaid()=="auto"&holoEntity(1):bearing(owner():shootPos())>1)
  176. {
  177. holoAng(1,holoEntity(1):angles()+ang(0,-1,0))
  178. }
  179.  
  180. P = holoEntity(16):pos()-vec(0,0,15)
  181.  
  182. V = P-Vehicle:pos()
  183. Vehicle:applyForce(V*(Vehicle:mass()*10)-Vehicle:vel()*(Vehicle:mass()/2))
  184.  
  185. Ang = holoEntity(16):angles()
  186.  
  187. TarQ = quat(Ang+ang(0,-90,0))
  188. CurQ = quat(Vehicle)
  189. Q = TarQ/CurQ
  190. Vlock = Vehicle:toLocal(rotationVector(Q)+Vehicle:pos())
  191.  
  192. Vehicle:applyTorque((150*Vlock - 12*Vehicle:angVelVector())*Vehicle:inertia())  
  193.  
  194.  
  195. if(owner():lastSaid()=="auto")
  196. {
  197. Dir = owner():shootPos()-holoEntity(19):pos()    
  198. }
  199. else
  200. {
  201. Dir = Vehicle:driver():aimPos()-holoEntity(19):pos()
  202. }
  203. holoAng(19,Dir:toAngle())
  204.  
  205.  
  206. if(Click|owner():lastSaid()=="auto"&holoEntity(1):pos():distance(owner():shootPos())<=500)
  207. {
  208. timer("bang",200)
  209. if(clk("bang"))
  210. {
  211. #ifdef entity:setPos( vector )
  212. Props:unshiftEntity(propSpawn("models/hunter/misc/sphere025x025.mdl",0))
  213. Props[1,entity]:setMass(500)
  214. Props[1,entity]:setColor(vec(0,0,0))
  215. Props[1,entity]:setPos(holoEntity(19):pos())
  216. Dir = holoEntity(19):forward()
  217. Props[1,entity]:applyForce(Dir*Props[1,entity]:mass()*2000)
  218. Props[10,entity]:propDelete()
  219. #else
  220. #endif
  221. }  
  222. else
  223. {  
  224. }
  225. }
  226.  
  227. if(last())
  228. {
  229. #Props:propDelete()
  230. }
  231.  
  232. if(Pod["Entity",entity]:driver()!=owner())
  233. {
  234. Pod["Entity",entity]:killPod()  
  235. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement