Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 74.21 KB | None | 0 0
  1. //map info here
  2.  
  3. checkpoints = [];
  4.  
  5. tracks = [];
  6.  
  7. mapSeed = 144;
  8. mapSize = 60;
  9.  
  10. track1 = {checkpoints:[],roadblocks:[],laps:3,name:"rm -rf / circuit"};
  11. track1.checkpoints.push({x:30, y:40});
  12. track1.checkpoints.push({x:-10, y:40});
  13. track1.checkpoints.push({x:-25, y:-115});
  14. track1.checkpoints.push({x:-135, y:-115});
  15. track1.checkpoints.push({x:-265, y:-100});
  16. track1.checkpoints.push({x:-180, y:75});
  17. track1.checkpoints.push({x:-100, y:140});
  18. track1.checkpoints.push({x:75, y:115});
  19. track1.checkpoints.push({x:30, y:80});
  20. track1.roadblocks=[1,0,1, 0,0,0, 0,1,1,0];
  21.  
  22. tracks.push(track1);
  23.  
  24. track2 = {checkpoints:[],roadblocks:[],laps:1,name:"Sprint alpha"};
  25. track2.checkpoints.push({x:25, y:-185});
  26. track2.checkpoints.push({x:25, y:-130});
  27. track2.checkpoints.push({x:55, y:0});
  28. track2.checkpoints.push({x:165, y:0});
  29. track2.checkpoints.push({x:200, y:125});
  30. track2.checkpoints.push({x:-295, y:140});
  31. track2.checkpoints.push({x:-70, y:160});
  32. track2.checkpoints.push({x:80, y:120});
  33. track2.checkpoints.push({x:25, y:80});
  34. track2.checkpoints.push({x:55, y:40});
  35. track2.checkpoints.push({x:-15, y:-115});
  36. track2.checkpoints.push({x:-160, y:-80});
  37. track2.checkpoints.push({x:-270, y:-105});
  38. track2.checkpoints.push({x:-225, y:5});
  39. track2.roadblocks=[1,1,0, 1,1,1, 1,0,0,1, 1,1,1, 0,0,0, 0,0,1,1];
  40.  
  41. tracks.push(track2);
  42.  
  43. checkpoints = track1.checkpoints;
  44.  
  45. sandboxArea = {x:155, y:-150};
  46. cornerOfShame = {x:250, y:-150};
  47.  
  48. roadblocks = [];
  49.  
  50. roadblocks.push({x:5,y:-125,angle:Math.PI/2});
  51. roadblocks.push({x:55,y:-125,angle:Math.PI/2});
  52.  
  53. roadblocks.push({x:85,y:35,angle:Math.PI/2});
  54.  
  55. roadblocks.push({x:125,y:15,angle:0});
  56. roadblocks.push({x:115,y:15,angle:0});
  57.  
  58. roadblocks.push({x:125,y:-15,angle:0});
  59. roadblocks.push({x:115,y:-15,angle:0});
  60.  
  61. roadblocks.push({x:-75,y:155,angle:0});
  62. roadblocks.push({x:-65,y:155,angle:0});
  63.  
  64. roadblocks.push({x:-85,y:145,angle:Math.PI/2});
  65. roadblocks.push({x:-85,y:135,angle:Math.PI/2});
  66.  
  67. roadblocks.push({x:5,y:-245,angle:Math.PI/2});
  68.  
  69. roadblocks.push({x:185,y:5,angle:Math.PI/2});
  70.  
  71. roadblocks.push({x:165,y:15,angle:0});
  72. roadblocks.push({x:175,y:15,angle:0});
  73.  
  74. roadblocks.push({x:155,y:5,angle:Math.PI/2});
  75. roadblocks.push({x:155,y:-5,angle:Math.PI/2});
  76.  
  77. roadblocks.push({x:255,y:-55,angle:Math.PI/2});
  78.  
  79. roadblocks.push({x:285,y:125,angle:0});
  80. roadblocks.push({x:295,y:125,angle:0});
  81.  
  82. bannerPositions = [];
  83.  
  84. bannerPositions.push({x:25,y:-205});
  85. bannerPositions.push({x:-20,y:-110});
  86. bannerPositions.push({x:-95,y:-120});
  87. bannerPositions.push({x:-220,y:-120});
  88. bannerPositions.push({x:-120,y:60});
  89. bannerPositions.push({x:75,y:100});
  90. bannerPositions.push({x:120,y:0});
  91.  
  92. //noPassageSigns.push();
  93.  
  94. customMap = true;
  95. map =
  96. "999999999999999999999999999999999999999999999999999999999999\n"+
  97. "999999999999999999999999999999999999999999999999999999999999\n"+
  98. "999999999999999999999999999999999999999999999999999999999999\n"+
  99. "999999999999999999999999999999999999999999999999999999999999\n"+
  100. "999999999999999999999999999999999999999999999999999999999999\n"+
  101. "999999999999999999999999999999999999999999999999999999999999\n"+
  102. "999999999999999999999999999999999999999999999999999999999999\n"+
  103. "999999999999999999999999999999999999999999999999999999999999\n"+
  104. "999999999999999999999999999999999999999999999999999999999999\n"+
  105. "999999999999999999999999999999999999999999999999999999999999\n"+
  106. "999999999999999999999999999999999999999999999999999999999999\n"+
  107. "9999999 9 9 9999999999999999999999999999999999999\n"+
  108. "99999 999 99 9999999999999999999999999999999999999\n"+
  109. "99999 9999999999999 999999999999999999999999999999999999\n"+
  110. " 999 999999999999999 9999999999999999999999999999 99 \n"+
  111. " 99999999999999 9 9 999999999999999 999 \n"+
  112. " 9999999999993 22 99999999999 99 \n"+
  113. "99999999999999 3999 9 9 9 99999999 9 99 \n"+
  114. "99999999999993 9999 9999999999999999 9999999 9 999 9 \n"+
  115. "9999999999999299999 99999999999 999999 999 99 \n"+
  116. "99999999999 99 99999999999 999999 999999999 \n"+
  117. "99999999999 99 99999999999 99999999999 99999999 9\n"+
  118. "99999999999 99 99 99999999999 9999999 99999999 9\n"+
  119. "99999999 99 99999999999 9999999 99999999 9\n"+
  120. "99999999 99 999999999999999 99999999 99999999 9\n"+
  121. "99999999 99999999999999999 99999999 99999999 9\n"+
  122. "99999999 999999999999999993 4 999 99999999 9\n"+
  123. "99999999 399999999999999999 4 99999999999 999 99999999 9\n"+
  124. "999999 999999999999999994 399999999999 999 99999999 9\n"+
  125. "999999 99999999999999999 4 99 999999 9\n"+
  126. "999999 99999999999999999993 499 9 99999 9\n"+
  127. "9999993 9999999999999999999 4 99 99999 9999999 9999 9\n"+
  128. "999999 99999999999999999994 399 99999 99999999 999 9\n"+
  129. "999999 9999999999999999999 4 999 999999 999999999 99 9\n"+
  130. "999999 99999999999999999993 49992 999999 9999999 9 9\n"+
  131. "999999 49999999999999999999 4 993 9999999999 99999999 9\n"+
  132. "999999 99999999999999999994 399 199999999999 9999999999 9\n"+
  133. "999999 9993 39999999999 4 993 99999999999 9999999999 9\n"+
  134. "99 3 999 99999999993 4999 9999999999 9999999999 9\n"+
  135. "99 999 99 9999999999 4 999 19999999999 9999999999 9\n"+
  136. "99 9999999 99 999999999 4 399 9999999999 9999999999 9\n"+
  137. "99 99 99 219999993354 5345999999 9\n"+
  138. "99 5 99 11 3454999999 9\n"+
  139. "999999999999999999999999999999991 9999934543 3554399999 \n"+
  140. " 9999999999999999999999999999 9999994454 535999999999 \n"+
  141. " 999999999999999999999999999 99999994539 9445399999999\n"+
  142. "999 99999999999999999999999999 9999999459 3454999999999\n"+
  143. "9999 99999999999999999999999993 99999993455434599999999999\n"+
  144. "9999 9999999999999999999999999 99999999345345559999999999\n"+
  145. "9999 999999999999999999999999 9999999999999999999999999\n"+
  146. "9999 999999999999999999999999 9999999999999999999999999\n"+
  147. "9999 999999999999999999999999 9999999999999999999999999\n"+
  148. "9999 999999999999999 9999999999999999999999999\n"+
  149. "9999 9 9 999 9999999999999999999999999\n"+
  150. "99999999999999 9 9999999999999999999999999\n"+
  151. "999999999999999999999999999999999999999999999999999999999999\n"+
  152. "999999999999999999999999999999999999999999999999999999999999\n"+
  153. "999999999999999999999999999999999999999999999999999999999999\n"+
  154. "999999999999999999999999999999999999999999999999999999999999" ;
  155.  
  156. //ship info here
  157.  
  158. var Astral = '{"name":"Astral Accelerator","level":1,"model":1,"size":1.5,"zoom":1.2,"specs":{"shield":{"capacity":[150,150],"reload":[10,10]},"generator":{"capacity":[200,200],"reload":[20,20]},"ship":{"mass":80,"speed":[140,140],"rotation":[40,40],"acceleration":[150,150],"dash":{"rate":1,"burst_speed":[200,200],"speed":[240,240],"acceleration":[90,90],"initial_energy":[10,10],"energy":[100,100]}}},"bodies":{"main":{"section_segments":10,"offset":{"x":0,"y":-40,"z":10},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-90,-93,-95,-90,-30,0,50,100,105],"z":[-7,-7,-7,-7,-7,-7,0,0,0]},"width":[20,23,25,27,30,27,30,26,0],"height":[0,6,8,10,15,18,8,10,0],"texture":[17,13,63,1,10,1,10,12]},"stripes":{"section_segments":16,"offset":{"x":15,"y":-40,"z":10},"position":{"x":[-4,-4,-4,11,5,0,0,0],"y":[-92,-30,0,50,100],"z":[1,6,10,3,3,0]},"width":[3,3,3,3,3,3],"height":[1,1,1,1,1],"texture":[63]},"cockpit":{"section_segments":10,"offset":{"x":0,"y":-20,"z":17},"position":{"x":[0,0,0,0,0,0],"y":[10,30,40,70,80],"z":[-2,0,0,0,0]},"width":[7.5,10,10,9.5,0],"height":[3,10,11,10,0],"texture":[9,4,13,4],"propeller":false},"detail":{"section_segments":8,"angle":3,"offset":{"x":26,"y":-50,"z":6},"position":{"x":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"y":[0,3,7,11,14,17,21,25,28,31,35,39,42,45,49,53,57],"z":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"width":[1,4,6,4,1,4,6,4,1,4,6,4,1,4,6,4,1],"height":[1,4,6,4,1,4,6,4,1,4,6,4,1,4,6,4,1],"texture":[4,17,17,4,4,17,17,4,4,17,17,4,4,17,17,4]},"engine":{"section_segments":4,"offset":{"x":0,"y":-95,"z":18},"position":{"x":[0,0,0,0],"y":[-18,-15,15,18],"z":[0,0,0,0]},"width":[0,10,10,0],"height":[0,4,4,0],"texture":[18]},"bracings1":{"section_segments":8,"angle":90,"offset":{"x":0,"y":-85,"z":18},"position":{"x":[0,0,0,0,0,0,0,0,0,0,0],"y":[-15,-14,-11.5,-10,-8,0,8,10,11.5,14,15],"z":[-20,-10,-1,1,2,0,2,1,-1,-10,-20]},"width":[4,4,4,4,4,5,4,4,4,4,4],"height":[0,10,4,3,2,3,2,3,4,10,0],"propeller":false,"texture":[13]},"bracings2":{"section_segments":8,"angle":90,"offset":{"x":0,"y":-105,"z":18},"position":{"x":[0,0,0,0,0,0,0,0,0,0,0],"y":[-15,-14,-11.5,-10,-8,0,8,10,11.5,14,15],"z":[-20,-10,-1,1,2,0,2,1,-1,-10,-20]},"width":[4,4,4,4,4,5,4,4,4,4,4],"height":[0,10,4,3,2,3,2,3,4,10,0],"propeller":false,"texture":[13]},"engines":{"section_segments":12,"offset":{"x":18,"y":0,"z":15},"position":{"x":[0,0,0,0,0,0,0,0],"y":[25,20,25,40,75,70,65],"z":[5,0,0,0,0,0,0,0]},"width":[0,5,7,8,8,6,0],"height":[0,14,15,15,13,10,0],"texture":[13,1,63,10,18,17],"propeller":true}},"wings":{"main":{"length":[46,0,25,-25,20],"width":[100,20,70,0,70,10],"angle":[10,0,110,110,-70],"position":[-30,5,-10,30,-10,20],"texture":[18,11,63],"doubleside":true,"bump":{"position":30,"size":7},"offset":{"x":0,"y":30,"z":0}},"font":{"length":[45],"width":[61,10],"angle":[-6,20],"position":[-60,-100],"texture":[63],"doubleside":true,"bump":{"position":30,"size":20},"offset":{"x":0,"y":-20,"z":5}}},'+
  159. '"typespec":{"name":"Turbo","level":1,"model":1,"code":101,"specs":{"shield":{"capacity":[150,150],"reload":[10,10]},"generator":{"capacity":[200,200],"reload":[20,20]},"ship":{"mass":150,"speed":[140,140],"rotation":[40,40],"acceleration":[150,150],"dash":{"rate":1,"burst_speed":[200,200],"speed":[240,240],"acceleration":[90,90],"initial_energy":[10,10],"energy":[100,100]}}},"shape":[4.058,4.112,4.016,3.983,1.924,1.681,1.362,1.335,1.111,1.114,1.432,1.413,1.408,1.442,1.495,1.584,1.707,1.9,2.145,2.274,2.14,2.112,2.381,2.366,2.29,1.95,2.29,2.366,2.381,2.112,2.14,2.274,2.145,1.9,1.707,1.584,1.495,1.442,1.41,1.413,1.432,1.114,1.111,1.335,1.362,1.681,1.924,3.983,4.016,4.112],"lasers":[],"radius":4.112}}';
  160. var ShadowX1 = '{"name":"Shadow X-1","level":1,"model":2,"size":0.8,"zoom":0.8,"specs":{"shield":{"capacity":[130,130],"reload":[6,6]},"generator":{"capacity":[80,80],"reload":[16,16]},"ship":{"mass":70,"speed":[155,155],"rotation":[60,60],"acceleration":[150,150],"dash":{"rate":2,"burst_speed":[180,180],"speed":[170,170],"acceleration":[170,170],"initial_energy":[10,10],"energy":[5,5]}}},"bodies":{"main":{"section_segments":10,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0,0,0],"y":[-100,-98,-95,-70,-40,0,40,70,80,90,100],"z":[0,0,0,0,0,0,0,0,0,0,0]},"width":[0,10,20,30,40,20,20,40,40,40,20,0],"height":[0,4,4,20,20,10,10,15,15,15,10,10],"texture":[12,5,63,4,4,63,4,4,5]},"back":{"section_segments":10,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0],"y":[90,95,100,105,90],"z":[0,0,0,0,0]},"width":[10,15,18,19,2],"height":[3,5,7,8,2],"texture":[63],"propeller":true},"cockpit":{"section_segments":8,"offset":{"x":0,"y":-25,"z":15},"position":{"x":[0,0,0,0,0,0],"y":[-45,-40,-25,0,5],"z":[0,0,0,0,0,0]},"width":[0,10,15,13,0],"height":[0,10,15,5,0],"texture":[9]},"laser":{"section_segments":10,"offset":{"x":70,"y":10,"z":-20},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-20,-15,0,10,20,25,30,40,70,60],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,10,15,15,15,10,10,15,5,0],"height":[0,10,15,15,15,10,10,15,5,0],"texture":[3,4,10,3],"propeller":true}},"wings":{"top":{"offset":{"x":0,"y":50,"z":5},"length":[30],"width":[70,30],"angle":[90],"position":[0,50],"texture":[4],"bump":{"position":10,"size":15}},"side_joins":{"offset":{"x":0,"y":30,"z":-3},"length":[100],"width":[100,40],"angle":[0],"position":[-50,50],"texture":[4],"bump":{"position":10,"size":10}}},'+
  161. '"typespec":{"name":"Shadow X-1","level":3,"model":3,"code":303,"specs":{"shield":{"capacity":[130,130],"reload":[6,6]},"generator":{"capacity":[80,80],"reload":[16,16]},"ship":{"mass":70,"speed":[155,155],"rotation":[60,60],"acceleration":[150,150]}},"shape":[1.6,1.582,1.552,1.313,1.138,1.009,0.919,0.75,0.688,0.708,0.733,1.157,1.297,1.359,1.392,1.431,1.696,1.975,2.192,2.258,1.661,1.429,1.58,1.628,1.705,1.835,1.705,1.628,1.58,1.429,1.661,2.258,2.192,1.975,1.696,1.431,1.392,1.359,1.297,1.157,0.733,0.708,0.688,0.75,0.919,1.009,1.138,1.313,1.552,1.582],"lasers":[],"radius":2.258}}';
  162. var RADDiamondLancer = '{"name":"Lancer","level":1,"model":3,"size":2,"specs":{"shield":{"capacity":[110,110],"reload":[5,5]},"generator":{"capacity":[300,300],"reload":[10,10]},"ship":{"mass":120,"speed":[135,135],"rotation":[55,55],"acceleration":[180,180],"dash":{"rate":2,"burst_speed":[165,165],"speed":[165,165],"acceleration":[200,200],"initial_energy":[35,35],"energy":[17,17]}}},"bodies":{"main":{"section_segments":6,"offset":{"x":0,"y":-50,"z":0},"position":{"x":[0,0,0,0,0,0,0,0],"y":[-53,-50,-40,-20,10,40,80,84],"z":[0,0,0,0,0,0,0,0]},"width":[18,25,25,23,23,25,20,0],"height":[0,5,10,10,10,10,7,0],"texture":[1,1,1,1,1,8,3.9],"angle":0},"bumper":{"section_segments":6,"offset":{"x":-1,"y":-100,"z":0},"position":{"x":[1.5,1,0,-5,-5,0,0],"y":[0,10,15,25,27],"z":[0,0,0,0,0,0,0]},"width":[5,5,5,5,0],"height":[5,5,5,5,0],"texture":[3.9,16.9,3.9],"angle":90},"cockpitWindshield":{"section_segments":3,"offset":{"x":0,"y":-40,"z":10},"position":{"x":[-20,0,5,0,-20,0,0],"y":[-20,-10,0,10,20],"z":[-6,-2,0,-2,-6,0,0]},"width":[0,12,12,12,0],"height":[0,5,5,5,0],"texture":[8.6],"angle":90},"cockpitBack":{"section_segments":6,"offset":{"x":0,"y":10,"z":7},"position":{"x":[0,0,0,0,0,0,0],"y":[-50,-20,0,20,23],"z":[-2,0,0,0,0,0,0]},"width":[15,15,15,13,0],"height":[0,10,10,10,0],"texture":[4,10,17.9,3.9],"angle":0},"cockpitBackSides":{"section_segments":6,"offset":{"x":13,"y":0,"z":7},"position":{"x":[5,0,0,0,0,0,0],"y":[-20,-10,0,3],"z":[-3,0,0,0,0,0,0]},"width":[0,7,7,0],"height":[0,5,5,0],"texture":[4,17.5,4,3],"angle":0},"enginesTop":{"section_segments":6,"offset":{"x":12,"y":70,"z":7},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-60,-58,-55,-40,-30,-25,-20,-8,-30],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,5,7,7,5,5,8,6,0],"height":[0,5,7,7,5,5,8,6,0],"texture":[3.9,3.9,10.4,63,2.9,2.9,3.9,16.9],"angle":0,"propeller":true},"enginesBottom":{"section_segments":6,"offset":{"x":18,"y":65,"z":-5},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-55,-54,-50,-40,-30,-25,-20,-8,-30],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,5,7,7,5,5,8,6,0],"height":[0,5,7,7,5,5,8,6,0],"texture":[3.9,3.9,17.9,63,2.9,2.9,3.9,16.9],"angle":0,"propeller":true},"enginesConnect":{"section_segments":6,"offset":{"x":1,"y":36,"z":0},"position":{"x":[4,-12,0,0,0,0,0],"y":[-20,10],"z":[-5,8,0,0,0,0,0]},"width":[2,2],"height":[2,2],"texture":[1.9],"angle":90},"boostTank":{"section_segments":12,"offset":{"x":0,"y":-15,"z":0},"position":{"x":[-30,-30,-30,-30,-30,-30,-30,-30,-30,-30],"y":[-30,-30,-26,-20,-5,5,20,26,30,30],"z":[0,0,0,0,0,0,0,0,0,0,0,0]},"width":[0,5,7.5,8,8,8,8,7.5,5,0],"height":[0,5,7.5,8,8,8,8,7.5,5,0],"texture":[63,63,63,13,4,13,63,63,63],"angle":0},"boostTankHolder":{"section_segments":6,"angle":90,"offset":{"x":0,"y":-15,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-44,-43,-39,-38,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,6,8,4,4],"height":[0,4,6,4,4],"texture":[4,63,4,4,4,4,4,63,4]},"boostPipeMain":{"section_segments":6,"offset":{"x":0,"y":-20,"z":11},"position":{"x":[-30,-30,-30,-30,-27,-15,-15,0,0],"y":[-20,-18,-15,30,35,45,48],"z":[-6,-2,0,0,0,0,0,0]},"width":[2,2,2,2,2,2,0],"height":[2,2,2,2,2,2,0],"texture":[63],"angle":0},"boostPipeSide":{"section_segments":6,"offset":{"x":0,"y":-20,"z":9},"position":{"x":[-34,-34,-34,-34,-36,-40,-42,-42,-42],"y":[-20,-18,-15,25,30,33,40,46],"z":[-6,-2,0,0,0,0,0,0]},"width":[2,2,2,2,2,2,2,0],"height":[2,2,2,2,2,2,2,0],"texture":[63],"angle":0},"boostTankEngineHolder":{"section_segments":6,"angle":90,"offset":{"x":0,"y":27,"z":3},"position":{"x":[0,0,0,0,10,0,0,0,0],"y":[-54,-53,-49,-48,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,6,8,3,3],"height":[0,4,6,3,3],"texture":[4,63,4,4,4,4,4,63,4]},"engineBoostTankOffset":{"section_segments":6,"offset":{"x":0,"y":70,"z":3},"position":{"x":[-42,-42,-42,-42,-42,-42,-42,-42,-42],"y":[-60,-58,-55,-40,-30,-25,-20,-8,-30],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,5,7,7,5,5,8,6,0],"height":[0,5,7,7,5,5,8,6,0],"texture":[3.9,3.9,10.4,63,2.9,2.9,3.9,16.9],"angle":0,"propeller":true},"logo1":{"section_segments":4,"offset":{"x":0,"y":-65,"z":11},"position":{"x":[0,0,0,0,0,0,0],"y":[0,5],"z":[0,0,0,0,0,0,0]},"width":[0,3.2],"height":[0,0],"texture":[4,3,4,3],"angle":0},"logo2":{"section_segments":4,"offset":{"x":0.1,"y":-65,"z":11},"position":{"x":[0,0,0,0,0,0,0],"y":[0,5],"z":[0,0,0,0,0,0,0]},"width":[0,3.2],"height":[0,0],"texture":[4,3,4,3],"angle":120},"logo3":{"section_segments":4,"offset":{"x":0.1,"y":-65,"z":11},"position":{"x":[0,0,0,0,0,0,0],"y":[5,15],"z":[0,-3,0,0,0,0,0]},"width":[3.2,0],"height":[0,0],"texture":[4],"angle":60},"logo4":{"section_segments":4,"offset":{"x":0,"y":-65,"z":11},"position":{"x":[0,0,0,0,0,0,0],"y":[5,15],"z":[0,0,0,0,0,0,0]},"width":[3.2,0],"height":[0,0],"texture":[4],"angle":180},"logoDeco":{"section_segments":4,"offset":{"x":5,"y":-72,"z":9},"position":{"x":[0,0,3,5,8,13,14,15],"y":[-20,-10,2,5,8,14,20,26],"z":[-4,0,-1,-1,-1,-2,-3,-3,0]},"width":[3,3,3,3,3,3,2,0,0],"height":[2,2,2,2,2,1,0,0],"texture":[3.9],"angle":0}},"wings":{"cockpitTop":{"doubleside":false,"offset":{"x":0,"y":-30,"z":15},"length":[10,13],"width":[30,20,4],"angle":[-11,-42],"position":[0,0,11],"texture":[11.5,9],"bump":{"position":20,"size":3}},"cockpitTopBack":{"doubleside":false,"offset":{"x":0,"y":-17,"z":14.8},"length":[10,13],"width":[10,10,20],"angle":[-11,-42],"position":[0,0,10],"texture":[4],"bump":{"position":20,"size":3}},"wingsBackTop":{"doubleside":true,"offset":{"x":14,"y":37,"z":10},"length":[20],"width":[20,7],"angle":[20],"position":[0,20],"texture":[63],"bump":{"position":20,"size":5}},"wingsBackBottom":{"doubleside":true,"offset":{"x":20,"y":31,"z":-8},"length":[30],"width":[16,4],"angle":[-25],"position":[0,20],"texture":[63],"bump":{"position":20,"size":5}}},'+
  163. '"typespec":{"name":"RAD Diamond Lancer","level":1,"model":3,"code":103,"specs":{"shield":{"capacity":[110,110],"reload":[5,5]},"generator":{"capacity":[300,300],"reload":[10,10]},"ship":{"mass":125,"speed":[135,135],"rotation":[55,55],"acceleration":[180,180],"dash":{"rate":2,"burst_speed":[165,165],"speed":[165,165],"acceleration":[200,200],"initial_energy":[35,35],"energy":[17,17]}}},"shape":[4.233,4.229,4.139,2.578,1.863,1.514,1.3,1.152,1.053,0.983,0.922,0.87,0.839,0.823,0.825,0.846,1.051,1.188,1.318,2.839,2.589,2.753,2.465,2.574,2.524,1.813,2.524,2.574,2.465,2.936,3.117,2.997,2.542,2.481,2.443,2.066,1.892,1.532,1.532,1.786,1.874,1.9,1.876,2.081,2.256,2.28,2.132,2.578,4.139,4.229],"lasers":[],"radius":4.233}}';
  164. var ZerdBooster = '{"name":"Z Booster","level":1,"model":4,"size":1.4,"specs":{"shield":{"capacity":[150,150],"reload":[7,7]},"generator":{"capacity":[200,200],"reload":[13,13]},"ship":{"mass":140,"speed":[160,160],"rotation":[50,50],"acceleration":[160,160],"dash":{"rate":2,"burst_speed":[200,200],"speed":[160,160],"acceleration":[0,0],"initial_energy":[50,50],"energy":[0,0]}}},"bodies":{"main":{"section_segments":12,"offset":{"x":0,"y":-45,"z":10},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-65,-60,-50,-20,20,30,55,75,60],"z":[-10,-10,-10,-5,0,0,0,0,0]},"width":[0,8,13,20,25,25,30,30,0],"height":[0,6,10,17,21,22,22,22,0],"texture":[4,63,10,1,10,1,9,17]},"main1":{"section_segments":12,"offset":{"x":0,"y":80,"z":10},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-65,-60,-50,-25,-15,-5,0,15,5],"z":[0,0,0,0,0,0,0,0,0]},"width":[0,45,45,45,25,25,30,27,0],"height":[0,22,22,20,17,17,20,17,0],"propeller":true,"texture":[4,63,10,1,10,1,12,17]},"cockpit":{"section_segments":12,"offset":{"x":0,"y":-60,"z":20},"position":{"x":[0,0,0,0,0,0,0],"y":[-15,0,20,30,60],"z":[-5,-3,0,0,0]},"width":[0,10,13,13,5],"height":[0,10,13,13,5],"propeller":false,"texture":[7,9,9,4,4]},"cannon":{"section_segments":6,"offset":{"x":20,"y":-30,"z":10},"position":{"x":[-1,-1,0,0,0,0],"y":[-30,-40,-20,-5,5,15],"z":[-5,-5,-3,0,0,0]},"width":[0,5,8,11,9,0],"height":[0,5,8,11,10,0],"angle":0,"texture":[4,8,10,63,4]},"cannon1":{"section_segments":8,"offset":{"x":10,"y":30,"z":11},"position":{"x":[0,0,0,0,0,0],"y":[10,-20,-10,-5,5,15],"z":[0,0,0,0,0,0]},"width":[0,28,30,30,30,30],"height":[0,15,16,16,16,16],"angle":0,"texture":[6,8,63,63,4]},"cannon2":{"section_segments":8,"offset":{"x":37,"y":45,"z":20},"position":{"x":[0,0,0,4,4,4],"y":[-10,-20,-10,-5,15,10],"z":[0,0,0,0,0,0]},"width":[0,7,10,10,10,0],"height":[0,8,10,10,10,0],"propeller":true,"angle":0,"texture":[4,8,63,11,17]},"cannon3":{"section_segments":8,"offset":{"x":43,"y":45,"z":4},"position":{"x":[0,0,0,4,4,4],"y":[-10,-20,-10,-5,15,10],"z":[0,0,0,0,0,0]},"width":[0,7,10,10,10,0],"height":[0,8,10,10,10,0],"propeller":true,"angle":0,"texture":[4,8,63,11,17]},"cannon4":{"section_segments":6,"offset":{"x":15,"y":40,"z":29},"position":{"x":[0,0,0,0,0,0],"y":[-10,-20,-10,-5,5,20],"z":[2,2,2,0,0,-5]},"width":[0,5,5,5,5,0],"height":[0,4,4,5,5,0],"angle":180,"texture":[4,8,63,11,4],"propeller":false}},"wings":{"main":{"length":[10,20],"width":[30,20,10],"angle":[0,-50],"position":[0,0,10],"doubleside":true,"offset":{"x":20,"y":-40,"z":10},"bump":{"position":30,"size":20},"texture":[11,63]}},'+
  165. '"typespec":{"name":"Zerd Booster","level":1,"model":4,"code":104,"specs":{"shield":{"capacity":[150,150],"reload":[7,7]},"generator":{"capacity":[200,200],"reload":[13,13]},"ship":{"mass":140,"speed":[160,160],"rotation":[50,50],"acceleration":[160,160],"dash":{"rate":2,"burst_speed":[200,200],"speed":[160,160],"acceleration":[160,160],"initial_energy":[50,50],"energy":[0,0]}}},"shape":[3.08,2.968,2.358,2.066,1.708,1.619,1.572,1.55,1.483,0.805,0.781,0.771,0.783,0.81,0.852,1.176,1.625,1.973,2.187,2.317,2.18,1.989,2.577,2.765,2.708,2.665,2.708,2.765,2.577,1.989,2.18,2.317,2.187,1.973,1.625,1.176,0.852,0.81,0.784,0.771,0.781,0.805,1.483,1.55,1.572,1.619,1.708,2.066,2.358,2.968],"lasers":[],"radius":3.08}}';
  166. var LGViper = '{"name":"LG Viper","level":1,"model":5,"size":0.7,"specs":{"shield":{"capacity":[140,140],"reload":[5,5]},"generator":{"capacity":[150,150],"reload":[17,17]},"ship":{"mass":100,"speed":[150,150],"rotation":[60,60],"acceleration":[120,120],"dash":{"rate":2,"burst_speed":[205,205],"speed":[170,170],"acceleration":[150,150],"initial_energy":[40,40],"energy":[25,25]}}},"bodies":{"main":{"section_segments":8,"offset":{"x":0,"y":0,"z":10},"position":{"x":[0,0,0,0,0,0,0,0],"y":[-110,-60,-99,-90,-70,0,50,70],"z":[0,0,0,0,0,0,0,5,1]},"width":[2,4,15,16,25,35,20,0],"height":[0,4,2,4,8,13,10,3],"texture":[5,17,5,1,1,1,1]},"cockpit":{"section_segments":8,"offset":{"x":0,"y":-15,"z":15},"position":{"x":[0,0,0,0,0,0],"y":[-55,-40,-25,0,5],"z":[0,0,0,0,9,9]},"width":[0,10,15,20,10],"height":[0,10,10,10,0],"texture":[9]},"cockpitDeco":{"section_segments":12,"offset":{"x":20,"y":8,"z":18},"position":{"x":[-4,0,0,-10],"y":[-75,-70,-20,0],"z":[0,0,0,-10]},"width":[1,2,4,2],"height":[1,1,2,2],"texture":[5],"angle":10},"cockpitDeco2":{"section_segments":12,"offset":{"x":0,"y":-11,"z":22},"position":{"x":[1.5,-3,-3,1.5],"y":[-16,-1,-1,16],"z":[0,0,0,0]},"width":[2,2,2,2],"height":[1,1,1,1],"texture":[5],"angle":90},"logo4":{"section_segments":4,"offset":{"x":0,"y":40,"z":20},"position":{"x":[0,0,0,0,0,0,0,0],"y":[120,10],"z":[-1.5,6]},"width":[1,1],"height":[1,1],"texture":[5],"angle":180},"engines1":{"section_segments":6,"offset":{"x":48,"y":34,"z":0},"position":{"x":[0,0,0,0,0,0,0,0],"y":[-20,0,2,-10],"z":[0,0,0,0,0,0,0,0]},"width":[7,7,5,0],"height":[0,2,1,0,10,0],"texture":[1,1,17],"angle":0,"propeller":true},"engines2":{"section_segments":6,"offset":{"x":60,"y":30,"z":-1},"position":{"x":[0,0,0,0,0,0,0,0],"y":[-20,0,2,-10],"z":[0,0,0,0,0,0,0,0]},"width":[7,7,5,0],"height":[0,2,1,0,10,0],"texture":[1,1,17],"angle":0,"propeller":true},"engines3":{"section_segments":6,"offset":{"x":72,"y":25,"z":-4},"position":{"x":[0,0,0,0,0,0,0,0],"y":[-20,0,2,-10],"z":[0,0,0,0,0,0,0,0]},"width":[7,7,5,0],"height":[0,2,1,0,10,0],"texture":[1,1,17],"angle":0,"propeller":true},"headlights":{"section_segments":8,"offset":{"x":50,"y":-50,"z":5},"position":{"x":[0,-1,0,1,1,0],"y":[-15,-20,-10,0,10,20,15,0],"z":[0,-3,0,0,0,-2,0,0,0]},"width":[0,9,10,8,7,5,5,0],"height":[0,6,4,2,0,0,0,0],"texture":[17,4,3,10,3],"propeller":false,"angle":-3},"turbine":{"section_segments":12,"offset":{"x":0,"y":30,"z":35},"position":{"x":[0,0,0,0,0,0,0],"y":[-20,-25,-20,0,20,30,40],"z":[0,0,0,0,0,-10,-20]},"width":[0,10,13,13,13,13,8],"height":[0,18,23,23,15,10,5],"angle":0,"texture":[17,5,1,1,1,1,1,1,1]},"turbineDeco":{"section_segments":10,"offset":{"x":13,"y":35,"z":43},"position":{"x":[0,0,0,0,0],"y":[0,1,10],"z":[0,0,0,0,0]},"width":[0,3,3],"height":[0,10,10],"texture":[5],"angle":-90},"turbineDeco2":{"section_segments":10,"offset":{"x":13,"y":20,"z":45},"position":{"x":[0,0,0,0,0],"y":[0,1,10],"z":[0,0,0,0,0]},"width":[0,3,3],"height":[0,10,10],"texture":[5],"angle":-90},"BackDeco":{"section_segments":10,"offset":{"x":32,"y":30,"z":10},"position":{"x":[0,0,0,0,0],"y":[-10,10,10],"z":[10,0,0,0,0]},"width":[0,15,15],"height":[0,5,5],"texture":[18],"angle":-90},"fukkenLongLine":{"section_segments":6,"offset":{"x":50,"y":-45,"z":7},"position":{"x":[-13,-5,0,0,0,0,0,-20,-30],"y":[-105,-80,-60,-40,-10,20,40,60,80],"z":[-5,-5,-5,-5,-10,-2.5,0,0,0,0]},"width":[1,1,1,1,1,1,1,4],"height":[1,1,1,1,1,1,1,1],"texture":[5],"angle":0}},"wings":{"outer":{"offset":{"x":35,"y":-115,"z":0},"length":[1,30,20],"width":[0,190,150,50],"angle":[0,-8,-8,-8],"position":[100,57,70,100],"texture":[1,1,10,10],"doubleside":true,"bump":{"position":30,"size":5}},"inner":{"offset":{"x":-36,"y":-90,"z":0},"length":[25],"width":[165,10],"angle":[8],"position":[20,100],"texture":[1,1],"doubleside":true,"bump":{"position":0,"size":5}}},'+
  167. '"typespec":{"name":"GLS Viper","level":1,"model":1,"code":101,"specs":{"shield":{"capacity":[140,140],"reload":[5,5]},"generator":{"capacity":[150,150],"reload":[17,17]},"ship":{"mass":90,"speed":[150,150],"rotation":[60,60],"acceleration":[120,120],"dash":{"rate":2,"burst_speed":[205,205],"speed":[170,170],"acceleration":[150,150],"initial_energy":[40,40],"energy":[25,25]}}},"shape":[1.54,1.402,2.2,2.087,1.96,1.792,1.606,1.482,1.398,1.34,1.286,1.234,1.206,1.205,1.196,1.148,1.032,0.93,0.857,0.743,0.685,0.698,0.777,0.887,0.986,0.982,0.986,0.887,0.777,0.698,0.685,0.743,0.857,0.93,1.032,1.148,1.196,1.205,1.206,1.234,1.286,1.34,1.398,1.482,1.606,1.792,1.96,2.087,2.2,1.402],"lasers":[],"radius":2.2}}';
  168. var VoidA = '{"name":"V1","level":1,"model":6,"size":1,"specs":{"shield":{"capacity":[130,130],"reload":[7,7]},"generator":{"capacity":[200,200],"reload":[20,20]},"ship":{"mass":100,"speed":[155,155],"rotation":[50,50],"acceleration":[160,160],"dash":{"rate":2,"burst_speed":[230,230],"speed":[160,160],"acceleration":[180,180],"initial_energy":[45,45],"energy":[35,35]}}},"bodies":{"main":{"section_segments":12,"offset":{"x":0,"y":-10,"z":10},"position":{"x":[0,0,0,0,0,0,0,0],"y":[-90,-75,-20,0,50,105,90],"z":[0,0,0,0,0,0,0]},"width":[0,15,25,25,25,25,0],"height":[0,10,20,20,20,20,0],"propeller":true,"texture":[63,2,2,10,4,17]},"cockpit":{"section_segments":12,"offset":{"x":0,"y":-30,"z":12},"position":{"x":[0,0,0,0,0,0,0],"y":[-50,-30,10,30,40],"z":[0,0,0,0,0]},"width":[0,10,15,15,5],"height":[0,18,25,25,5],"propeller":false,"texture":9},"deco":{"section_segments":8,"offset":{"x":23,"y":20,"z":10},"position":{"x":[5,5,10,10,10,10,10],"y":[-52,-50,-20,0,20,70,65],"z":[0,0,0,0,0,0,0]},"width":[0,10,15,15,15,15,0],"height":[0,10,10,10,10,10,0],"angle":0,"propeller":true,"texture":[4,3,4,10,4,17]},"cannons":{"section_segments":12,"offset":{"x":33,"y":40,"z":20},"position":{"x":[0,0,0,0,0,0,0],"y":[-30,-40,-20,0,20,40,42],"z":[0,-5,-1,0,0,0,0]},"width":[0,5,6,10,10,7.5,0],"height":[0,5,5,5,5,5,0],"angle":0,"propeller":false,"texture":[4,4,10,4,63,4]}},"wings":{"main":{"length":[80,40],"width":[80,50,30],"angle":[0,90],"position":[30,50,80],"doubleside":true,"bump":{"position":30,"size":10},"texture":[11,63],"offset":{"x":-10,"y":0,"z":0}}},'+
  169. '"typespec":{"name":"Void","level":1,"model":1,"code":101,"specs":{"shield":{"capacity":[130,130],"reload":[7,7]},"generator":{"capacity":[200,200],"reload":[20,20]},"ship":{"mass":100,"speed":[155,155],"rotation":[50,50],"acceleration":[160,160],"dash":{"rate":2,"burst_speed":[230,230],"speed":[160,160],"acceleration":[180,180],"initial_energy":[45,45],"energy":[35,35]}}},"shape":[2,1.884,1.664,1.257,1.029,0.881,0.906,0.968,0.954,0.925,0.913,0.928,0.958,0.967,0.991,1.513,1.638,1.818,2.034,2.241,2.36,2.04,1.989,1.965,1.934,1.904,1.934,1.965,1.989,2.04,2.36,2.241,2.034,1.818,1.638,1.513,0.991,0.967,0.96,0.928,0.913,0.925,0.954,0.968,0.906,0.881,1.029,1.257,1.664,1.884],"lasers":[],"radius":2.36}}';
  170. var Starsurfer = '{"name":"Starsurfer","level":1,"model":7,"size":1.3,"specs":{"shield":{"capacity":[230,230],"reload":[7,7]},"generator":{"capacity":[150,150],"reload":[20,20]},"ship":{"mass":130,"speed":[140,140],"rotation":[40,40],"acceleration":[210,210],"dash":{"rate":2,"burst_speed":[200,20],"speed":[165,165],"acceleration":[230,230],"initial_energy":[45,45],"energy":[27,27]}}},"bodies":{"mainBody":{"section_segments":6,"offset":{"x":20,"y":20,"z":5},"position":{"x":[-20,-20,-5,0,0,0,0,0,-10,-10],"y":[-145,-140,-120,-90,-30,-20,-15,15,40,40],"z":[-5,-5,-5,-5,-5,0,0,0,0,0,0]},"width":[0,20,20,20,20,15,15,15,15,0],"height":[0,10,10,10,10,10,10,10,15,0],"texture":[4]},"engineBottom":{"section_segments":6,"offset":{"x":0,"y":50,"z":-3},"position":{"x":[0,0,0,0,0,0],"y":[-20,-15,15,20,15],"z":[0,0,0,0,0,0]},"width":[0,28,28,26,0],"height":[0,9,9,6,0],"texture":[3,3,2,17],"propeller":true},"engineTop":{"section_segments":6,"offset":{"x":0,"y":50,"z":13},"position":{"x":[0,0,0,0,0,0],"y":[-20,-15,15,20,15],"z":[0,0,0,0,0,0]},"width":[0,24,24,22,0],"height":[0,9,9,6,0],"texture":[3,3,2,17],"propeller":true},"reactor":{"section_segments":8,"offset":{"x":0,"y":8,"z":12},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-25,-20,-10,0,10,20,25,35],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,15,15,15,15,15,15,5,0],"height":[0,15,15,15,15,15,15,5,0],"texture":[1,1,17,1,17,1,1]},"bottom":{"section_segments":6,"offset":{"x":0,"y":20,"z":-3},"position":{"x":[0,0,0,0,0,0],"y":[-141,-125,15,20],"z":[-5,0,0,0,0,0]},"width":[0,15,15,0],"height":[0,10,10,0],"texture":[2]},"cockpit":{"section_segments":8,"offset":{"x":0,"y":-5,"z":12},"position":{"x":[0,0,0,0,0,0],"y":[-95,-62,-25,0,5],"z":[0,0,0,0,0,0]},"width":[0,10,15,15,0],"height":[0,8,15,13,0],"texture":[9]},"cockpit2":{"section_segments":8,"offset":{"x":0,"y":-5,"z":10},"position":{"x":[0,0,0,0,0,0],"y":[-115,-100,-55,-25,20],"z":[0,0,0,0,0,0]},"width":[0,12,15,20,16],"height":[0,4,12,4,0],"texture":[13,18,8,1]},"backStructural":{"section_segments":6,"offset":{"x":32,"y":15,"z":0},"position":{"x":[0,5,5,0,0,0],"y":[-20,-15,40,50],"z":[0,0,0,0,0,0]},"width":[3,3,3,3],"height":[3,3,3,3],"texture":[1]},"backStructura2":{"section_segments":6,"offset":{"x":32,"y":65,"z":0},"position":{"x":[0,0,0,0,0],"y":[-20,0,3],"z":[-3,0,0,0,0,0]},"width":[3,3,0],"height":[3,3,0],"angle":90,"texture":[1]}},"wings":{"defense1":{"doubleside":true,"offset":{"x":37,"y":35,"z":0},"length":[-9,-4,-20],"width":[5,5,20,20],"angle":[280,315,330],"position":[0,0,0,0],"texture":[3,18],"bump":{"position":0,"size":-10}},"defense2":{"doubleside":true,"offset":{"x":37,"y":10,"z":0},"length":[-9,-4,-20],"width":[5,5,20,20],"angle":[280,315,330],"position":[0,0,0,0],"texture":[3,18],"bump":{"position":0,"size":-10}}},'+
  171. '"typespec":{"name":"Starsurfer","level":1,"model":8,"code":108,"specs":{"shield":{"capacity":[230,230],"reload":[7,7]},"generator":{"capacity":[150,150],"reload":[20,20]},"ship":{"mass":130,"speed":[140,140],"rotation":[40,40],"acceleration":[210,210],"dash":{"rate":2,"burst_speed":[200,20],"speed":[165,165],"acceleration":[230,230],"initial_energy":[45,45],"energy":[27,27]}}},"shape":[4,3.936,3.714,3.346,2.711,2.223,1.866,1.629,1.47,1.358,1.278,1.226,1.266,1.277,1.306,1.36,1.441,1.563,1.731,1.988,2.241,2.393,2.391,2.353,2.28,2.244,2.28,2.353,2.391,2.393,2.241,1.988,1.731,1.563,1.441,1.36,1.306,1.277,1.267,1.226,1.278,1.358,1.47,1.629,1.866,2.223,2.711,3.346,3.714,3.936],"lasers":[],"radius":4}}';
  172. var ZerdTurbine = '{"name":"Z Tri-turbine","level":1,"model":8,"size":1.3,"specs":{"shield":{"capacity":[200,200],"reload":[3,3]},"generator":{"capacity":[60,60],"reload":[15,15]},"ship":{"mass":140,"speed":[135,135],"rotation":[80,80],"acceleration":[200,200],"dash":{"rate":1,"burst_speed":[205,205],"speed":[170,170],"acceleration":[250,250],"initial_energy":[30,30],"energy":[25,25]}}},"bodies":{"main1":{"section_segments":12,"offset":{"x":57,"y":-55,"z":-11},"position":{"x":[0,0,0,0,0,0,0,0,0,0,0,0],"y":[-55,-33,-40,0,10,40,48,66,77,67],"z":[0,0,0,0,0,0,0,0,0,0,0]},"width":[0,6,15,20,14,14,20,20,15,0],"height":[0,6,15,20,14,14,20,20,15,0],"propeller":true,"texture":[4,18,10,63,8,63,11,12,17]},"main2":{"section_segments":12,"offset":{"x":0,"y":0,"z":10},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-55,-60,-50,-20,10,15,45,75,60],"z":[-7,-7,-5,0,0,0,0,0,0]},"width":[0,8,15,25,25,20,20,14,0],"height":[0,6,10,15,18,18,18,14,0],"propeller":true,"texture":[12,63,10,1,5,8,12,17]},"cockpit":{"section_segments":8,"offset":{"x":0,"y":-48,"z":22},"position":{"x":[0,0,0,0,0,0],"y":[-5,10,30,60],"z":[-20,-8,0,0]},"width":[5,8,12,5],"height":[4,10,10,5],"propeller":false,"texture":[7,9,4,4]},"cannons":{"section_segments":6,"offset":{"x":20,"y":30,"z":15},"position":{"x":[0,0,0,0,0,0],"y":[-60,-70,-30,0,25,30],"z":[0,0,0,0,0,0]},"width":[0,5,6,11,7,0],"height":[0,5,6,11,7,0],"angle":180,"texture":[3,8,10,63]},"cannons2":{"section_segments":6,"offset":{"x":27,"y":0,"z":-5},"position":{"x":[0,0,0,0,0,0],"y":[-70,-80,-35,0,25,30],"z":[0,0,0,0,0,0]},"width":[0,5,6,11,7,0],"height":[0,5,6,11,7,0],"angle":180,"texture":[3,8,10,63]}},"wings":{"main1":{"length":[20,20],"width":[50,30,15],"angle":[-10,-15],"position":[0,-20,-11],"doubleside":true,"offset":{"x":20,"y":-12,"z":5},"bump":{"position":35,"size":15},"texture":[11,63]},"main2":{"length":[30],"width":[33,15],"angle":[-20],"position":[0,20],"doubleside":true,"offset":{"x":65,"y":-33,"z":-9},"bump":{"position":30,"size":15},"texture":[8]}},'+
  173. '"typespec":{"name":"Fly","level":1,"model":1,"code":101,"specs":{"shield":{"capacity":[200,200],"reload":[3,3]},"generator":{"capacity":[60,60],"reload":[15,15]},"ship":{"mass":160,"speed":[135,135],"rotation":[80,80],"acceleration":[200,200],"dash":{"rate":1,"burst_speed":[205,205],"speed":[170,170],"acceleration":[250,250],"initial_energy":[30,30],"energy":[25,25]}}},"shape":[1.262,1.271,1.199,2.205,2.602,2.503,2.397,2.159,1.995,1.844,1.96,2.004,1.972,1.629,1.633,1.592,1.254,0.868,0.939,1.055,1.243,1.555,1.804,2.161,2.138,1.578,2.138,2.161,1.804,1.555,1.243,1.055,0.939,0.868,1.254,1.592,1.633,1.629,1.972,2.004,1.96,1.844,1.995,2.159,2.397,2.503,2.602,2.205,1.199,1.271],"lasers":[],"radius":2.602}}';
  174. var Arrowhead = '{"name":"Arrowhead","level":1,"model":9,"size":1,"scale":0.65,"specs":{"shield":{"capacity":[120,120],"reload":[7,7]},"generator":{"capacity":[140,140],"reload":[25,25]},"ship":{"mass":70,"speed":[165,165],"rotation":[30,30],"acceleration":[250,250]}},"bodies":{"main":{"section_segments":11,"offset":{"x":0,"y":-50,"z":0},"position":{"x":[0,0,0,0,0,0,0,0],"y":[0,6,12,48,77,110,137,141],"z":[0,0,0,0,0,0,0,0]},"width":[0,15,15,15,15,15,23,0],"height":[0,1,1,15,15,14,23,0],"texture":[9,3,2,8,3,2,3]},"engines":{"section_segments":12,"offset":{"x":0,"y":-15,"z":0},"position":{"x":[0,0,0,0,0,0],"y":[40,74,98,113,100,150],"z":[10,0,0,0,0,0,0]},"width":[0,10,14,20,0],"height":[0,11,14,20,0],"texture":[3,3,3,17],"propeller":true},"engineSpike":{"section_segments":12,"offset":{"x":0,"y":105,"z":0},"position":{"x":[0,0,0,0,0,0],"y":[-20,40,0],"z":[0,0,0]},"width":[15,8,0],"height":[15,8,0],"texture":[17],"propeller":true},"cockpit":{"section_segments":12,"offset":{"x":0,"y":-75,"z":5},"position":{"x":[0,0,0,0,0],"y":[0,40,66,84,89],"z":[-8,-2,-1,1,20]},"width":[0,15,15,10,10],"height":[0,15,15,10],"texture":[9],"propeller":false}},"wings":{"bottom":{"offset":{"x":3,"y":-115,"z":0},"length":[0,2,12,2,4,38],"width":[165,235,390,232,167,122,35],"angle":[25,0,0,0,0,0],"position":[20,54,54,47,79,100,101],"texture":[8,1,4,2,2,4],"doubleside":true,"bump":{"position":30,"size":4}},"top":{"offset":{"x":0,"y":-125,"z":0},"length":[60],"width":[250,0],"angle":[10],"position":[0,60],"texture":[63,63],"doubleside":true,"bump":{"position":100,"size":4}},"deco1":{"offset":{"x":7,"y":10,"z":8},"length":[40,5],"width":[50,0,0],"angle":[6,7],"position":[40,-30],"texture":[19],"doubleside":false,"bump":{"position":100,"size":4}},"cockpitFront":{"offset":{"x":0,"y":-57,"z":-2},"length":[10,20],"width":[30,30,30],"angle":[-10,-10,0,0,0,0],"position":[-2,10,30],"texture":[4],"doubleside":true,"bump":{"position":30,"size":50}}},'+
  175. '"typespec":{"name":"Arrow Head","level":1,"model":1,"code":101,"specs":{"shield":{"capacity":[120,120],"reload":[7,7]},"generator":{"capacity":[140,140],"reload":[25,25]},"ship":{"mass":75,"speed":[160,160],"rotation":[30,30],"acceleration":[250,250]}},"shape":[5.992,4.865,3.71,3.018,2.597,2.317,2.102,1.725,1.595,1.606,1.535,1.472,1.439,1.43,1.358,1.256,1.191,1.146,1.123,1.131,1.161,1.286,1.49,2.34,3.245,3.398,3.245,2.34,1.49,1.286,1.161,1.131,1.123,1.146,1.191,1.256,1.358,1.43,1.439,1.472,1.535,1.606,1.595,1.725,2.102,2.317,2.597,3.018,3.71,4.865],"lasers":[],"radius":5.992}}';
  176. var SweptWingedRacecraft = '{"name":"Swept-Winged Racecraft","level":1,"model":10,"size":1,"specs":{"shield":{"capacity":[150,150],"reload":[6,6]},"generator":{"capacity":[120,120],"reload":[20,20]},"ship":{"mass":140,"speed":[140,140],"rotation":[45,45],"acceleration":[160,160],"dash":{"rate":2,"burst_speed":[255,255],"speed":[185,185],"acceleration":[180,180],"initial_energy":[55,55],"energy":[37,37]}}},"bodies":{"main":{"section_segments":12,"offset":{"x":0,"y":0,"z":10},"position":{"x":[0,0,0,0,0,0,0,0],"y":[-130,-115,-90,0,50,105,90],"z":[0,0,0,0,0,0,0]},"width":[0,15,25,30,35,20,0],"height":[0,10,15,25,25,20,0],"propeller":true,"texture":[63,3,2,1,4,12]},"cockpit":{"section_segments":12,"offset":{"x":0,"y":-20,"z":20},"position":{"x":[0,0,0,0,0,0,0],"y":[-90,-10,40,70,80],"z":[0,0,0,0,0]},"width":[0,10,15,10,5],"height":[0,18,25,18,5],"propeller":false,"texture":[4,9,4,4]},"cannon":{"section_segments":6,"offset":{"x":0,"y":-100,"z":10},"position":{"x":[0,0,0,0,0,0],"y":[-70,-50,-20,0,20,50],"z":[0,0,0,0,0,0]},"width":[0,5,10,10,15,0],"height":[0,5,10,10,15,0],"angle":0,"texture":[63]},"deco":{"section_segments":8,"offset":{"x":30,"y":50,"z":-5},"position":{"x":[0,0,5,5,0,0,0],"y":[-52,-50,-20,0,20,40,30],"z":[10,10,10,0,0,0,0]},"width":[0,5,10,10,15,15,0],"height":[0,5,10,15,10,15,0],"angle":0,"texture":[4],"propeller":true},"deco2":{"section_segments":8,"offset":{"x":30,"y":50,"z":20},"position":{"x":[0,0,5,5,0,0,0],"y":[-52,-50,-20,0,20,40,30],"z":[-10,-10,-10,0,0,0,0]},"width":[0,5,10,10,15,15,0],"height":[0,5,10,15,10,15,0],"angle":0,"texture":[4],"propeller":true}},"wings":{"main":{"length":[30,20],"width":[120,50,40],"angle":[-10,20],"position":[100,-50,30],"doubleside":true,"bump":{"position":30,"size":10},"texture":[11,63],"offset":{"x":0,"y":-60,"z":0}},"main2":{"length":[30,20],"width":[120,50,40],"angle":[10,-20],"position":[100,-50,30],"doubleside":true,"bump":{"position":30,"size":10},"texture":[11,63],"offset":{"x":0,"y":-60,"z":0}},"winglets":{"length":[40],"width":[40,20,30],"angle":[10,-10],"position":[-40,-60,-55],"bump":{"position":0,"size":30},"texture":63,"offset":{"x":0,"y":0,"z":-5}},"stab":{"length":[80,10],"width":[60,40,50],"angle":[0,30],"position":[50,75,90],"doubleside":true,"texture":[63,4],"bump":{"position":0,"size":20},"offset":{"x":0,"y":-20,"z":10}}},'+
  177. '"typespec":{"name":"Swept-Winged Racecraft","level":3,"model":1,"code":301,"specs":{"shield":{"capacity":[150,150],"reload":[6,6]},"generator":{"capacity":[120,120],"reload":[20,20]},"ship":{"mass":120,"speed":[140,140],"rotation":[45,45],"acceleration":[160,160],"dash":{"rate":2,"burst_speed":[255,255],"speed":[185,185],"acceleration":[180,180],"initial_energy":[55,55],"energy":[37,37]}}},"shape":[3.4,2.507,2.764,2.285,1.895,1.634,1.462,1.324,1.191,1.102,1.037,0.998,0.699,0.736,0.788,0.866,2.021,2.187,2.429,2.599,1.838,2.012,1.989,2.128,2.138,2.104,2.138,2.128,1.989,2.012,1.838,2.599,2.429,2.187,2.021,0.866,0.788,0.736,0.7,0.998,1.037,1.102,1.191,1.324,1.462,1.634,1.895,2.285,2.764,2.507],"lasers":[],"radius":3.4}}';
  178.  
  179. ships = [];
  180. shipInfos = [];
  181.  
  182. ships.push(Astral);
  183. shipInfos.push({company:"FinaDrive", creator:"Finalizer",
  184. desc:"Powerful boost, high cruising speed,\n amazing hot look. What else do you need?"});
  185.  
  186. ships.push(ShadowX1);
  187. shipInfos.push({company:"Starblast", creator:"pmgl",
  188. desc:"Deadly little beast. People always wondered if\n it would be good for racing, so we bought several of these\n and removed the weapons. \nBoy oh boy you won't be disappointed."});
  189.  
  190. ships.push(RADDiamondLancer);
  191. shipInfos.push({company:"RAD Diamond", creator:"UranusOrbiter",
  192. desc:"It might look a bit weird and feel sluggish, \nbut it's strength is it's boost tank. \nHold that dash button."});
  193.  
  194. ships.push(ZerdBooster);
  195. shipInfos.push({company:"ZerdTech", creator:"Revenge Zerd",
  196. desc:"Beautiful and powerful, this lovely rocket \ncan change. It's. Movement. Direction. Instantly."});
  197.  
  198. ships.push(LGViper);
  199. shipInfos.push({company:"Halo L.Starships", creator:"L.Gaming",
  200. desc:"A sleek, compact, fast ship capable of\n powerful overdrive allowing you to surpass your competition.\n Great handling although low thrust."});
  201.  
  202. ships.push(VoidA);
  203. shipInfos.push({company:"Abyss Racecraft ltd.", creator:"Void",
  204. desc:"Simple, nice-looking racing vehicle. \nNothing too fancy. \nDoes it's job well."});
  205.  
  206. ships.push(Starsurfer);
  207. shipInfos.push({company:"SpaceGGFlight", creator:"UranusOrbiter",
  208. desc:"SpaceGG develops spaceships. People say\n those ships are good. People say this \nship is good. A sleek, fast space surfboard \ncapable of pretty much everything. \nIncluding racing."});
  209.  
  210. ships.push(ZerdTurbine);
  211. shipInfos.push({company:"ZerdTech", creator:"Revenge Zerd",
  212. desc:"When one engine isn't enough - attach more.\n Attaching one isn't trivial, but two,\n sure - and you get this thing. Incredibly good\n handling, great acceleration and overdrive."});
  213.  
  214. ships.push(Arrowhead);
  215. shipInfos.push({company:"T. T. Tun design bureau", creator:"Cmdre. T. T. Tun",
  216. desc:"'What an original name', said our investors.\n 'What else are you gonna call it?', said we.\n Behold - a cockpit, a reactor, an engine and some wings.\n Really that's all you need for a spaceship."});
  217.  
  218. ships.push(SweptWingedRacecraft);
  219. shipInfos.push({company:"Chickenman's Coop", creator:"SChickenMan",
  220. desc:"Wings are unnecessary for spaceships.\n Unless you want your spaceship to look cool.\n And yes, we want our racing ships to look cool.\n These wings are lightweight and hollow, \nso they barely impact the performance"});
  221.  
  222. for(i =0;i<ships.length;i++){
  223. ships[i] = JSON.parse(ships[i]);
  224. ships[i].typespec.specs.shield.capacity = [1000,1000];
  225. ships[i] = JSON.stringify(ships[i]);
  226. }
  227.  
  228. //mod code - edit at your own risk
  229.  
  230. this.options = {
  231. // see documentation for options reference
  232. //root_mode: "survival",
  233. weapons_store: false,
  234. ships: ships,
  235. map_size: mapSize,
  236. map_id: mapSeed,
  237. asteroids_strength: 10,
  238. crystal_value: 0,
  239. radar_zoom: 1.5
  240. };
  241.  
  242. if(customMap)
  243. this.options.custom_map = map;
  244.  
  245. const map_size = mapSize*5; //the size of the map
  246.  
  247. const checkpointrange = 40; //size of checkpoints
  248. const quickRaceStartTime = 20; //time it takes to start a race if all players are ready
  249. const longRaceStartTime = 60; //time it takes to start a race if some players are ready
  250. const DNFTime = 60; //did not finish time
  251. const finalCountdownTime = 10; //the final countdown before the race
  252. const sandboxAreaSize = 65;
  253. const shipsInLine = 2;
  254. const startingLinesWidth = 10;
  255. const startingLinesDist = 7;
  256. const noActivityTime = 30;
  257.  
  258. laps = 3;
  259.  
  260. raceinprogress = false; //whether there's a race going on
  261. racetime = 0; //race timer
  262. lastfinished = 0; //how many players finished
  263. countdown = quickRaceStartTime; //lobby countdown timer(all players ready)
  264. countdownLong = longRaceStartTime; //lobby countdown timer(some players ready)
  265. DNFCountdown = 0; //DNF timer
  266. noActivityCountdown = 0;//no activity timer
  267. finalCountdown = 0; //final countdown
  268. raceStarted = false; //whether the final countdown is finished
  269. everySecond = 0;
  270. dislikedBy = 0;
  271. readyAmount = 0;
  272.  
  273. requestTrack = -1;
  274. requestLaps = -1;
  275.  
  276. nextTrack = 0;
  277.  
  278. top1time = {name:"", time:-1};
  279. top2time = {name:"", time:-1};
  280. top3time = {name:"", time:-1};
  281.  
  282. ads = [];
  283. adTimer = 0;
  284. adRefreshTime = 5;
  285.  
  286. ads.push("Uranus Racing League by /u/UranusOrbiter aka Uranus_is_big#7833");
  287. ads.push("Uranus Racing League version 0.0003");
  288. ads.push("Have a nice day");
  289.  
  290. ads.push("Huge thanks to pmgl for making all of this possible");
  291. ads.push("Huge thanks to Starblast dev team for making all of this possible");
  292.  
  293. ads.push("Thanks to everybody who helped test this mod");
  294.  
  295. ads.push("Map created by rm -rf / and improved by Uranus");
  296. ads.push("Huge thanks to rm -rf / for creating this beautiful map");
  297.  
  298. ads.push("Huge thanks to SChickenMan for helping with ship balance");
  299.  
  300. banners = [];
  301.  
  302. RADDiamondLogo = {
  303. id: "RAD",
  304. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  305. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/RadDiamond.png"
  306. };
  307. banners.push(RADDiamondLogo);
  308.  
  309. RADDiamondLancer1 = {
  310. id: "RADL1",
  311. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  312. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/RAD%20DIAMOND%20LANCER%20ad1.png"
  313. };
  314. banners.push(RADDiamondLancer1);
  315.  
  316. RADDiamondLancer2 = {
  317. id: "RADL2",
  318. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  319. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/RAD%20DIAMOND%20LANCER%20ad2.png"
  320. };
  321. banners.push(RADDiamondLancer2);
  322.  
  323. SpaceGG = {
  324. id: "SPACEGG",
  325. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  326. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/SpaceGGFlight.png"
  327. };
  328. banners.push(SpaceGG);
  329.  
  330. ZerdTech = {
  331. id: "ZerdTech",
  332. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  333. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/ZerdTech.png"
  334. };
  335. banners.push(ZerdTech);
  336.  
  337. ECP1 = {
  338. id: "ECP1",
  339. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  340. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/lovethegameECP.png"
  341. };
  342. ECP2 = {
  343. id: "ECP2",
  344. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  345. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/starblastisfreeECP.png"
  346. };
  347. ECP3 = {
  348. id: "ECP3",
  349. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  350. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/havingFunECP.png"
  351. };
  352. ECP4 = {
  353. id: "ECP4",
  354. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  355. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/unclesamECP.png"
  356. };
  357. banners.push(ECP1, ECP2, ECP3, ECP4);
  358.  
  359. USeries1 = {
  360. id: "US1",
  361. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  362. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/useries1.png"
  363. };
  364. USeries2 = {
  365. id: "US2",
  366. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  367. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/useries2.png"
  368. };
  369. USeries3 = {
  370. id: "US3",
  371. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  372. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/useries3.png"
  373. };
  374. banners.push(USeries1,USeries2,USeries3);
  375.  
  376.  
  377. noPassage = {
  378. id: "noPassage",
  379. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  380. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/noPassage.png"
  381. };
  382.  
  383. checkpoint = {
  384. id: "checkpoint",
  385. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  386. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/checkpoint.png"
  387. };
  388.  
  389. startline = {
  390. id: "startline",
  391. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  392. emissive: "https://starblast.data.neuronality.com/mods/objects/startline.png"
  393. };
  394.  
  395. distance = function(x, y){
  396. return Math.sqrt(x*x+y*y);
  397. };
  398.  
  399. shortestPath = function(x1, y1, x2, y2){
  400.  
  401. shortestDist = 10000;
  402.  
  403.  
  404. coords = [];
  405.  
  406. xx = x2-x1;
  407. yy = y2-y1;
  408. coords.push(xx, yy);
  409. shortest = [xx, yy];
  410.  
  411. xx = x2+map_size*2-x1;
  412. yy = y2-y1;
  413. coords.push(xx, yy);
  414.  
  415. xx = x2-map_size*2-x1;
  416. yy = y2-y1;
  417. coords.push(xx, yy);
  418.  
  419. xx = x2-x1;
  420. yy = y2+map_size*2-y1;
  421. coords.push(xx, yy);
  422.  
  423. xx = x2-x1;
  424. yy = y2-map_size*2-y1;
  425. coords.push(xx, yy);
  426.  
  427.  
  428. xx = x2+map_size*2-x1;
  429. yy = y2+map_size*2-y1;
  430. coords.push(xx, yy);
  431.  
  432. xx = x2+map_size*2-x1;
  433. yy = y2-map_size*2-y1;
  434. coords.push(xx, yy);
  435.  
  436. xx = x2-map_size*2-x1;
  437. yy = y2+map_size*2-y1;
  438. coords.push(xx, yy);
  439.  
  440. xx = x2-map_size*2-x1;
  441. yy = y2-map_size*2-y1;
  442. coords.push(xx, yy);
  443.  
  444. for(var i = 0; i<9; i++){
  445. dist = distance(coords[i*2], coords[i*2+1]);
  446. if(dist<shortestDist){
  447. shortestDist = dist;
  448. shortest = [coords[i*2], coords[i*2+1]];
  449. }
  450. }
  451.  
  452. return shortest;
  453.  
  454. };
  455.  
  456. debugDrawAllRoadblocks = function(){
  457. game.removeObject();
  458. for(i=0; i<roadblocks.length; i++){
  459. game.setObject({
  460. id:"np"+i,
  461. type:noPassage,
  462. position:{x:roadblocks[i].x, y:roadblocks[i].y,z:-2},
  463. scale:{x:12,y:12,z:12},
  464. rotation: {x:Math.PI,y:0,z:roadblocks[i].angle}
  465. });
  466. }
  467. }
  468.  
  469. debugFindClosestRoadblockIndex = function(shipindex){
  470. closestDist = map_size*2;
  471. closest = -1;
  472. ship = game.ships[shipindex];
  473. for(i=0; i<roadblocks.length; i++){
  474.  
  475. shortest = shortestPath(ship.x,ship.y,roadblocks[i].x,roadblocks[i].y);
  476. if(distance(shortest[0],shortest[1])<closestDist){
  477. closestDist = distance(shortest[0],shortest[1]);
  478. closest = i;
  479. }
  480. }
  481. return closest;
  482.  
  483.  
  484. }
  485.  
  486. shamePlayer = function(shipindex){
  487. game.ships[shipindex].custom.ignoreMod = true;
  488. log(game.ships[shipindex].name + " is now in the corner of shame.");
  489. }
  490.  
  491. unshamePlayer = function(shipindex){
  492. game.ships[shipindex].custom.ignoreMod = false;
  493. log(game.ships[shipindex].name + " has been unshamed.");
  494. game.ships[shipindex].set({x:sandboxArea.x, y:sandboxArea.y});
  495. }
  496.  
  497. playerList = function(){
  498. log("List of players:");
  499. for(i=0; i<game.ships.length; i++){
  500. log("game.ships["+i + "]: "+game.ships[i].name);
  501. }
  502. }
  503.  
  504. writeTextLarge = function(ship, string){
  505. ship.setUIComponent({
  506. id:"largeText",
  507. position:[25,25,50,25],
  508. clickable: false,
  509. visible: true,
  510. components: [
  511. { type: "text",position: [0,0,100,100],color: "#FFFFFF",value: string}
  512. ]
  513. });
  514.  
  515.  
  516. };
  517.  
  518. writeTextSmol = function(ship, string){
  519. ship.setUIComponent({
  520. id:"smolText",
  521. position:[25,10,50,25],
  522. clickable: false,
  523. visible: true,
  524. components: [
  525. { type: "text",position: [0,0,100,20],color: "#FFFFFF",value: string}
  526. ]
  527. });
  528. };
  529.  
  530. randomAd = function(){
  531. adIndex = Math.floor(Math.random()*ads.length);
  532. ad = ads[adIndex];
  533. if(Math.random()<0.5){
  534. shipIndex = Math.floor(Math.random()*shipInfos.length);
  535. if(shipInfos[shipIndex].creator != "UranusOrbiter"){
  536. name = JSON.parse(ships[shipIndex]).name;
  537. ad = "Huge thanks to "+shipInfos[shipIndex].creator+" for his "+name+" design";
  538. }
  539. }
  540.  
  541. for (i=0;i<game.ships.length;i++)
  542. {
  543. game.ships[i].setUIComponent({
  544. id:"ad",
  545. position:[25,3,50,25],
  546. clickable: false,
  547. visible: true,
  548. components: [
  549. { type: "text",position: [0,0,100,20],color: "#FFFFFF",value: ad}
  550. ]
  551. });
  552. }
  553. };
  554.  
  555. showBanners = function(){
  556. for(i = 0; i<bannerPositions.length; i++){
  557. index = Math.floor(Math.random()*banners.length);
  558. game.setObject({
  559. id:"banner"+i,
  560. type:banners[index],
  561. position:{x:bannerPositions[i].x, y:bannerPositions[i].y,z:-4},
  562. scale:{x:20,y:20,z:20},
  563. rotation: {x:Math.PI,y:0,z:0}
  564. });
  565. }
  566.  
  567. }
  568.  
  569. announce = function(string){
  570. for (i=0;i<game.ships.length;i++)
  571. {
  572. ship = game.ships[i];
  573. ship.setUIComponent({
  574. id:"announceText",
  575. position:[25,45,50,25],
  576. clickable: false,
  577. visible: true,
  578. components: [
  579. { type: "text",position: [0,0,100,20],color: "#FFBBBB",value: string}
  580. ]
  581. });
  582.  
  583. }
  584. };
  585.  
  586. log = function(string){
  587. game.modding.terminal.echo(string);
  588. }
  589.  
  590. drawTopScores = function(ship, b){
  591. sc1 = "#1 - ";
  592. sc2 = "#2 - ";
  593. sc3 = "#3 - "
  594. if(top1time.time>=0)sc1+=top1time.name+" - "+top1time.time.toFixed(2);
  595. if(top2time.time>=0)sc2+=top2time.name+" - "+top2time.time.toFixed(2);
  596. if(top3time.time>=0)sc3+=top3time.name+" - "+top3time.time.toFixed(2);
  597.  
  598. if(ship.custom.lasttime>=0)
  599. yourLastTime = "your time: " + ship.custom.lasttime.toFixed(2);
  600. else
  601. yourLastTime = "your time: N/A";
  602.  
  603. ship.setUIComponent({
  604. id:"topscores",
  605. position:[60,50,40,25],
  606. clickable: false,
  607. visible: b,
  608. components: [
  609. { type: "text",position: [0,0,100,20],color: "#FFFF33",value: sc1},
  610. { type: "text",position: [0,20,100,20],color: "#BBBBBB",value: sc2},
  611. { type: "text",position: [0,40,100,20],color: "#FFAA33",value: sc3},
  612. { type: "text",position: [0,80,100,20],color: "#FFFFFF",value: yourLastTime}
  613. ]
  614. });
  615.  
  616. };
  617.  
  618. drawShipChooseButtons = function(ship, b){
  619. ship.setUIComponent(
  620. {id: "prevship",
  621. position: [2,40,8,14],
  622. clickable: b,
  623. shortcut: "W",
  624. visible: b,
  625. components: [
  626. { type:"round",position:[0,0,100,100],fill:"#456",stroke:"#CDE",width:2},
  627. { type: "text",position:[10,35,80,30],value:"Previous ship",color:"#CDE"},
  628. { type: "text",position:[20,70,60,20],value:"[W]",color:"#CDE"}
  629. ]
  630.  
  631. }
  632. );
  633.  
  634. ship.setUIComponent(
  635. {id: "nextship",
  636. position: [90,40,8,14],
  637. clickable: b,
  638. shortcut: "E",
  639. visible: b,
  640. components: [
  641. { type:"round",position:[0,0,100,100],fill:"#456",stroke:"#CDE",width:2},
  642. { type: "text",position:[10,35,80,30],value:"Next ship",color:"#CDE"},
  643. { type: "text",position:[20,70,60,20],value:"[E]",color:"#CDE"}
  644. ]
  645.  
  646. }
  647. );
  648.  
  649. }
  650.  
  651. drawReadyButton = function(ship, b){
  652. color = "#AA0000";
  653. text = "NOT READY"
  654. if(ship.custom.ready){
  655. color = "#00AA00";
  656. text = "READY";
  657. }
  658.  
  659. ship.setUIComponent(
  660. {id: "readyToggle",
  661. position: [5,20,8,14],
  662. clickable: b,
  663. shortcut: "U",
  664. visible: b,
  665. components: [
  666. { type:"round",position:[0,0,100,100],fill:color,stroke:"#CDE",width:2},
  667. { type: "text",position:[10,35,80,30],value:text,color:"#CDE"},
  668. { type: "text",position:[20,70,60,20],value:"[U]",color:"#CDE"}
  669. ]
  670.  
  671. }
  672. );
  673. }
  674.  
  675. drawIgnoreMeButton = function(ship, b){
  676. color = "#00AA00";
  677. text = "NOT AFK"
  678. if(ship.custom.ignoreSelf){
  679. color = "#888888";
  680. text = "AFK";
  681. }
  682.  
  683. ship.setUIComponent(
  684. {id: "ignoreMeToggle",
  685. position: [15,20,8,14],
  686. clickable: b,
  687. shortcut: "I",
  688. visible: b,
  689. components: [
  690. { type:"round",position:[0,0,100,100],fill:color,stroke:"#CDE",width:2},
  691. { type: "text",position:[10,35,80,30],value:text,color:"#CDE"},
  692. { type: "text",position:[20,70,60,20],value:"[I]",color:"#CDE"}
  693. ]
  694.  
  695. }
  696. );
  697. }
  698.  
  699. writeShipInfo = function(ship, b){
  700.  
  701. index = 0;
  702.  
  703. index = ship.custom.type;
  704. if(index>=shipInfos.length)return;
  705. if(index<0)return;
  706.  
  707. if(b)
  708. desc = shipInfos[index].desc.split("\n");
  709. UIDesc = [];
  710.  
  711. if(b)
  712. UIDesc.push(
  713. { type: "text",position: [0,0,100,10],color: "#3333AA",value: shipInfos[index].company},
  714. { type: "text",position: [0,10,100,20],color: "#FFFFFF",value: JSON.parse(ships[index]).name},
  715. { type: "text",position: [0,30,100,10],color: "#AAAAAA",value: "by "+shipInfos[index].creator},
  716. );
  717.  
  718. if(b)
  719. for(i = 0; i<desc.length; i++){
  720. UIDesc.push(
  721. { type: "text",position: [0,40+i*10,100,7],color: "#FFFFFF",value: desc[i]}
  722. );
  723. }
  724.  
  725. ship.setUIComponent({
  726. id:"shipInfo",
  727. position:[4,50,50,50],
  728. clickable: false,
  729. visible: b,
  730. components: UIDesc
  731. });
  732.  
  733. };
  734.  
  735. writeTrackInfo = function(ship, b){
  736.  
  737. trackName = tracks[nextTrack].name + ", "+tracks[nextTrack].laps+" laps";
  738.  
  739. dislike = "Press [N] to dislike this track";
  740. dislikeCol = "#FFFFFF";
  741. if(ship.custom.dislikeTrack){
  742. if(dislikedBy>1)
  743. dislike = "You and "+(dislikedBy-1)+" people dislike this track [N]"
  744. else "You dislike this track [N]";
  745. dislikeCol = "#FFAAAA";
  746. }
  747. if(!ship.custom.ready){
  748. dislike = "You are not ready and cannot vote."
  749. dislikeCol = "#AAAAAA";
  750. }
  751.  
  752. ship.setUIComponent({
  753. id:"trackInfo",
  754. position:[75,30,25,50],
  755. shortcut:"N",
  756. clickable: true,
  757. visible: b,
  758. components: [
  759. {type: "text",position: [0,0,100,7],color: "#FFFFFF",value: trackName},
  760. {type: "text",position: [0,10,100,7],color: dislikeCol,value: dislike}
  761. ]
  762. });
  763.  
  764. };
  765.  
  766. drawRaceTrack = function(ship, b){
  767.  
  768. positionX = 85;
  769. positionY = 30;
  770.  
  771. size = 10;
  772.  
  773.  
  774.  
  775. ship.setUIComponent({
  776. id:"playerMarker",
  777. position:[positionX, positionY,25,25],
  778. clickable: false,
  779. visible: b,
  780. components: [
  781. { type:"round",position:[0,0,3,4],fill:"#777777",stroke:"#CDE",width:1}
  782. ]
  783. });
  784.  
  785. for(var i = 0; i<checkpoints.length; i++){
  786.  
  787. path = shortestPath(ship.x, ship.y, checkpoints[i].x, checkpoints[i].y);
  788. x = path[0];
  789. y = path[1];
  790.  
  791. chX = x/map_size;
  792. chY = y/map_size;
  793.  
  794. fill = "#00ff00";
  795. if(i<ship.custom.checkpoint)
  796. fill = "#aaaaaa";
  797. else if (i==ship.custom.checkpoint)
  798. fill = "#ff0000";
  799. else if (i==ship.custom.checkpoint+1)
  800. fill = "#3333ff";
  801. else if (i==checkpoints.length)
  802. fill = "#ffffff";
  803.  
  804. ship.setUIComponent({
  805. id:"ch"+i,
  806. position:[positionX + chX*size, positionY - chY*size,25,25],
  807. clickable: false,
  808. visible: b,
  809. components: [
  810. { type:"round",position:[0,0,5,8],fill:fill,stroke:"#CDE",width:1}
  811. ]
  812. });
  813.  
  814. }
  815.  
  816. ship.setUIComponent({
  817. id:"minimap",
  818. position:[positionX-size, positionY-size,100,100],
  819. clickable: false,
  820. visible: b,
  821. components: [
  822. { type:"round",position:[0,0,size*2,size*2],fill:"#222222",stroke:"#CDE",width:1}, ]
  823. });
  824.  
  825. };
  826.  
  827. startRace = function(){
  828. if(!raceinprogress){
  829. game.removeObject();
  830.  
  831. showBanners();
  832.  
  833. if(requestTrack==-1)
  834. trackId = nextTrack;
  835. else trackId = requestTrack;
  836.  
  837. if(requestLaps==-1)
  838. laps = tracks[trackId].laps;
  839. else laps = requestLaps;
  840.  
  841. checkpoints = tracks[trackId].checkpoints;
  842. firstCheckpointDir = shortestPath(checkpoints[0].x, checkpoints[0].y, checkpoints[1].x, checkpoints[1].y);
  843. firstCheckpointAngle = Math.atan2(firstCheckpointDir[0], firstCheckpointDir[1]);
  844.  
  845. game.setObject({
  846. id:"start",
  847. type:startline,
  848. position:{x:checkpoints[0].x, y:checkpoints[0].y,z:-2},
  849. scale:{x:15,y:15,z:15},
  850. rotation: {x:0,y:0,z:firstCheckpointAngle}
  851. });
  852.  
  853. for(i=1; i<checkpoints.length; i++){
  854. game.setObject({
  855. id:"ch"+i,
  856. type:checkpoint,
  857. position:{x:checkpoints[i].x, y:checkpoints[i].y,z:-2},
  858. scale:{x:15,y:15,z:15},
  859. rotation: {x:Math.PI,y:0,z:0}
  860. });
  861. }
  862.  
  863. for(i=0; i<tracks[trackId].roadblocks.length; i++){
  864. if(i>=roadblocks.length)break;
  865. if(tracks[trackId].roadblocks[i]==0)continue;
  866. game.setObject({
  867. id:"np"+i,
  868. type:noPassage,
  869. position:{x:roadblocks[i].x, y:roadblocks[i].y,z:-2},
  870. scale:{x:12,y:12,z:12},
  871. rotation: {x:Math.PI,y:0,z:roadblocks[i].angle}
  872. });
  873. }
  874.  
  875. lastfinished = 0;
  876. raceinprogress = true;
  877. raceStarted = false;
  878. finalCountdown=finalCountdownTime;
  879. DNFCountdown = DNFTime;
  880.  
  881. top1time.time = -1;
  882. top2time.time = -1;
  883. top3time.time = -1;
  884.  
  885. shipsInRace=0;
  886. startingGrid=[];
  887.  
  888. for (i=0;i<game.ships.length;i++)
  889. {
  890. ship = game.ships[i];
  891. if(!ship)continue;
  892. if(!ship.custom.ready)continue;
  893. shipsInRace++;
  894. startingGrid.push(i);
  895. ship.custom.lap = 0;
  896. ship.custom.inrace = true;
  897. ship.custom.checkpoint = 0;
  898. ship.custom.lasttime = -1;
  899. drawShipChooseButtons(ship, false);
  900. drawReadyButton(ship, false);
  901. drawIgnoreMeButton(ship, false);
  902. drawTopScores(ship, false);
  903. writeShipInfo(ship, false);
  904. writeTrackInfo(ship, false);
  905. }
  906.  
  907. while(Math.random()>0.01){
  908. i1 = Math.floor(Math.random()*startingGrid.length);
  909. i2 = Math.floor(Math.random()*startingGrid.length);
  910. buffer = startingGrid[i1];
  911. startingGrid[i1] = startingGrid[i2];
  912. startingGrid[i2] = buffer;
  913. }
  914.  
  915. for (i=0;i<startingGrid.length;i++)
  916. {
  917. ship = game.ships[startingGrid[i]];
  918. if(!ship)continue;
  919. if(!ship.custom.ready)continue;
  920. ship.custom.gridPos = i;
  921. }
  922.  
  923. log("Race started!");
  924. }else{
  925. log("Race already started");
  926. }
  927. }
  928.  
  929. stopRace = function(){
  930. if(raceinprogress){
  931. game.removeObject();
  932. showBanners();
  933. raceinprogress = false;
  934. racetime = 0;
  935. countdown = quickRaceStartTime;
  936. countdownLong = longRaceStartTime;
  937. lastfinished = 0;
  938. nextTrack = Math.floor(Math.random()*tracks.length);
  939. for (i=0;i<game.ships.length;i++)
  940. {
  941. ship = game.ships[i];
  942. if(!ship)continue;
  943. drawRaceTrack(ship, false);
  944. ship.custom.checkpoint = 0;
  945. ship.custom.ready = false;
  946. drawReadyButton(ship, true);
  947. drawIgnoreMeButton(ship, true);
  948. writeTrackInfo(ship, true);
  949. ship.custom.inrace = false;
  950. ship.custom.dislikeTrack = false;
  951. writeTextSmol(ship,"Press U when ready.");
  952. }
  953. log("Race stopped.");
  954. }else{
  955. log("No race in progress");
  956. }
  957. }
  958.  
  959. //direction from the start to the first checkpoint
  960. firstCheckpointDir = [];
  961.  
  962. showBanners();
  963.  
  964. this.tick = function(game) {
  965. if(game.ships.length<1)return;
  966. var i = 0;
  967. if(raceinprogress)
  968. racetime += 1/60;
  969. everySecond++;
  970. if(everySecond>60){
  971. everySecond-=60;
  972. adTimer++;
  973.  
  974. if(adTimer>adRefreshTime){
  975. adTimer = 0;
  976. randomAd();
  977. }
  978.  
  979.  
  980. //ship initialization
  981. for (i=0;i<game.ships.length;i++)
  982. {
  983. ship = game.ships[i];
  984. if(!ship)continue;
  985. if (!ship.custom.init){
  986. //this is a new ship, we have to set it up
  987. ship.custom.init = true;
  988. ship.custom.inrace = false;
  989. ship.custom.checkpoint = 0;
  990. ship.custom.lasttime = -1;
  991. ship.custom.type = 0;
  992. ship.custom.ready = false;
  993. ship.custom.lap = 0;
  994. ship.custom.dislikeTrack = false;
  995. ship.custom.ignoreSelf = false;
  996. ship.custom.ignoreMod = false;
  997. ship.set({
  998. x:sandboxArea.x-(sandboxAreaSize/8)+(sandboxAreaSize/4)*Math.random(),
  999. y:sandboxArea.y-(sandboxAreaSize/8)+(sandboxAreaSize/4)*Math.random()
  1000. });
  1001. drawReadyButton(ship, true);
  1002. drawIgnoreMeButton(ship, true);
  1003. writeTrackInfo(ship, true);
  1004. //tell them what to do
  1005. if(!raceinprogress) writeTextSmol(ship,"Press U when ready.");
  1006. }
  1007. if(!ship.custom.inrace)
  1008. ship.set({type:101+ship.custom.type});
  1009. //no fighting for now
  1010. ship.set({invulnerable:400});
  1011. if(!ship.alive){
  1012. x = 0;
  1013. y = 0;
  1014. if(ship.custom.inrace){
  1015. if(ship.custom.checkpoint == 0){
  1016. x = checkpoints[0].x;
  1017. y = checkpoints[0].y;
  1018. }else{
  1019. ch = ship.custom.checkpoint-1;
  1020. x = checkpoints[ch].x;
  1021. y = checkpoints[ch].y;
  1022. }
  1023. }else{
  1024. x = sandboxArea.x;
  1025. y = sandboxArea.y;
  1026. }
  1027. ship.set({x:x, y:y});
  1028. }
  1029. if(ship.custom.ignoreMod){
  1030. ship.set({score:0,x:cornerOfShame.x, y:cornerOfShame.y,idle:true})
  1031. writeTextLarge(ship, "SHAME");
  1032. }else{
  1033. ship.set({idle:false});
  1034. }
  1035. if(ship.custom.ignoreSelf){
  1036. writeTextLarge(ship, "You're AFK. Press [I] to continue racing.");
  1037. }
  1038. }
  1039.  
  1040. //if there is a race going on
  1041. if(raceinprogress){
  1042. finalCountdown -= 1; //countdown at the start of the race
  1043. noActivityCountdown -= 1;
  1044. ready = true; //whether the race is over
  1045. for (i=0;i<game.ships.length;i++) //iterate
  1046. {
  1047. ship = game.ships[i];
  1048. if(!ship)continue;
  1049. if(ship.custom.ignoreMod)continue;
  1050. if(!ship.custom.inrace){
  1051. //this ship either finished or just joined, tell them
  1052. drawShipChooseButtons(ship, true);
  1053. writeTextSmol(ship,"Wait until all players finish the race ("+lastfinished+" so far) or wait " + DNFCountdown + " seconds");
  1054. x = sandboxArea.x-ship.x;
  1055. y = sandboxArea.y-ship.y;
  1056. if(distance(x,y)>sandboxAreaSize)
  1057. ship.set({
  1058. score:0,
  1059. x:sandboxArea.x-(sandboxAreaSize/8)+(sandboxAreaSize/4)*Math.random(),
  1060. y:sandboxArea.y-(sandboxAreaSize/8)+(sandboxAreaSize/4)*Math.random()
  1061. })
  1062. continue;
  1063. }
  1064.  
  1065. //there are still players racing, so we're not ready to end the race
  1066. ready = false;
  1067.  
  1068. //starting countdown
  1069. if(finalCountdown>=0){
  1070. noActivityCountdown = noActivityTime;
  1071. //get the direction to the first checkpoint, normalized
  1072. dist = distance(firstCheckpointDir[0],firstCheckpointDir[1]);
  1073. x = firstCheckpointDir[0]/dist;
  1074. y = firstCheckpointDir[1]/dist;
  1075. //launchvel represent the initial boop the ships experience when
  1076. //the countdown is over
  1077. launchvel = 40;
  1078. //get a vector perpendicular to the direction to the first checkpoint
  1079. perpY = x;
  1080. perpX = -y;
  1081.  
  1082. vx = 0;
  1083. vy = 0;
  1084. //launch the player as the race starts
  1085. if(finalCountdown<1){
  1086. raceStarted = true;
  1087. racetime = 0;
  1088. writeTextLarge(ship,"GO GO GO");
  1089. vx = x*launchVel;
  1090. vy = y*launchVel;
  1091. }else
  1092. //output the final countdown
  1093. writeTextLarge(ship,""+finalCountdown);
  1094. posInLine = ship.custom.gridPos%shipsInLine;
  1095. line = Math.floor(ship.custom.gridPos/shipsInLine);
  1096. //keep the player at the starting line
  1097. ship.set({
  1098. idle:true,
  1099. x:checkpoints[0].x-perpX*(startingLinesWidth/2) + perpX*(startingLinesWidth)*(posInLine/(shipsInLine-1))+(-x*line*startingLinesDist),
  1100. y:checkpoints[0].y-perpY*(startingLinesWidth/2) + perpY*(startingLinesWidth)*(posInLine/(shipsInLine-1))+(-y*line*startingLinesDist),
  1101. vx:0,
  1102. vy:0
  1103. });
  1104. }
  1105.  
  1106. //update the race track minimap
  1107. drawRaceTrack(ship, true);
  1108. }
  1109. if(lastfinished>0)DNFCountdown--;
  1110. if(ready||(lastfinished>0&&DNFCountdown<0)||noActivityCountdown<0){
  1111. if(ready)
  1112. log("All players finished");
  1113. else if(DNFCountdown<0) log("Race ends - timeout"); else
  1114. log("Race ends - no activity");
  1115. stopRace();
  1116. }
  1117.  
  1118. }else{
  1119.  
  1120.  
  1121. if(dislikedBy>0.5*readyAmount){
  1122. nt = nextTrack
  1123. nextTrack = Math.floor(Math.random()*tracks.length);
  1124. while(tracks.length>1&&nt==nextTrack){
  1125. nextTrack = Math.floor(Math.random()*tracks.length);
  1126. }
  1127. for (i=0;i<game.ships.length;i++)
  1128. {
  1129. ship = game.ships[i];
  1130. if(!ship)continue;
  1131. ship.custom.dislikeTrack = false;
  1132.  
  1133. }
  1134. }
  1135.  
  1136. //whether all players are ready
  1137. ready = true;
  1138. lastReadyAmount = readyAmount;
  1139. //whether there's at least one fool that wants a race
  1140. atLeastOnePlayer = false;
  1141. readyAmount = 0;
  1142. dislikedBy = 0;
  1143.  
  1144. for (i=0;i<game.ships.length;i++)
  1145. {
  1146. ship = game.ships[i];
  1147. if(!ship)continue;
  1148. if(ship.custom.ignoreMod)continue;
  1149. if(ship.custom.ignoreSelf)continue;
  1150. //check if the ship is in range of starting checkpoint
  1151. x = checkpoints[0].x-ship.x;
  1152. y = checkpoints[0].y-ship.y;
  1153. writeTrackInfo(ship, true);
  1154. if(!ship.custom.ready){
  1155. //if not, then clearly not all players are ready
  1156. ready = false;
  1157. drawShipChooseButtons(ship, true);
  1158. if(countdownLong<longRaceStartTime-1)
  1159. writeTextLarge(ship,"Race starts in "+Math.max(countdown,countdownLong)+" - YOU ARE NOT READY [U]");
  1160. else writeTextLarge(ship, "");
  1161. continue;
  1162. }else atLeastOnePlayer = true;//otherwise at least somebody's willing to race
  1163. //countdownLong overrides countdown
  1164.  
  1165. if(ship.custom.dislikeTrack)
  1166. dislikedBy++;
  1167. readyAmount++;
  1168.  
  1169. writeTrackInfo(ship, true);
  1170.  
  1171. if(countdownLong<countdown)countdown=countdownLong;
  1172.  
  1173. //if the countdown is at maximum, we're probably still waiting for players
  1174. if(countdown>=quickRaceStartTime-1)
  1175. writeTextLarge(ship,"Waiting for other players... "+countdownLong+" ("+lastReadyAmount+" ready)");
  1176. //otherwise we're starting soon
  1177. if(countdown<quickRaceStartTime-1)writeTextLarge(ship,"Starting in "+countdown+" seconds...");
  1178. //if the countdown finished successfuly
  1179. if(countdown<0||countdownLong<0){
  1180. startRace();
  1181. }
  1182. }
  1183.  
  1184. if(atLeastOnePlayer)countdownLong-=1; else{
  1185. countdownLong = longRaceStartTime;
  1186. }
  1187. if(ready&&atLeastOnePlayer)countdown-=1; else{
  1188. countdown = quickRaceStartTime;
  1189. }
  1190.  
  1191. }
  1192.  
  1193. }
  1194.  
  1195. if(game.step%1==0){
  1196. if(raceinprogress)
  1197. for (i=0;i<game.ships.length;i++)
  1198. {
  1199. ship = game.ships[i];
  1200. if(!ship)continue;
  1201. if(!ship.custom.inrace)continue;
  1202. //checkpoint execution
  1203. ch = ship.custom.checkpoint;
  1204. x = checkpoints[ch].x-ship.x;
  1205. y = checkpoints[ch].y-ship.y;
  1206. //if we're in range of the next checkpoint
  1207. if(distance(x, y)<checkpointrange){
  1208.  
  1209. //proceed to the next checkpoint
  1210. ship.custom.checkpoint=ship.custom.checkpoint+1;
  1211. noActivityCountdown = noActivityTime;
  1212.  
  1213. //if this is the last checkpoint
  1214. if(ship.custom.checkpoint>=checkpoints.length){
  1215. if(ship.custom.lap<laps-1){
  1216. ship.custom.lap++;
  1217. ship.custom.checkpoint = 0;
  1218. }else{
  1219. //if this is the first ship to finish, start the DNF countdown
  1220. if(lastfinished==0)DNFCountdown = DNFTime;
  1221. lastfinished++;
  1222. if(lastfinished==1){top1time.name = ship.name; top1time.time = racetime;}
  1223. if(lastfinished==2){top2time.name = ship.name; top2time.time = racetime;}
  1224. if(lastfinished==3){top3time.name = ship.name; top3time.time = racetime;}
  1225. log("#"+lastfinished+" - "+racetime + " s");
  1226. writeTextLarge(ship,"Your place: "+lastfinished+" in "+racetime.toFixed(2)+"s");
  1227. ship.custom.inrace=false;
  1228. ship.custom.checkpoint = 0;
  1229. ship.custom.lasttime = racetime;
  1230. for (j=0;j<game.ships.length;j++)
  1231. drawTopScores(game.ships[j], true);
  1232. ship.set({score:(checkpoints.length*10000)-(lastfinished*1000)});
  1233. }
  1234. }else{
  1235. ship.set({score:ship.custom.checkpoint*1000+checkpoints.length*ship.custom.lap*1000});
  1236. writeTextLarge(ship," ");
  1237. if(ship.custom.checkpoint > 1||ship.custom.lap>0){
  1238. if(laps>0)
  1239. lapText = "(lap "+(ship.custom.lap+1)+"/"+laps+")";
  1240. writeTextSmol(ship,"Checkpoint "+ ship.custom.checkpoint + "/"+checkpoints.length+" "+lapText);
  1241. } else {
  1242. writeTextSmol(ship,"Follow the red dot.");
  1243. }
  1244. }
  1245. }
  1246. }
  1247.  
  1248. }
  1249.  
  1250. // do mod stuff here ; see documentation
  1251. if (game.step%10==0) // ensure this is done only once per second
  1252. {
  1253. for (i=0;i<game.ships.length;i++)
  1254. {
  1255. ship = game.ships[i];
  1256. if(!ship)continue;
  1257. if(!ship.custom.inrace)continue;
  1258. ch = ship.custom.checkpoint;
  1259. if(ch>=checkpoints.length)continue;
  1260. path = shortestPath(ship.x, ship.y, checkpoints[ch].x, checkpoints[ch].y);
  1261. x = path[0];
  1262. y = path[1];
  1263. vis = true;
  1264. if(distance(x, y)<checkpointrange)
  1265. vis = false;
  1266. xx = 25*x/distance(x, y);
  1267. yy = 25*y/distance(x, y);
  1268. ship.setUIComponent({
  1269. id:"nextCh",
  1270. position:[50+xx,50-yy,25,25],
  1271. clickable: false,
  1272. visible: vis,
  1273. components: [
  1274. { type:"round",position:[0,0,5,10],fill:"#ff0000",stroke:"#CDE",width:1}
  1275. ]
  1276. });
  1277.  
  1278. }
  1279.  
  1280. }
  1281. };
  1282.  
  1283. this.event = function(event,game) {
  1284. switch (event.name)
  1285. {
  1286. case "ui_component_clicked":
  1287. var ship = event.ship;
  1288. var component = event.id;
  1289. if (component == "nextship")
  1290. {
  1291. ship.custom.type++;
  1292. if(ship.custom.type>=ships.length)
  1293. ship.custom.type = 0;
  1294. writeShipInfo(ship, !ship.custom.inrace);
  1295. }
  1296. if (component == "prevship")
  1297. {
  1298. ship.custom.type--;
  1299. if(ship.custom.type<0)
  1300. ship.custom.type = ships.length-1;
  1301. writeShipInfo(ship, !ship.custom.inrace);
  1302. }
  1303. if (component == "readyToggle"){
  1304. ship.custom.ready = !ship.custom.ready;
  1305. drawReadyButton(ship, !ship.custom.inrace);
  1306. }
  1307. if (component == "ignoreMeToggle"){
  1308. ship.custom.ignoreSelf = !ship.custom.ignoreSelf;
  1309. drawIgnoreMeButton(ship, !ship.custom.inrace);
  1310. }
  1311. if (component == "trackInfo"){
  1312. ship.custom.dislikeTrack = !ship.custom.dislikeTrack;
  1313. writeTrackInfo(ship, !ship.custom.inrace);
  1314. }
  1315.  
  1316. break;
  1317. }
  1318. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement