Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 79.65 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. var Spectatorship = '{"name":"Spectatorship","level":3,"model":1,"size":1,"zoom":0.4,"specs":{"shield":{"capacity":[1000,1000],"reload":[100,100]},"generator":{"capacity":[1,1],"reload":[100,100]},"ship":{"mass":1e-7,"speed":[200,200],"rotation":[1,1],"acceleration":[1,1]}},"bodies":{"main":{"section_segments":4,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0],"y":[-60,0,60],"z":[0,0,0,0,0,0]},"width":[0,20,0],"height":[0,20,0],"texture":[17],"propeller":false}},"typespec":{"name":"Spectatorship","level":3,"model":1,"code":301,"specs":{"shield":{"capacity":[1000,1000],"reload":[100,100]},"generator":{"capacity":[1,1],"reload":[100,100]},"ship":{"mass":1e-7,"speed":[200,200],"rotation":[1,1],"acceleration":[1,1]}},"shape":[1.2,1.01,0.77,0.632,0.546,0.486,0.443,0.414,0.396,0.385,0.38,0.385,0.396,0.4,0.385,0.38,0.385,0.396,0.414,0.443,0.486,0.546,0.632,0.77,1.01,1.2,1.01,0.77,0.632,0.546,0.486,0.443,0.414,0.396,0.385,0.38,0.385,0.396,0.4,0.385,0.38,0.385,0.396,0.414,0.443,0.486,0.546,0.632,0.77,1.01],"lasers":[],"radius":1.2}}';
  157.  
  158. //ship info here
  159.  
  160. speedBuff = 10;
  161. dashSpeedBuff = 10;
  162. accelerationBuff = 1.05;
  163. dashAccelerationBuff = 1.05;
  164. energyRegenBuff = 1.25;
  165.  
  166. 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}}},'+
  167. '"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}}';
  168. 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}}},'+
  169. '"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}}';
  170. 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}}},'+
  171. '"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}}';
  172. 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]}},'+
  173. '"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}}';
  174. 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}}},'+
  175. '"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}}';
  176. 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}}},'+
  177. '"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}}';
  178. 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}}},'+
  179. '"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,200],"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}}';
  180. 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]}},'+
  181. '"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}}';
  182. 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}}},'+
  183. '"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}}';
  184. 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}}},'+
  185. '"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}}';
  186.  
  187. ships = [];
  188. shipInfos = [];
  189.  
  190. racingShipsAmount = 10;
  191.  
  192. ships.push(Astral);
  193. shipInfos.push({company:"FinaDrive", creator:"Finalizer",
  194. desc:"Powerful boost, high cruising speed,\n amazing hot look. What else do you need?"});
  195.  
  196. ships.push(ShadowX1);
  197. shipInfos.push({company:"Starblast", creator:"pmgl",
  198. 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."});
  199.  
  200. ships.push(RADDiamondLancer);
  201. shipInfos.push({company:"RAD Diamond", creator:"UranusOrbiter",
  202. desc:"It might look a bit weird and feel sluggish, \nbut it's strength is it's boost tank. \nHold that dash button."});
  203.  
  204. ships.push(ZerdBooster);
  205. shipInfos.push({company:"ZerdTech", creator:"Revenge Zerd",
  206. desc:"Beautiful and powerful, this lovely rocket \ncan change. It's. Movement. Direction. Instantly."});
  207.  
  208. ships.push(LGViper);
  209. shipInfos.push({company:"Halo L.Starships", creator:"L.Gaming",
  210. desc:"A sleek, compact, fast ship capable of\n powerful overdrive allowing you to surpass your competition.\n Great handling although low thrust."});
  211.  
  212. ships.push(VoidA);
  213. shipInfos.push({company:"Abyss Racecraft ltd.", creator:"Void",
  214. desc:"Simple, nice-looking racing vehicle. \nNothing too fancy. \nDoes it's job well."});
  215.  
  216. ships.push(Starsurfer);
  217. shipInfos.push({company:"SpaceGGFlight", creator:"UranusOrbiter",
  218. 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."});
  219.  
  220. ships.push(ZerdTurbine);
  221. shipInfos.push({company:"ZerdTech", creator:"Revenge Zerd",
  222. 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."});
  223.  
  224. ships.push(Arrowhead);
  225. shipInfos.push({company:"T. T. Tun design bureau", creator:"Cmdre. T. T. Tun",
  226. 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."});
  227.  
  228. ships.push(SweptWingedRacecraft);
  229. shipInfos.push({company:"Chickenman's Coop", creator:"SChickenMan",
  230. 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"});
  231.  
  232. for(i =0;i<ships.length;i++){
  233. ships[i] = JSON.parse(ships[i]);
  234. ships[i].typespec.specs.shield.capacity = [1000,1000];
  235.  
  236. ships[i].typespec.specs.ship.speed[1]+=speedBuff;
  237. if(ships[i].typespec.specs.ship.dash!=undefined)
  238. ships[i].typespec.specs.ship.dash.speed[1]+=dashSpeedBuff;
  239.  
  240. ships[i].typespec.specs.ship.acceleration[1]*=accelerationBuff;
  241. if(ships[i].typespec.specs.ship.dash!=undefined)
  242. ships[i].typespec.specs.ship.dash.acceleration[1]*=dashAccelerationBuff;
  243. ships[i].typespec.specs.generator.reload[1]*=energyRegenBuff;
  244.  
  245. ships[i] = JSON.stringify(ships[i]);
  246. }
  247.  
  248. ships.push(Spectatorship)
  249.  
  250. //mod code - edit at your own risk
  251.  
  252. this.options = {
  253. // see documentation for options reference
  254. //root_mode: "survival",
  255. weapons_store: false,
  256. ships: ships,
  257. map_size: mapSize,
  258. map_id: mapSeed,
  259. asteroids_strength: 10,
  260. crystal_value: 0,
  261. radar_zoom: 1.5
  262. };
  263.  
  264. if(customMap)
  265. this.options.custom_map = map;
  266.  
  267. const map_size = mapSize*5; //the size of the map
  268.  
  269. const checkpointrange = 40; //size of checkpoints
  270. const quickRaceStartTime = 20; //time it takes to start a race if all players are ready
  271. const longRaceStartTime = 60; //time it takes to start a race if some players are ready
  272. const DNFTime = 60; //did not finish time
  273. const finalCountdownTime = 10; //the final countdown before the race
  274. const sandboxAreaSize = 65;
  275. const shipsInLine = 2;
  276. const startingLinesWidth = 10;
  277. const startingLinesDist = 7;
  278. const noActivityTime = 30;
  279.  
  280. laps = 3;
  281.  
  282. raceinprogress = false; //whether there's a race going on
  283. racetime = 0; //race timer
  284. lastfinished = 0; //how many players finished
  285. countdown = quickRaceStartTime; //lobby countdown timer(all players ready)
  286. countdownLong = longRaceStartTime; //lobby countdown timer(some players ready)
  287. DNFCountdown = 0; //DNF timer
  288. noActivityCountdown = 0;//no activity timer
  289. finalCountdown = 0; //final countdown
  290. raceStarted = false; //whether the final countdown is finished
  291. everySecond = 0;
  292. dislikedBy = 0;
  293. readyAmount = 0;
  294.  
  295. requestTrack = -1;
  296. requestLaps = -1;
  297.  
  298. nextTrack = 0;
  299.  
  300. //direction from the start to the first checkpoint
  301. firstCheckpointDir = [];
  302. firstCheckpointAngle = 0;
  303.  
  304. highestCheckpoint = [-1, -1];
  305.  
  306. top1time = {name:"", time:-1};
  307. top2time = {name:"", time:-1};
  308. top3time = {name:"", time:-1};
  309.  
  310. ads = [];
  311. adTimer = 0;
  312. adRefreshTime = 5;
  313.  
  314. ads.push("Uranus Racing League by /u/UranusOrbiter aka Uranus_is_big#7833");
  315. ads.push("Uranus Racing League version 0.0003");
  316. ads.push("Have a nice day");
  317.  
  318. ads.push("Huge thanks to pmgl for making all of this possible");
  319. ads.push("Huge thanks to Starblast dev team for making all of this possible");
  320.  
  321. ads.push("Thanks to everybody who helped test this mod");
  322.  
  323. ads.push("Map created by rm -rf / and improved by Uranus");
  324. ads.push("Huge thanks to rm -rf / for creating this beautiful map");
  325.  
  326. ads.push("Huge thanks to SChickenMan for helping with ship balance");
  327.  
  328. banners = [];
  329.  
  330. RADDiamondLogo = {
  331. id: "RAD",
  332. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  333. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/RadDiamond.png"
  334. };
  335. banners.push(RADDiamondLogo);
  336.  
  337. RADDiamondLancer1 = {
  338. id: "RADL1",
  339. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  340. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/RAD%20DIAMOND%20LANCER%20ad1.png"
  341. };
  342. banners.push(RADDiamondLancer1);
  343.  
  344. RADDiamondLancer2 = {
  345. id: "RADL2",
  346. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  347. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/RAD%20DIAMOND%20LANCER%20ad2.png"
  348. };
  349. banners.push(RADDiamondLancer2);
  350.  
  351. SpaceGG = {
  352. id: "SPACEGG",
  353. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  354. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/SpaceGGFlight.png"
  355. };
  356. banners.push(SpaceGG);
  357.  
  358. ZerdTech = {
  359. id: "ZerdTech",
  360. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  361. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/ZerdTech.png"
  362. };
  363. banners.push(ZerdTech);
  364.  
  365. ECP1 = {
  366. id: "ECP1",
  367. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  368. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/lovethegameECP.png"
  369. };
  370. ECP2 = {
  371. id: "ECP2",
  372. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  373. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/starblastisfreeECP.png"
  374. };
  375. ECP3 = {
  376. id: "ECP3",
  377. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  378. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/havingFunECP.png"
  379. };
  380. ECP4 = {
  381. id: "ECP4",
  382. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  383. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/unclesamECP.png"
  384. };
  385. banners.push(ECP1, ECP2, ECP3, ECP4);
  386.  
  387. USeries1 = {
  388. id: "US1",
  389. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  390. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/useries1.png"
  391. };
  392. USeries2 = {
  393. id: "US2",
  394. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  395. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/useries2.png"
  396. };
  397. USeries3 = {
  398. id: "US3",
  399. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  400. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/useries3.png"
  401. };
  402. banners.push(USeries1,USeries2,USeries3);
  403.  
  404.  
  405. noPassage = {
  406. id: "noPassage",
  407. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  408. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/noPassage.png"
  409. };
  410.  
  411. checkpoint = {
  412. id: "checkpoint",
  413. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  414. emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/checkpoint.png"
  415. };
  416.  
  417. startline = {
  418. id: "startline",
  419. obj: "https://starblast.data.neuronality.com/mods/objects/plane.obj",
  420. emissive: "https://starblast.data.neuronality.com/mods/objects/startline.png"
  421. };
  422.  
  423. distance = function(x, y){
  424. return Math.sqrt(x*x+y*y);
  425. };
  426.  
  427. shortestPath = function(x1, y1, x2, y2){
  428.  
  429. shortestDist = 10000;
  430.  
  431.  
  432. coords = [];
  433.  
  434. xx = x2-x1;
  435. yy = y2-y1;
  436. coords.push(xx, yy);
  437. shortest = [xx, yy];
  438.  
  439. xx = x2+map_size*2-x1;
  440. yy = y2-y1;
  441. coords.push(xx, yy);
  442.  
  443. xx = x2-map_size*2-x1;
  444. yy = y2-y1;
  445. coords.push(xx, yy);
  446.  
  447. xx = x2-x1;
  448. yy = y2+map_size*2-y1;
  449. coords.push(xx, yy);
  450.  
  451. xx = x2-x1;
  452. yy = y2-map_size*2-y1;
  453. coords.push(xx, yy);
  454.  
  455.  
  456. xx = x2+map_size*2-x1;
  457. yy = y2+map_size*2-y1;
  458. coords.push(xx, yy);
  459.  
  460. xx = x2+map_size*2-x1;
  461. yy = y2-map_size*2-y1;
  462. coords.push(xx, yy);
  463.  
  464. xx = x2-map_size*2-x1;
  465. yy = y2+map_size*2-y1;
  466. coords.push(xx, yy);
  467.  
  468. xx = x2-map_size*2-x1;
  469. yy = y2-map_size*2-y1;
  470. coords.push(xx, yy);
  471.  
  472. for(var i = 0; i<9; i++){
  473. dist = distance(coords[i*2], coords[i*2+1]);
  474. if(dist<shortestDist){
  475. shortestDist = dist;
  476. shortest = [coords[i*2], coords[i*2+1]];
  477. }
  478. }
  479.  
  480. return shortest;
  481.  
  482. };
  483.  
  484. debugDrawAllRoadblocks = function(){
  485. game.removeObject();
  486. for(i=0; i<roadblocks.length; i++){
  487. game.setObject({
  488. id:"np"+i,
  489. type:noPassage,
  490. position:{x:roadblocks[i].x, y:roadblocks[i].y,z:-2},
  491. scale:{x:12,y:12,z:12},
  492. rotation: {x:Math.PI,y:0,z:roadblocks[i].angle}
  493. });
  494. }
  495. }
  496.  
  497. debugFindClosestRoadblockIndex = function(shipindex){
  498. closestDist = map_size*2;
  499. closest = -1;
  500. ship = game.ships[shipindex];
  501. for(i=0; i<roadblocks.length; i++){
  502.  
  503. shortest = shortestPath(ship.x,ship.y,roadblocks[i].x,roadblocks[i].y);
  504. if(distance(shortest[0],shortest[1])<closestDist){
  505. closestDist = distance(shortest[0],shortest[1]);
  506. closest = i;
  507. }
  508. }
  509. return closest;
  510.  
  511.  
  512. }
  513.  
  514. shamePlayer = function(shipindex){
  515. game.ships[shipindex].custom.ignoreMod = true;
  516. log(game.ships[shipindex].name + " is now in the corner of shame.");
  517. }
  518.  
  519. unshamePlayer = function(shipindex){
  520. game.ships[shipindex].custom.ignoreMod = false;
  521. log(game.ships[shipindex].name + " has been unshamed.");
  522. game.ships[shipindex].set({x:sandboxArea.x, y:sandboxArea.y});
  523. }
  524.  
  525. playerList = function(){
  526. log("List of players:");
  527. for(i=0; i<game.ships.length; i++){
  528. log("game.ships["+i + "]: "+game.ships[i].name);
  529. }
  530. }
  531.  
  532. writeTextLarge = function(ship, string){
  533. ship.setUIComponent({
  534. id:"largeText",
  535. position:[25,25,50,25],
  536. clickable: false,
  537. visible: true,
  538. components: [
  539. { type: "text",position: [0,0,100,100],color: "#FFFFFF",value: string}
  540. ]
  541. });
  542.  
  543.  
  544. };
  545.  
  546. writeTextSmol = function(ship, string){
  547. ship.setUIComponent({
  548. id:"smolText",
  549. position:[25,10,50,25],
  550. clickable: false,
  551. visible: true,
  552. components: [
  553. { type: "text",position: [0,0,100,20],color: "#FFFFFF",value: string}
  554. ]
  555. });
  556. };
  557.  
  558. randomAd = function(){
  559. adIndex = Math.floor(Math.random()*ads.length);
  560. ad = ads[adIndex];
  561. if(Math.random()<0.5){
  562. shipIndex = Math.floor(Math.random()*shipInfos.length);
  563. if(shipInfos[shipIndex].creator != "UranusOrbiter"){
  564. name = JSON.parse(ships[shipIndex]).name;
  565. ad = "Huge thanks to "+shipInfos[shipIndex].creator+" for his "+name+" design";
  566. }
  567. }
  568.  
  569. for (i=0;i<game.ships.length;i++)
  570. {
  571. game.ships[i].setUIComponent({
  572. id:"ad",
  573. position:[25,3,50,25],
  574. clickable: false,
  575. visible: true,
  576. components: [
  577. { type: "text",position: [0,0,100,20],color: "#FFFFFF",value: ad}
  578. ]
  579. });
  580. }
  581. };
  582.  
  583. showBanners = function(){
  584. for(i = 0; i<bannerPositions.length; i++){
  585. index = Math.floor(Math.random()*banners.length);
  586. game.setObject({
  587. id:"banner"+i,
  588. type:banners[index],
  589. position:{x:bannerPositions[i].x, y:bannerPositions[i].y,z:-4},
  590. scale:{x:20,y:20,z:20},
  591. rotation: {x:Math.PI,y:0,z:0}
  592. });
  593. }
  594.  
  595. }
  596.  
  597. announce = function(string){
  598. for (i=0;i<game.ships.length;i++)
  599. {
  600. ship = game.ships[i];
  601. ship.setUIComponent({
  602. id:"announceText",
  603. position:[25,45,50,25],
  604. clickable: false,
  605. visible: true,
  606. components: [
  607. { type: "text",position: [0,0,100,20],color: "#FFBBBB",value: string}
  608. ]
  609. });
  610.  
  611. }
  612. };
  613.  
  614. log = function(string){
  615. game.modding.terminal.echo(string);
  616. }
  617.  
  618. drawTopScores = function(ship, b){
  619. sc1 = "#1 - ";
  620. sc2 = "#2 - ";
  621. sc3 = "#3 - "
  622. if(top1time.time>=0)sc1+=top1time.name+" - "+top1time.time.toFixed(2);
  623. if(top2time.time>=0)sc2+=top2time.name+" - "+top2time.time.toFixed(2);
  624. if(top3time.time>=0)sc3+=top3time.name+" - "+top3time.time.toFixed(2);
  625.  
  626. if(ship.custom.lasttime>=0)
  627. yourLastTime = "your time: " + ship.custom.lasttime.toFixed(2);
  628. else
  629. yourLastTime = "your time: N/A";
  630.  
  631. ship.setUIComponent({
  632. id:"topscores",
  633. position:[60,50,40,25],
  634. clickable: false,
  635. visible: b,
  636. components: [
  637. { type: "text",position: [0,0,100,20],color: "#FFFF33",value: sc1},
  638. { type: "text",position: [0,20,100,20],color: "#BBBBBB",value: sc2},
  639. { type: "text",position: [0,40,100,20],color: "#FFAA33",value: sc3},
  640. { type: "text",position: [0,80,100,20],color: "#FFFFFF",value: yourLastTime}
  641. ]
  642. });
  643.  
  644. };
  645.  
  646. drawShipChooseButtons = function(ship, b){
  647. ship.setUIComponent(
  648. {id: "prevship",
  649. position: [2,40,8,14],
  650. clickable: b,
  651. shortcut: "W",
  652. visible: b,
  653. components: [
  654. { type:"round",position:[0,0,100,100],fill:"#456",stroke:"#CDE",width:2},
  655. { type: "text",position:[10,35,80,30],value:"Previous ship",color:"#CDE"},
  656. { type: "text",position:[20,70,60,20],value:"[W]",color:"#CDE"}
  657. ]
  658.  
  659. }
  660. );
  661.  
  662. ship.setUIComponent(
  663. {id: "nextship",
  664. position: [90,40,8,14],
  665. clickable: b,
  666. shortcut: "E",
  667. visible: b,
  668. components: [
  669. { type:"round",position:[0,0,100,100],fill:"#456",stroke:"#CDE",width:2},
  670. { type: "text",position:[10,35,80,30],value:"Next ship",color:"#CDE"},
  671. { type: "text",position:[20,70,60,20],value:"[E]",color:"#CDE"}
  672. ]
  673.  
  674. }
  675. );
  676.  
  677. }
  678.  
  679. drawReadyButton = function(ship, b){
  680. color = "#AA0000";
  681. text = "NOT READY"
  682. if(ship.custom.ready){
  683. color = "#00AA00";
  684. text = "READY";
  685. }
  686.  
  687. ship.setUIComponent(
  688. {id: "readyToggle",
  689. position: [5,20,8,14],
  690. clickable: b,
  691. shortcut: "U",
  692. visible: b,
  693. components: [
  694. { type:"round",position:[0,0,100,100],fill:color,stroke:"#CDE",width:2},
  695. { type: "text",position:[10,35,80,30],value:text,color:"#CDE"},
  696. { type: "text",position:[20,70,60,20],value:"[U]",color:"#CDE"}
  697. ]
  698.  
  699. }
  700. );
  701. }
  702.  
  703. drawIgnoreMeButton = function(ship, b){
  704. color = "#00AA00";
  705. text = "NOT AFK"
  706. if(ship.custom.ignoreSelf){
  707. color = "#888888";
  708. text = "AFK";
  709. }
  710.  
  711. ship.setUIComponent(
  712. {id: "ignoreMeToggle",
  713. position: [15,20,8,14],
  714. clickable: b,
  715. shortcut: "I",
  716. visible: b,
  717. components: [
  718. { type:"round",position:[0,0,100,100],fill:color,stroke:"#CDE",width:2},
  719. { type: "text",position:[10,35,80,30],value:text,color:"#CDE"},
  720. { type: "text",position:[20,70,60,20],value:"[I]",color:"#CDE"}
  721. ]
  722.  
  723. }
  724. );
  725. }
  726.  
  727. drawSpectateButton = function(ship, b){
  728. color = "#0000AA";
  729. text = "SPECTATE"
  730. if(ship.custom.spectating!=-1){
  731. color = "#00AA00";
  732. text = "RETURN";
  733. }
  734.  
  735. ship.setUIComponent(
  736. {id: "spectateToggle",
  737. position: [25,20,8,14],
  738. clickable: b,
  739. shortcut: "L",
  740. visible: b,
  741. components: [
  742. { type:"round",position:[0,0,100,100],fill:color,stroke:"#CDE",width:2},
  743. { type: "text",position:[10,35,80,30],value:text,color:"#CDE"},
  744. { type: "text",position:[20,70,60,20],value:"[L]",color:"#CDE"}
  745. ]
  746.  
  747. }
  748. );
  749.  
  750. ship.setUIComponent(
  751. {id: "spectateNext",
  752. position: [35,20,8,14],
  753. clickable: ship.custom.spectating!=-1,
  754. shortcut: "K",
  755. visible: ship.custom.spectating!=-1,
  756. components: [
  757. { type:"round",position:[0,0,100,100],fill:color,stroke:"#CDE",width:2},
  758. { type: "text",position:[10,35,80,30],value:"SPECTATE NEXT",color:"#CDE"},
  759. { type: "text",position:[20,70,60,20],value:"[K]",color:"#CDE"}
  760. ]
  761.  
  762. }
  763. );
  764. }
  765.  
  766. writeShipInfo = function(ship, b){
  767.  
  768. index = 0;
  769.  
  770. index = ship.custom.type;
  771. if(index>=shipInfos.length)return;
  772. if(index<0)return;
  773.  
  774. if(b)
  775. desc = shipInfos[index].desc.split("\n");
  776. UIDesc = [];
  777.  
  778. if(b)
  779. UIDesc.push(
  780. { type: "text",position: [0,0,100,10],color: "#3333AA",value: shipInfos[index].company},
  781. { type: "text",position: [0,10,100,20],color: "#FFFFFF",value: JSON.parse(ships[index]).name},
  782. { type: "text",position: [0,30,100,10],color: "#AAAAAA",value: "by "+shipInfos[index].creator},
  783. );
  784.  
  785. if(b)
  786. for(i = 0; i<desc.length; i++){
  787. UIDesc.push(
  788. { type: "text",position: [0,40+i*10,100,7],color: "#FFFFFF",value: desc[i]}
  789. );
  790. }
  791.  
  792. ship.setUIComponent({
  793. id:"shipInfo",
  794. position:[4,50,50,50],
  795. clickable: false,
  796. visible: b,
  797. components: UIDesc
  798. });
  799.  
  800. };
  801.  
  802. writeTrackInfo = function(ship, b){
  803.  
  804. trackName = tracks[nextTrack].name + ", "+tracks[nextTrack].laps+" laps";
  805.  
  806. dislike = "Press [N] to dislike this track";
  807. dislikeCol = "#FFFFFF";
  808. if(ship.custom.dislikeTrack){
  809. if(dislikedBy>1)
  810. dislike = "You and "+(dislikedBy-1)+" people dislike this track [N]"
  811. else "You dislike this track [N]";
  812. dislikeCol = "#FFAAAA";
  813. }
  814. if(!ship.custom.ready){
  815. dislike = "You are not ready and cannot vote."
  816. dislikeCol = "#AAAAAA";
  817. }
  818.  
  819. ship.setUIComponent({
  820. id:"trackInfo",
  821. position:[75,30,25,50],
  822. shortcut:"N",
  823. clickable: true,
  824. visible: b,
  825. components: [
  826. {type: "text",position: [0,0,100,7],color: "#FFFFFF",value: trackName},
  827. {type: "text",position: [0,10,100,7],color: dislikeCol,value: dislike}
  828. ]
  829. });
  830.  
  831. };
  832.  
  833. drawRaceTrack = function(ship, b){
  834.  
  835. positionX = 85;
  836. positionY = 30;
  837.  
  838. size = 10;
  839.  
  840.  
  841.  
  842. ship.setUIComponent({
  843. id:"playerMarker",
  844. position:[positionX, positionY,25,25],
  845. clickable: false,
  846. visible: b,
  847. components: [
  848. { type:"round",position:[0,0,3,4],fill:"#777777",stroke:"#CDE",width:1}
  849. ]
  850. });
  851.  
  852. for(var i = 0; i<checkpoints.length; i++){
  853.  
  854. path = shortestPath(ship.x, ship.y, checkpoints[i].x, checkpoints[i].y);
  855. x = path[0];
  856. y = path[1];
  857.  
  858. chX = x/map_size;
  859. chY = y/map_size;
  860.  
  861. fill = "#00ff00";
  862. if(i<ship.custom.checkpoint)
  863. fill = "#aaaaaa";
  864. else if (i==ship.custom.checkpoint)
  865. fill = "#ff0000";
  866. else if (i==ship.custom.checkpoint+1)
  867. fill = "#3333ff";
  868. else if (i==checkpoints.length)
  869. fill = "#ffffff";
  870.  
  871. ship.setUIComponent({
  872. id:"ch"+i,
  873. position:[positionX + chX*size, positionY - chY*size,25,25],
  874. clickable: false,
  875. visible: b,
  876. components: [
  877. { type:"round",position:[0,0,5,8],fill:fill,stroke:"#CDE",width:1}
  878. ]
  879. });
  880.  
  881. }
  882.  
  883. ship.setUIComponent({
  884. id:"minimap",
  885. position:[positionX-size, positionY-size,100,100],
  886. clickable: false,
  887. visible: b,
  888. components: [
  889. { type:"round",position:[0,0,size*2,size*2],fill:"#222222",stroke:"#CDE",width:1}, ]
  890. });
  891.  
  892. };
  893.  
  894. startRace = function(){
  895. if(!raceinprogress){
  896. game.removeObject();
  897.  
  898. showBanners();
  899.  
  900. if(requestTrack==-1)
  901. trackId = nextTrack;
  902. else trackId = requestTrack;
  903.  
  904. if(requestLaps==-1)
  905. laps = tracks[trackId].laps;
  906. else laps = requestLaps;
  907.  
  908. checkpoints = tracks[trackId].checkpoints;
  909. firstCheckpointDir = shortestPath(checkpoints[0].x, checkpoints[0].y, checkpoints[1].x, checkpoints[1].y);
  910. firstCheckpointAngle = Math.atan2(firstCheckpointDir[0], firstCheckpointDir[1]);
  911.  
  912. highestCheckpoint = [-1, -1];
  913.  
  914. game.setObject({
  915. id:"start",
  916. type:startline,
  917. position:{x:checkpoints[0].x, y:checkpoints[0].y,z:-2},
  918. scale:{x:15,y:15,z:15},
  919. rotation: {x:0,y:0,z:firstCheckpointAngle}
  920. });
  921.  
  922. for(i=1; i<checkpoints.length; i++){
  923. game.setObject({
  924. id:"ch"+i,
  925. type:checkpoint,
  926. position:{x:checkpoints[i].x, y:checkpoints[i].y,z:-2},
  927. scale:{x:15,y:15,z:15},
  928. rotation: {x:Math.PI,y:0,z:0}
  929. });
  930. }
  931.  
  932. for(i=0; i<tracks[trackId].roadblocks.length; i++){
  933. if(i>=roadblocks.length)break;
  934. if(tracks[trackId].roadblocks[i]==0)continue;
  935. game.setObject({
  936. id:"np"+i,
  937. type:noPassage,
  938. position:{x:roadblocks[i].x, y:roadblocks[i].y,z:-2},
  939. scale:{x:12,y:12,z:12},
  940. rotation: {x:Math.PI,y:0,z:roadblocks[i].angle}
  941. });
  942. }
  943.  
  944. lastfinished = 0;
  945. raceinprogress = true;
  946. raceStarted = false;
  947. finalCountdown=finalCountdownTime;
  948. DNFCountdown = DNFTime;
  949.  
  950. top1time.time = -1;
  951. top2time.time = -1;
  952. top3time.time = -1;
  953.  
  954. shipsInRace=0;
  955. startingGrid=[];
  956.  
  957. for (i=0;i<game.ships.length;i++)
  958. {
  959. ship = game.ships[i];
  960. if(!ship)continue;
  961. if(!ship.custom.ready)continue;
  962. if(ship.custom.ignoreMod)continue;
  963. if(ship.custom.ignoreSelf)continue;
  964. drawSpectateButton(ship, false);
  965. shipsInRace++;
  966. startingGrid.push(i);
  967. ship.custom.lap = 0;
  968. ship.custom.inrace = true;
  969. ship.custom.checkpoint = 0;
  970. ship.custom.lasttime = -1;
  971. drawShipChooseButtons(ship, false);
  972. drawReadyButton(ship, false);
  973. drawIgnoreMeButton(ship, false);
  974. drawTopScores(ship, false);
  975. writeShipInfo(ship, false);
  976. writeTrackInfo(ship, false);
  977. }
  978.  
  979. while(Math.random()>0.01){
  980. i1 = Math.floor(Math.random()*startingGrid.length);
  981. i2 = Math.floor(Math.random()*startingGrid.length);
  982. buffer = startingGrid[i1];
  983. startingGrid[i1] = startingGrid[i2];
  984. startingGrid[i2] = buffer;
  985. }
  986.  
  987. for (i=0;i<startingGrid.length;i++)
  988. {
  989. ship = game.ships[startingGrid[i]];
  990. if(!ship)continue;
  991. if(!ship.custom.ready)continue;
  992. if(ship.custom.ignoreMod)continue;
  993. if(ship.custom.ignoreSelf)continue;
  994. ship.custom.gridPos = i;
  995. }
  996. log(firstCheckpointAngle);
  997. firstCheckpointAngle=Math.PI-(Math.PI/2+firstCheckpointAngle);
  998.  
  999. log("Race started!");
  1000. }else{
  1001. log("Race already started");
  1002. }
  1003. }
  1004.  
  1005. stopRace = function(){
  1006. if(raceinprogress){
  1007. game.removeObject();
  1008. showBanners();
  1009. raceinprogress = false;
  1010. racetime = 0;
  1011. countdown = quickRaceStartTime;
  1012. countdownLong = longRaceStartTime;
  1013. lastfinished = 0;
  1014. nextTrack = Math.floor(Math.random()*tracks.length);
  1015. for (i=0;i<game.ships.length;i++)
  1016. {
  1017. ship = game.ships[i];
  1018. if(!ship)continue;
  1019. drawRaceTrack(ship, false);
  1020. ship.custom.checkpoint = 0;
  1021. ship.custom.ready = false;
  1022. drawReadyButton(ship, true);
  1023. drawIgnoreMeButton(ship, true);
  1024. writeTrackInfo(ship, true);
  1025. drawSpectateButton(ship, false);
  1026. ship.custom.inrace = false;
  1027. ship.custom.dislikeTrack = false;
  1028. ship.custom.spectating = -1;
  1029. writeTextSmol(ship,"Press U when ready.");
  1030. }
  1031. log("Race stopped.");
  1032. }else{
  1033. log("No race in progress");
  1034. }
  1035. }
  1036.  
  1037. showBanners();
  1038.  
  1039. this.tick = function(game) {
  1040. if(game.ships.length<1)return;
  1041. var i = 0;
  1042. if(raceinprogress)
  1043. racetime += 1/60;
  1044. everySecond++;
  1045. if(everySecond>60){
  1046. everySecond-=60;
  1047. adTimer++;
  1048.  
  1049. if(adTimer>adRefreshTime){
  1050. adTimer = 0;
  1051. randomAd();
  1052. }
  1053.  
  1054.  
  1055. //ship initialization
  1056. for (i=0;i<game.ships.length;i++)
  1057. {
  1058. ship = game.ships[i];
  1059. if(!ship)continue;
  1060. if (!ship.custom.init){
  1061. //this is a new ship, we have to set it up
  1062. ship.custom.init = true;
  1063. ship.custom.inrace = false;
  1064. ship.custom.checkpoint = 0;
  1065. ship.custom.lasttime = -1;
  1066. ship.custom.type = 0;
  1067. ship.custom.ready = false;
  1068. ship.custom.lap = 0;
  1069. ship.custom.dislikeTrack = false;
  1070. ship.custom.ignoreSelf = false;
  1071. ship.custom.ignoreMod = false;
  1072. ship.custom.spectating = -1;
  1073. ship.set({
  1074. x:sandboxArea.x-(sandboxAreaSize/8)+(sandboxAreaSize/4)*Math.random(),
  1075. y:sandboxArea.y-(sandboxAreaSize/8)+(sandboxAreaSize/4)*Math.random()
  1076. });
  1077. drawReadyButton(ship, true);
  1078. drawIgnoreMeButton(ship, true);
  1079. writeTrackInfo(ship, true);
  1080. //tell them what to do
  1081. if(!raceinprogress) writeTextSmol(ship,"Press U when ready.");
  1082. }
  1083. if(!ship.custom.inrace&&ship.custom.spectating==-1)
  1084. ship.set({type:101+ship.custom.type, stats:100011111});
  1085. //no fighting for now
  1086. ship.set({invulnerable:400});
  1087. if(!ship.alive){
  1088. x = 0;
  1089. y = 0;
  1090. if(ship.custom.inrace){
  1091. if(ship.custom.checkpoint == 0){
  1092. x = checkpoints[0].x;
  1093. y = checkpoints[0].y;
  1094. }else{
  1095. ch = ship.custom.checkpoint-1;
  1096. x = checkpoints[ch].x;
  1097. y = checkpoints[ch].y;
  1098. }
  1099. }else{
  1100. x = sandboxArea.x;
  1101. y = sandboxArea.y;
  1102. }
  1103. ship.set({x:x, y:y});
  1104. }
  1105. if(ship.custom.ignoreMod){
  1106. ship.set({score:0,x:cornerOfShame.x, y:cornerOfShame.y,idle:true})
  1107. writeTextLarge(ship, "SHAME");
  1108. }else{
  1109. ship.set({idle:false});
  1110. }
  1111. if(ship.custom.ignoreSelf){
  1112. writeTextLarge(ship, "You're AFK. Press [I] to continue racing.");
  1113. }
  1114. }
  1115.  
  1116. //if there is a race going on
  1117. if(raceinprogress){
  1118. finalCountdown -= 1; //countdown at the start of the race
  1119. noActivityCountdown -= 1;
  1120. ready = true; //whether the race is over
  1121. for (i=0;i<game.ships.length;i++) //iterate
  1122. {
  1123. ship = game.ships[i];
  1124. if(!ship)continue;
  1125. if(ship.custom.ignoreMod)continue;
  1126. if(!ship.custom.inrace){
  1127. if(ship.custom.spectating>-1){
  1128. if(game.ships[ship.custom.spectating].custom.inrace){
  1129. ship.set({
  1130. x:game.ships[ship.custom.spectating].x,
  1131. y:game.ships[ship.custom.spectating].y,
  1132. vx:game.ships[ship.custom.spectating].vx,
  1133. vy:game.ships[ship.custom.spectating].vy,
  1134. idle:true
  1135. })
  1136. }
  1137. }
  1138. //this ship either finished or just joined, tell them
  1139. drawShipChooseButtons(ship, true);
  1140. drawSpectateButton(ship, true);
  1141. writeTextSmol(ship,"Wait until all players finish the race ("+lastfinished+" so far) or wait " + DNFCountdown + " seconds");
  1142. x = sandboxArea.x-ship.x;
  1143. y = sandboxArea.y-ship.y;
  1144. if(ship.custom.spectating==-1&&distance(x,y)>sandboxAreaSize)
  1145. ship.set({
  1146. score:0,
  1147. x:sandboxArea.x-(sandboxAreaSize/8)+(sandboxAreaSize/4)*Math.random(),
  1148. y:sandboxArea.y-(sandboxAreaSize/8)+(sandboxAreaSize/4)*Math.random()
  1149. })
  1150. continue;
  1151. }
  1152.  
  1153. //there are still players racing, so we're not ready to end the race
  1154. ready = false;
  1155.  
  1156. //starting countdown
  1157. if(finalCountdown>=0){
  1158. noActivityCountdown = noActivityTime;
  1159. //get the direction to the first checkpoint, normalized
  1160. dist = distance(firstCheckpointDir[0],firstCheckpointDir[1]);
  1161. x = firstCheckpointDir[0]/dist;
  1162. y = firstCheckpointDir[1]/dist;
  1163. //launchvel represent the initial boop the ships experience when
  1164. //the countdown is over
  1165. launchvel = 40;
  1166. //get a vector perpendicular to the direction to the first checkpoint
  1167. perpY = x;
  1168. perpX = -y;
  1169.  
  1170. vx = 0;
  1171. vy = 0;
  1172. //launch the player as the race starts
  1173. if(finalCountdown<1){
  1174. raceStarted = true;
  1175. racetime = 0;
  1176. writeTextLarge(ship,"GO GO GO");
  1177. vx = x*launchVel;
  1178. vy = y*launchVel;
  1179. }else
  1180. //output the final countdown
  1181. writeTextLarge(ship,""+finalCountdown);
  1182. posInLine = ship.custom.gridPos%shipsInLine;
  1183. line = Math.floor(ship.custom.gridPos/shipsInLine);
  1184.  
  1185. //keep the player at the starting line
  1186. ship.set({
  1187. idle:true,
  1188. x:checkpoints[0].x-perpX*(startingLinesWidth/2) + perpX*(startingLinesWidth)*(posInLine/(shipsInLine-1))+(-x*line*startingLinesDist),
  1189. y:checkpoints[0].y-perpY*(startingLinesWidth/2) + perpY*(startingLinesWidth)*(posInLine/(shipsInLine-1))+(-y*line*startingLinesDist),
  1190. vx:0,
  1191. vy:0,
  1192. angle:57.2958*firstCheckpointAngle
  1193. });
  1194. }
  1195.  
  1196. //update the race track minimap
  1197. drawRaceTrack(ship, true);
  1198. }
  1199. if(lastfinished>0)DNFCountdown--;
  1200. if(ready||(lastfinished>0&&DNFCountdown<0)||noActivityCountdown<0){
  1201. if(ready)
  1202. log("All players finished");
  1203. else if(DNFCountdown<0) log("Race ends - timeout"); else
  1204. log("Race ends - no activity");
  1205. stopRace();
  1206. }
  1207.  
  1208. }else{
  1209.  
  1210.  
  1211. if(dislikedBy>0.5*readyAmount){
  1212. nt = nextTrack
  1213. nextTrack = Math.floor(Math.random()*tracks.length);
  1214. while(tracks.length>1&&nt==nextTrack){
  1215. nextTrack = Math.floor(Math.random()*tracks.length);
  1216. }
  1217. for (i=0;i<game.ships.length;i++)
  1218. {
  1219. ship = game.ships[i];
  1220. if(!ship)continue;
  1221. ship.custom.dislikeTrack = false;
  1222.  
  1223. }
  1224. }
  1225.  
  1226. //whether all players are ready
  1227. ready = true;
  1228. lastReadyAmount = readyAmount;
  1229. //whether there's at least one fool that wants a race
  1230. atLeastOnePlayer = false;
  1231. readyAmount = 0;
  1232. dislikedBy = 0;
  1233.  
  1234. for (i=0;i<game.ships.length;i++)
  1235. {
  1236. ship = game.ships[i];
  1237. if(!ship)continue;
  1238. ship.custom.spectating = -1;
  1239. if(ship.custom.ignoreMod)continue;
  1240. if(ship.custom.ignoreSelf)continue;
  1241. //check if the ship is in range of starting checkpoint
  1242. x = checkpoints[0].x-ship.x;
  1243. y = checkpoints[0].y-ship.y;
  1244. writeTrackInfo(ship, true);
  1245. if(!ship.custom.ready){
  1246. //if not, then clearly not all players are ready
  1247. ready = false;
  1248. drawShipChooseButtons(ship, true);
  1249. if(countdownLong<longRaceStartTime-1)
  1250. writeTextLarge(ship,"Race starts in "+Math.max(countdown,countdownLong)+" - YOU ARE NOT READY [U]");
  1251. else writeTextLarge(ship, "");
  1252. continue;
  1253. }else atLeastOnePlayer = true;//otherwise at least somebody's willing to race
  1254. //countdownLong overrides countdown
  1255.  
  1256. if(ship.custom.dislikeTrack)
  1257. dislikedBy++;
  1258. readyAmount++;
  1259.  
  1260. writeTrackInfo(ship, true);
  1261.  
  1262. if(countdownLong<countdown)countdown=countdownLong;
  1263.  
  1264. //if the countdown is at maximum, we're probably still waiting for players
  1265. if(countdown>=quickRaceStartTime-1)
  1266. writeTextLarge(ship,"Waiting for other players... "+countdownLong+" ("+lastReadyAmount+" ready)");
  1267. //otherwise we're starting soon
  1268. if(countdown<quickRaceStartTime-1)writeTextLarge(ship,"Starting in "+countdown+" seconds...");
  1269. //if the countdown finished successfuly
  1270. if(countdown<0||countdownLong<0){
  1271. startRace();
  1272. }
  1273. }
  1274.  
  1275. if(atLeastOnePlayer)countdownLong-=1; else{
  1276. countdownLong = longRaceStartTime;
  1277. }
  1278. if(ready&&atLeastOnePlayer)countdown-=1; else{
  1279. countdown = quickRaceStartTime;
  1280. }
  1281.  
  1282. }
  1283.  
  1284. }
  1285.  
  1286. if(game.step%1==0){
  1287.  
  1288. if(raceinprogress){
  1289. for (i=0;i<game.ships.length;i++)
  1290. {
  1291. ship = game.ships[i];
  1292. if(!ship)continue;
  1293. if(!ship.custom.inrace)continue;
  1294.  
  1295. //checkpoint execution
  1296. ch = ship.custom.checkpoint;
  1297. x = checkpoints[ch].x-ship.x;
  1298. y = checkpoints[ch].y-ship.y;
  1299. //if we're in range of the next checkpoint
  1300. if(distance(x, y)<checkpointrange){
  1301.  
  1302. //proceed to the next checkpoint
  1303. ship.custom.checkpoint=ship.custom.checkpoint+1;
  1304. if(ship.custom.lap>highestCheckpoint[0]){
  1305. highestCheckpoint[0] = ship.custom.lap;
  1306. highestCheckpoint[1] = ship.custom.checkpoint;
  1307. }else if(ship.custom.lap==highestCheckpoint[0]&&ship.custom.checkpoint>highestCheckpoint[1]){
  1308. highestCheckpoint[1] = ship.custom.checkpoint;
  1309. }
  1310. noActivityCountdown = noActivityTime;
  1311.  
  1312. //if this is the last checkpoint
  1313. if(ship.custom.checkpoint>=checkpoints.length){
  1314. if(ship.custom.lap<laps-1){
  1315. ship.custom.lap++;
  1316. ship.custom.checkpoint = 0;
  1317. }else{
  1318. //if this is the first ship to finish, start the DNF countdown
  1319. if(lastfinished==0)DNFCountdown = DNFTime;
  1320. lastfinished++;
  1321. if(lastfinished==1){top1time.name = ship.name; top1time.time = racetime;}
  1322. if(lastfinished==2){top2time.name = ship.name; top2time.time = racetime;}
  1323. if(lastfinished==3){top3time.name = ship.name; top3time.time = racetime;}
  1324. log("#"+lastfinished+" - "+ship.name+" - "+racetime + " s");
  1325. writeTextLarge(ship,"Your place: "+lastfinished+" in "+racetime.toFixed(2)+"s");
  1326. ship.custom.inrace=false;
  1327. ship.custom.checkpoint = 0;
  1328. ship.custom.lasttime = racetime;
  1329. for (j=0;j<game.ships.length;j++)
  1330. drawTopScores(game.ships[j], true);
  1331. ship.set({score:(checkpoints.length*10000)-(lastfinished*1000)});
  1332. }
  1333. }else{
  1334. ship.set({score:ship.custom.checkpoint*1000+checkpoints.length*ship.custom.lap*1000});
  1335. writeTextLarge(ship," ");
  1336. if(ship.custom.checkpoint > 1||ship.custom.lap>0){
  1337. if(laps>0)
  1338. lapText = "(lap "+(ship.custom.lap+1)+"/"+laps+")";
  1339. writeTextSmol(ship,"Checkpoint "+ ship.custom.checkpoint + "/"+checkpoints.length+" "+lapText);
  1340. } else {
  1341. writeTextSmol(ship,"Follow the red dot.");
  1342. }
  1343. }
  1344. }
  1345. }
  1346. for (i=0;i<game.ships.length;i++)
  1347. {
  1348. ship = game.ships[i];
  1349. if(!ship)continue;
  1350. if(!ship.custom.inrace)continue;
  1351. if(ship.custom.lap==highestCheckpoint[0]&&ship.custom.checkpoint==highestCheckpoint[1])
  1352. ship.set({stats:100000000});
  1353. else ship.set({stats:100011111});
  1354. }
  1355. }
  1356. }
  1357.  
  1358. // do mod stuff here ; see documentation
  1359. if (game.step%10==0) // ensure this is done only once per second
  1360. {
  1361. for (i=0;i<game.ships.length;i++)
  1362. {
  1363. ship = game.ships[i];
  1364. if(!ship)continue;
  1365. if(!ship.custom.inrace)continue;
  1366. ch = ship.custom.checkpoint;
  1367. if(ch>=checkpoints.length)continue;
  1368. path = shortestPath(ship.x, ship.y, checkpoints[ch].x, checkpoints[ch].y);
  1369. x = path[0];
  1370. y = path[1];
  1371. vis = true;
  1372. if(distance(x, y)<checkpointrange)
  1373. vis = false;
  1374. xx = 25*x/distance(x, y);
  1375. yy = 25*y/distance(x, y);
  1376. ship.setUIComponent({
  1377. id:"nextCh",
  1378. position:[50+xx,50-yy,25,25],
  1379. clickable: false,
  1380. visible: vis,
  1381. components: [
  1382. { type:"round",position:[0,0,5,10],fill:"#ff0000",stroke:"#CDE",width:1}
  1383. ]
  1384. });
  1385.  
  1386. }
  1387.  
  1388. }
  1389. };
  1390.  
  1391. this.event = function(event,game) {
  1392. switch (event.name)
  1393. {
  1394. case "ui_component_clicked":
  1395. var ship = event.ship;
  1396. var component = event.id;
  1397. if (component == "nextship")
  1398. {
  1399. ship.custom.type++;
  1400. if(ship.custom.type>=racingShipsAmount)
  1401. ship.custom.type = 0;
  1402. writeShipInfo(ship, !ship.custom.inrace);
  1403. }
  1404. if (component == "prevship")
  1405. {
  1406. ship.custom.type--;
  1407. if(ship.custom.type<0)
  1408. ship.custom.type = racingShipsAmount-1;
  1409. writeShipInfo(ship, !ship.custom.inrace);
  1410. }
  1411. if (component == "readyToggle"){
  1412. ship.custom.ready = !ship.custom.ready;
  1413. drawReadyButton(ship, !ship.custom.inrace);
  1414. }
  1415. if (component == "ignoreMeToggle"){
  1416. ship.custom.ignoreSelf = !ship.custom.ignoreSelf;
  1417. drawIgnoreMeButton(ship, !ship.custom.inrace);
  1418. }
  1419. if (component == "trackInfo"){
  1420. ship.custom.dislikeTrack = !ship.custom.dislikeTrack;
  1421. writeTrackInfo(ship, !ship.custom.inrace);
  1422. }
  1423. if (component == "spectateToggle"){
  1424. if(!ship.custom.inrace){
  1425.  
  1426. if(ship.custom.spectating == -1){
  1427. for (i=0;i<game.ships.length;i++)
  1428. {
  1429. ship1 = game.ships[i];
  1430. if(!ship1)continue;
  1431. if(ship1.custom.inrace){
  1432. ship.custom.spectating = i;
  1433. break;
  1434. }
  1435. }
  1436.  
  1437. ship.set({type:301});
  1438. }else ship.custom.spectating = -1;
  1439. }
  1440. }
  1441. if (component == "spectateNext"){
  1442. if(!ship.custom.inrace&&ship.custom.spectating!=-1){
  1443. i = ship.custom.spectating;
  1444. while(true){
  1445. i++;
  1446. if(i>=game.ships.length) i = 0;
  1447. if(i==ship.custom.spectating)break;
  1448. if(game.ships[i].custom.inrace){
  1449. ship.custom.spectating = i;
  1450. break;
  1451. }
  1452. }
  1453. }
  1454. }
  1455.  
  1456. break;
  1457. }
  1458. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement