Advertisement
Guest User

Govnokod

a guest
Aug 8th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.13 KB | None | 0 0
  1. -- Tick function that will be executed every logic tick
  2. function onTick()
  3.     fuel = input.getNumber(1)
  4.     batt = input.getNumber(2)
  5.     rps = input.getNumber(3)
  6.     tmp = input.getNumber(4)
  7.     thr = input.getNumber(5)
  8. end
  9.  
  10. -- Draw function that will be executed when this script renders to a screen
  11. function onDraw()
  12.     w = screen.getWidth()                 -- Get the screen's width and height
  13.     h = screen.getHeight()
  14.     screen.setColor(169, 169, 169)
  15.     screen.drawClear()
  16.     screen.setColor(0, 0, 0)
  17.     screen.drawRectF(2, 2, 60, 60)
  18.     screen.setColor(255, 255, 0)
  19.     screen.drawTextBox(5, 15, w, 6, "Fuel:", -1, 0)
  20.     screen.drawTextBox(5, 22, w, 6, "Battery:", -1, 0)
  21.     screen.drawTextBox(5, 29, w, 6, "RPS:", -1, 0)
  22.     screen.drawTextBox(5, 36, w, 6, "Eng Temp:", -1, 0)
  23.    
  24.     screen.drawTextBox(47, 15, w - 6, 6, string.format("%.1f", fuel), -1, 0)
  25.     screen.drawTextBox(47, 22, w - 6, 6, string.format("%.1f", batt), -1, 0)
  26.     screen.drawTextBox(49, 29, w - 6, 6, string.format("%.0f", rps), -1, 0)
  27.     screen.drawTextBox(49, 36, w - 6, 6, string.format("%.0f", tmp), -1, 0)
  28.  
  29.  
  30.     if tmp > 94 then
  31.         screen.setColor(255, 0, 0)
  32.         screen.drawText(18, 3, "Danger!")
  33.         screen.drawText(3, 10, "High Temp!")
  34.     end
  35.    
  36.     if thr < 0.1 then
  37.         one()
  38.     elseif thr > 0.1 and thr < 0.2 then
  39.         one()
  40.         two()
  41.     elseif thr > 0.2 and thr < 0.3 then
  42.         one()
  43.         two()
  44.         three()
  45.     elseif thr > 0.3 and thr < 0.4 then
  46.         one()
  47.         two()
  48.         three()
  49.         four()
  50.     elseif thr > 0.4 and thr < 0.5 then
  51.         one()
  52.         two()
  53.         three()
  54.         four()
  55.         five()
  56.     elseif thr > 0.5 and thr < 0.6 then
  57.         one()
  58.         two()
  59.         three()
  60.         four()
  61.         five()
  62.         six()
  63.     elseif thr > 0.6 and thr < 0.7 then
  64.         one()
  65.         two()
  66.         three()
  67.         four()
  68.         five()
  69.         six()
  70.         seven()
  71.     elseif thr > 0.7 and thr < 0.8 then
  72.         one()
  73.         two()
  74.         three()
  75.         four()
  76.         five()
  77.         six()
  78.         seven()
  79.         eight()
  80.     elseif thr > 0.8 and thr < 0.9 then
  81.         one()
  82.         two()
  83.         three()
  84.         four()
  85.         five()
  86.         six()
  87.         seven()
  88.         eight()
  89.         nine()
  90.     elseif thr > 0.9 and thr < 1 then
  91.         one()
  92.         two()
  93.         three()
  94.         four()
  95.         five()
  96.         six()
  97.         seven()
  98.         eight()
  99.         nine()
  100.         ten()
  101.     elseif thr == 1 then
  102.         one()
  103.         two()
  104.         three()
  105.         four()
  106.         five()
  107.         six()
  108.         seven()
  109.         eight()
  110.         nine()
  111.         ten()
  112.         eleven()
  113.     end
  114. end
  115.    
  116. function one()
  117.     screen.setColor(0, 255, 0)
  118.     screen.drawRectF(12, 53, 4, 5)
  119. end
  120.    
  121. function two()
  122.     screen.setColor(0, 255, 0)
  123.     screen.drawRectF(16, 53, 4, 5)
  124. end
  125.    
  126. function three()
  127.     screen.setColor(0, 255, 0)
  128.     screen.drawRectF(20, 53, 4, 5)
  129. end
  130.    
  131. function four()
  132.     screen.setColor(0, 255, 0)
  133.     screen.drawRectF(24, 53, 4, 5)
  134. end
  135.    
  136. function five()
  137.     screen.setColor(255, 255, 0)
  138.     screen.drawRectF(28, 53, 4, 5)
  139. end
  140.    
  141. function six()
  142.     screen.setColor(255, 255, 0)
  143.     screen.drawRectF(32, 53, 4, 5)
  144. end
  145.    
  146. function seven()
  147.     screen.setColor(255, 255, 0)
  148.     screen.drawRectF(36, 53, 4, 5)
  149. end
  150.    
  151. function eight()
  152.     screen.setColor(255, 255, 0)
  153.     screen.drawRectF(40, 53, 4, 5)
  154. end
  155.    
  156. function nine()
  157.     screen.setColor(255, 0, 0)
  158.     screen.drawRectF(44, 53, 4, 5)
  159. end
  160.    
  161. function ten()
  162.     screen.setColor(255, 0, 0)
  163.     screen.drawRectF(48, 53, 4, 5)
  164. end
  165.    
  166. function eleven()
  167.     screen.setColor(255, 0, 0)
  168.     screen.drawRectF(52, 53, 4, 5)
  169. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement