Advertisement
Tyunge

BeamNG.drive EGP HUD by Tyunge

Aug 27th, 2016
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.42 KB | None | 0 0
  1. @name BeamNg.Drive HUD by Tyunge
  2. @inputs [EGP]:wirelink
  3. @inputs [Base]:entity
  4. @inputs [Active Gear ParkingBrake Brake HeadLight A D Rpm]:number
  5. @outputs ScreenRes:vector2 Letter:string IndexAdd
  6. @persist [I R N NeutralGear ReverseGear RedLine Mph Kmh RpmMult Q IndexMin IndexBump Z]:number
  7. @trigger
  8.  
  9. ##Made By Tyunge :3
  10.  
  11. #SetUp:
  12.  
  13. # Step1:Spawn EGP
  14. # Step2:Link EGP to chair
  15. # Step3:Wire EGP from e2 to the EGP
  16. # Step4:Wire All the inputs on the e2 if u want
  17. # Step5:Reset E2
  18. # Step6:Profit
  19.  
  20.  
  21. #If you want to remove the white rev thing on the rpm gauge goto line 260 :-)
  22.  
  23. if(first()|dupefinished())
  24. {
  25.  
  26. EGP:egpClear()
  27.  
  28.  
  29. }
  30. if(first())
  31. {
  32.  
  33. #Set your screen resolution on ScreenRes mines 2560x1080, yours is most likly 1920x1080
  34.  
  35. ScreenRes=vec2(2560,1080)
  36.  
  37. NeutralGear = 0
  38. ReverseGear = 5
  39. RedLine = 7000
  40. RpmMult = 1000
  41. Kmh = 1
  42. Mph = 0
  43.  
  44.  
  45.  
  46.  
  47.  
  48. #Large Greyish Circle Index = 1
  49. I++
  50. EGP:egpCircle(I,(ScreenRes/1.25),vec2(200,200))
  51. EGP:egpColor(I,vec4(36,36,36,100))
  52.  
  53. #Smaller Center Whitish Circle Index = 2
  54. I++
  55. EGP:egpCircle(I,(ScreenRes/1.25),vec2(100,100))
  56. EGP:egpColor(I,vec4(200,200,200,25))
  57.  
  58. #km/h & Mph text Index = 3
  59. I++
  60. if(Kmh){
  61.  
  62. EGP:egpText(I,"km/h",vec2(10,10))
  63. EGP:egpPos(I,(ScreenRes/1.25)+vec2(0,0))
  64. EGP:egpAlign(I,1,1)
  65. EGP:egpFont(I,"Marlett",30)
  66. EGP:egpColor(I,vec4(200,200,200,150))
  67.  
  68. }
  69. if(Mph){
  70.  
  71. EGP:egpText(I,"mph",vec2(10,10))
  72. EGP:egpPos(I,(ScreenRes/1.25)+vec2(0,0))
  73. EGP:egpAlign(I,1,1)
  74. EGP:egpFont(I,"Marlett",30)
  75. EGP:egpColor(I,vec4(200,200,200,150))
  76.  
  77. }
  78.  
  79.  
  80. #x1000 rpm Index = 4
  81. I++
  82. EGP:egpText(I,"x"+RpmMult+" RPM",vec2(10,10))
  83. EGP:egpPos(I,(ScreenRes/1.25)+vec2(0,80))
  84. EGP:egpAlign(I,1,1)
  85. EGP:egpFont(I,"Marlett",20)
  86. EGP:egpColor(I,vec4(200,200,200,150))
  87.  
  88. #Numbers 1-7 Index = 5,6,7,8,9,10,11
  89. while(I<4+(RedLine/1000))
  90. {
  91. I++
  92. N++
  93.  
  94. Sin = sin(( 240/(RedLine/1000) )*N )*120
  95. Cos = cos(( 240/(RedLine/1000) )*N )*120
  96.  
  97. EGP:egpText(I,""+N,vec2(10,10))
  98. EGP:egpPos(I,(ScreenRes/1.25)+vec2(-5-Sin,-10+Cos))
  99. EGP:egpFont(I,"Marlett",25)
  100. EGP:egpColor(I,vec4(255,255,255,255))
  101.  
  102. if((RedLine/1000)>7){IndexBump++ Z = -7 IndexAdd = IndexBump + Z}
  103. if((RedLine/1000)<7){IndexBump++ Z = 7 IndexAdd = IndexBump - Z}
  104. IndexAdd = clamp(IndexAdd,-5e10,5e10)
  105.  
  106.  
  107.  
  108.  
  109. }
  110.  
  111. ##RpmOverlay
  112. while(I<27+IndexAdd)
  113. {
  114. R++
  115. I++
  116. EGP:egpBox(I,(ScreenRes/1.25)+vec2(-sin( (270/16)*R-5 )*173,cos( (270/16)*R-5 )*173),vec2(59,40))
  117. EGP:egpAngle(I,(((-R/16)*270)-16.875)+22)
  118. EGP:egpColor(I,vec4(26,26,26,120))
  119.  
  120. #RedLine
  121. EGP:egpColor(26+IndexAdd,vec4(127,0,0,140))
  122. EGP:egpColor(27+IndexAdd,vec4(127,0,0,140))
  123.  
  124. }
  125. ##Gear
  126. I++
  127. EGP:egpText(I,""+Gear,vec2(10,10))
  128. EGP:egpPos(I,(ScreenRes/1.25)+vec2(0,10))
  129. EGP:egpFont(I,"Marlett",60)
  130. EGP:egpColor(I,vec4(255,255,255,255))
  131.  
  132. ##Speed
  133. I++
  134. EGP:egpText(I,"",vec2(10,10))
  135. EGP:egpPos(I,(ScreenRes/1.25)+vec2(0,-75))
  136. EGP:egpFont(I,"Marlett",60)
  137. EGP:egpColor(I,vec4(255,255,255,255))
  138.  
  139. #HeadLight
  140. I++
  141. EGP:egpWedge(I,(ScreenRes/1.25)+vec2(155,50),vec2(15,25))
  142. EGP:egpColor(I,vec4(30,30,30,255))
  143. EGP:egpSize(I,180)
  144. EGP:egpAngle(I,90)
  145.  
  146. #Parking
  147. I++
  148. EGP:egpCircle(I,(ScreenRes/1.25)+vec2(135,100),vec2(15,15))
  149. EGP:egpColor(I,vec4(30,30,30,255))
  150.  
  151. ##Text P
  152. I++
  153. EGP:egpText(I,"P",vec2(10))
  154. EGP:egpPos(I,(ScreenRes/1.25)+vec2(130,92))
  155. EGP:egpFont(I,"Marlett",20)
  156.  
  157. #BrakeCircle
  158. I++
  159. EGP:egpCircle(I,(ScreenRes/1.25)+vec2(100,140),vec2(15,15))
  160. EGP:egpColor(I,vec4(30,30,30,255))
  161.  
  162. #Text ABS
  163. I++
  164. EGP:egpText(I,"ABS",vec2(10))
  165. EGP:egpPos(I,(ScreenRes/1.25)+vec2(89,133))
  166. EGP:egpFont(I,"Marlett",13)
  167.  
  168. #LeftArrow
  169. I++
  170. Res = (ScreenRes/1.25)+vec2(10,170)
  171. EGP:egpTriangle(I,Res,Res+vec2(15,-10),Res+vec2(15,10))
  172. EGP:egpColor(I,vec4(30,30,30,255))
  173.  
  174. #LeftArrow Box
  175. I++
  176. EGP:egpBox(I,(ScreenRes/1.25)+vec2(30,170),vec2(10,10))
  177. EGP:egpColor(I,vec4(30,30,30,255))
  178.  
  179. #RightArrow
  180. I++
  181. Res = (ScreenRes/1.25)+vec2(70,160)
  182. EGP:egpTriangle(I,Res,Res-vec2(15,-10),Res-vec2(15,10))
  183. EGP:egpColor(I,vec4(30,30,30,255))
  184.  
  185. #RightArrow Box
  186. I++
  187. EGP:egpBox(I,(ScreenRes/1.25)+vec2(50,160),vec2(10,10))
  188. EGP:egpColor(I,vec4(30,30,30,255))
  189.  
  190. ##OutLines :-)
  191.  
  192. ##OutLine Lights
  193. I++
  194. EGP:egpWedgeOutline(I,(ScreenRes/1.25)+vec2(155,50),vec2(15,25))
  195. EGP:egpColor(I,vec4(255,255,255,255))
  196. EGP:egpSize(I,180)
  197. EGP:egpAngle(I,90)
  198.  
  199. ##Parking OutLine
  200. I++
  201. EGP:egpCircleOutline(I,(ScreenRes/1.25)+vec2(135,100),vec2(15,15))
  202. EGP:egpColor(I,vec4(255,255,255,255))
  203.  
  204. ##Brake OutLine
  205. I++
  206. EGP:egpCircleOutline(I,(ScreenRes/1.25)+vec2(100,140),vec2(15,15))
  207. EGP:egpColor(I,vec4(255,255,255,255))
  208.  
  209. ##Rpm BaseCenter
  210. I++
  211. EGP:egpBox(I,(ScreenRes/1.25),vec2(0))
  212.  
  213. ##Rpm RedLine. not the red area, the litteral redLine that moves
  214. I++
  215. EGP:egpBox(I,vec2(0,175),vec2(5,45))
  216. EGP:egpColor(I,vec4(220,0,0,255))
  217. EGP:egpParent(I,42+IndexAdd)
  218. }
  219. interval( 1 )
  220. if(Kmh){
  221. Unit = round(toUnit("km/h",Base:vel():length()))
  222. }
  223. if(Mph){
  224. Unit = round(toUnit("mph",Base:vel():length()))
  225. }
  226. timer("Blink",500)
  227.  
  228. if(clk("Blink")){Q++}
  229. if(Q>1){Q=0}
  230.  
  231. #Gear
  232. if(Gear==NeutralGear){Letter = "N"}
  233. elseif(Gear==ReverseGear){Letter = "R"}
  234. elseif(Gear>NeutralGear){Letter = ""+Gear}
  235. if(ParkingBrake){Letter = "P"}
  236.  
  237. EGP:egpSetText(28+IndexAdd,""+Letter)
  238. EGP:egpAlign(28+IndexAdd,1,0)
  239.  
  240.  
  241. #Kmh
  242. EGP:egpSetText(29+IndexAdd,""+Unit)
  243. EGP:egpAlign(29+IndexAdd,1,0)
  244.  
  245.  
  246. ##Indicators
  247. if(Brake){EGP:egpColor(33+IndexAdd,vec4(255,93,0,255))}else{EGP:egpColor(33+IndexAdd,vec4(30,30,30,255))}
  248. if(ParkingBrake){EGP:egpColor(31+IndexAdd,vec4(255,93,0,255))}else{EGP:egpColor(31+IndexAdd,vec4(30,30,30,255))}
  249. if(HeadLight){EGP:egpColor(30+IndexAdd,vec4(255,93,0,255))}else{EGP:egpColor(30+IndexAdd,vec4(30,30,30,255))}
  250.  
  251. if(A & Q){EGP:egpColor(35+IndexAdd,vec4(255,93,0,255)) EGP:egpColor(36+IndexAdd,vec4(255,93,0,255))}else{EGP:egpColor(35+IndexAdd,vec4(30,30,30,255)) EGP:egpColor(36+IndexAdd,vec4(30,30,30,255))}
  252.  
  253. if(D & Q){EGP:egpColor(37+IndexAdd,vec4(255,93,0,255)) EGP:egpColor(38+IndexAdd,vec4(255,93,0,255))}else{EGP:egpColor(37+IndexAdd,vec4(30,30,30,255)) EGP:egpColor(38+IndexAdd,vec4(30,30,30,255))}
  254.  
  255.  
  256. EGP:egpAngle(42+IndexAdd,(Rpm/RedLine)*-240)
  257.  
  258.  
  259. #CommentOut or remove all code under this comment if you want to remove the white Rpm thing when you rev
  260.  
  261. for(I = 12, 25)
  262. {
  263. Color = (Rpm/RedLine)*vec4(200,200,200,255)
  264. Color = clamp(Color,vec4(26,26,26,120),vec4(200,200,200,255))
  265.  
  266. Index = round(((Rpm/RedLine)*13)+12)
  267. Index = clamp(Index,14,24)
  268. EGP:egpColor(Index+IndexAdd,Color)
  269. EGP:egpColor(Index+1+IndexAdd,vec4(26,26,26,120))
  270.  
  271. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement