Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.16 KB | None | 0 0
  1. var roomName = "🌙 ITALIAN DEERS VPS 🌙";
  2. var maxPlayers = 14;
  3. var roomPublic = false;
  4. var playerName = "PetitDiable";
  5.  
  6. /* STADIUM */
  7. //Les valeures suivantes sont celles de la hauteur lors du match - Les valeures par défault sont celles de la map RS
  8. var stadiumWidth = 1150;
  9. var stadiumHeight = 600;
  10. var radiusBall = 9.8;
  11. var throwInLeeway = 350;
  12. var greenLine = 510;
  13.  
  14. /* SETTINGS */
  15.  
  16. var triggerDistance = radiusBall + 15 + 0.01;
  17. var outLineY = stadiumWidth - (radiusBall / 2) + 6;
  18. stadiumWidth += (radiusBall / 2) + 6;
  19. stadiumHeight += (radiusBall / 2) + 6;
  20.  
  21. var Team = {
  22. SPECTATORS: 0,
  23. RED: 1,
  24. BLUE: 2
  25. };
  26. var lastScores = 0;
  27. var lastTeamTouched = 0;
  28. var lineBallPosition;
  29. var exitingPos = null;
  30. var previousBallPos;
  31. var assistingTouch = "";
  32. var lastPlayerTouched = "";
  33. var lat = 52;
  34. var long = 21;
  35. var backMSG = false;
  36. var lastCall;
  37. var isBallUp = false;
  38. var crossed = false;
  39. var isTimeAddedShown = false;
  40. var lineCrossedPlayers = [{name: "temp", times: 0}];
  41. var isBallKickedOutside = false;
  42. var previousPlayerTouched;
  43. var timeOutside = 0;
  44. var room = HBInit({ roomName: roomName, maxPlayers: maxPlayers, public: roomPublic, playerName: playerName, geo: {"code": "FR", "lat": lat, "lon": long }});
  45. room.setScoreLimit(0);
  46. room.setTimeLimit(0);
  47. var RSHLMap = `{
  48.  
  49. "name" : "Real Soccer 1.3D by RawR",
  50.  
  51. "width" : 1300,
  52.  
  53. "height" : 670,
  54.  
  55. "spawnDistance" : 500,
  56.  
  57. "bg" : { "type" : "grass", "width" : 1150, "height" : 600, "kickOffRadius" : 180, "cornerRadius" : 0 },
  58.  
  59. "playerPhysics" : {
  60. "bCoef" : 0.5,
  61. "invMass" : 0.5,
  62. "damping" : 0.96,
  63. "acceleration" : 0.12,
  64. "kickingAcceleration" : 0.07,
  65. "kickingDamping" : 0.96,
  66. "kickStrength" : 5.65
  67.  
  68. },
  69.  
  70. "vertexes" : [
  71. /* 0 */ { "x" : 0, "y" : 700, "trait" : "kickOffBarrier" },
  72. /* 1 */ { "x" : 0, "y" : 180, "trait" : "kickOffBarrier" },
  73. /* 2 */ { "x" : 0, "y" : -180, "trait" : "kickOffBarrier" },
  74. /* 3 */ { "x" : 0, "y" : -700, "trait" : "kickOffBarrier" },
  75.  
  76. /* 4 */ { "x" : 1150, "y" : 255, "trait" : "line" },
  77. /* 5 */ { "x" : 840, "y" : 255, "trait" : "line" },
  78. /* 6 */ { "x" : 1150, "y" : -255, "trait" : "line" },
  79. /* 7 */ { "x" : 840, "y" : -255, "trait" : "line" },
  80. /* 8 */ { "x" : 1150, "y" : 155, "trait" : "line" },
  81. /* 9 */ { "x" : 1030, "y" : 155, "trait" : "line" },
  82. /* 10 */ { "x" : 1150, "y" : -155, "trait" : "line" },
  83. /* 11 */ { "x" : 1030, "y" : -155, "trait" : "line" },
  84. /* 12 */ { "x" : 840, "y" : -135, "trait" : "line", "curve" : -130 },
  85. /* 13 */ { "x" : 840, "y" : 135, "trait" : "line", "curve" : -130 },
  86. /* 14 */ { "x" : -1150, "y" : -255, "trait" : "line", "curve" : -90, "color" : "97AC86" },
  87. /* 15 */ { "x" : -840, "y" : -255, "trait" : "line" },
  88. /* 16 */ { "x" : -1150, "y" : 255, "trait" : "line" },
  89. /* 17 */ { "x" : -840, "y" : 255, "trait" : "line" },
  90. /* 18 */ { "x" : -1150, "y" : -155, "trait" : "line" },
  91. /* 19 */ { "x" : -1030, "y" : -155, "trait" : "line" },
  92. /* 20 */ { "x" : -1150, "y" : 155, "trait" : "line" },
  93. /* 21 */ { "x" : -1030, "y" : 155, "trait" : "line" },
  94. /* 22 */ { "x" : -840, "y" : 135, "trait" : "line", "curve" : -130 },
  95. /* 23 */ { "x" : -840, "y" : -135, "trait" : "line", "curve" : -130 },
  96. /* 24 */ { "x" : 935, "y" : 4, "trait" : "line" },
  97. /* 25 */ { "x" : 935, "y" : -4, "trait" : "line" },
  98. /* 26 */ { "x" : -935, "y" : 4, "trait" : "line" },
  99. /* 27 */ { "x" : -935, "y" : -4, "trait" : "line" },
  100. /* 28 */ { "x" : -1150, "y" : 525, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  101. /* 29 */ { "x" : -1075, "y" : 600, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line", "_selected" : true },
  102. /* 30 */ { "x" : -1075, "y" : -600, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  103. /* 31 */ { "x" : -1150, "y" : -525, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  104. /* 32 */ { "x" : 1075, "y" : 600, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  105. /* 33 */ { "x" : 1150, "y" : 525, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  106. /* 34 */ { "x" : 1150, "y" : -525, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  107. /* 35 */ { "x" : 1075, "y" : -600, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  108. /* 36 */ { "x" : -1150, "y" : 127, "trait" : "line", "color" : "ffffff" },
  109. /* 37 */ { "x" : -1214, "y" : 124, "trait" : "line", "color" : "ffffff", "curve" : 5 },
  110. /* 38 */ { "x" : -1150, "y" : -127, "trait" : "line", "color" : "ffffff" },
  111. /* 39 */ { "x" : -1214, "y" : -124, "trait" : "line", "color" : "ffffff", "curve" : 5 },
  112. /* 40 */ { "x" : 1150, "y" : 127, "trait" : "line", "color" : "ffffff" },
  113. /* 41 */ { "x" : 1214, "y" : 124, "trait" : "line", "color" : "ffffff", "curve" : -5 },
  114. /* 42 */ { "x" : 1150, "y" : -127, "trait" : "line", "color" : "ffffff" },
  115. /* 43 */ { "x" : 1214, "y" : -124, "trait" : "line", "color" : "ffffff", "curve" : -5 },
  116. /* 44 */ { "x" : 0, "y" : -4, "trait" : "line" },
  117. /* 45 */ { "x" : 0, "y" : 4, "trait" : "line" },
  118. /* 46 */ { "x" : 0, "y" : -4, "trait" : "line" },
  119. /* 47 */ { "x" : 0, "y" : 4, "trait" : "line" },
  120. /* 48 */ { "x" : -1214, "y" : 124, "trait" : "line", "color" : "ffffff" },
  121. /* 49 */ { "x" : -1250, "y" : 150, "trait" : "line", "color" : "ffffff", "pos" : [-1250,150 ] },
  122. /* 50 */ { "x" : -1214, "y" : -124, "trait" : "line", "color" : "ffffff" },
  123. /* 51 */ { "x" : -1250, "y" : -150, "trait" : "line", "color" : "ffffff", "pos" : [-1250,-150 ] },
  124. /* 52 */ { "x" : 1214, "y" : 124, "trait" : "line", "color" : "ffffff" },
  125. /* 53 */ { "x" : 1250, "y" : 150, "trait" : "line", "color" : "ffffff" },
  126. /* 54 */ { "x" : 1214, "y" : -124, "trait" : "line", "color" : "ffffff" },
  127. /* 55 */ { "x" : 1250, "y" : -150, "trait" : "line", "color" : "ffffff" },
  128. /* 56 */ { "x" : -1185, "y" : 155, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : 40, "color" : "BEB86C" },
  129. /* 57 */ { "x" : -1185, "y" : 255, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : 40, "color" : "BEB86C" },
  130. /* 58 */ { "x" : 1185, "y" : 155, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : -40, "color" : "BEB86C" },
  131. /* 59 */ { "x" : 1185, "y" : 255, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : -40, "color" : "BEB86C" },
  132. /* 60 */ { "x" : -1185, "y" : -155, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : -40, "color" : "BEB86C" },
  133. /* 61 */ { "x" : -1185, "y" : -255, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : -40, "color" : "BEB86C" },
  134. /* 62 */ { "x" : 1185, "y" : -155, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : 40, "color" : "BEB86C" },
  135. /* 63 */ { "x" : 1185, "y" : -255, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : 40, "color" : "BEB86C" },
  136. /* 64 */ { "x" : 1158, "y" : -607, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 0, "color" : "BEB86C" },
  137. /* 65 */ { "x" : 1187, "y" : -578, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : -60, "color" : "BEB86C" },
  138. /* 66 */ { "x" : 1158, "y" : 607, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 0, "color" : "BEB86C" },
  139. /* 67 */ { "x" : 1187, "y" : 578, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 60, "color" : "BEB86C" },
  140. /* 68 */ { "x" : -1158, "y" : 607, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 0, "color" : "BEB86C" },
  141. /* 69 */ { "x" : -1187, "y" : 578, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : -60, "color" : "BEB86C" },
  142. /* 70 */ { "x" : -1158, "y" : -607, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 0, "color" : "BEB86C" },
  143. /* 71 */ { "x" : -1187, "y" : -578, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 60, "color" : "BEB86C" },
  144. /* 72 */ { "x" : -1190, "y" : -255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  145. /* 73 */ { "x" : -1180, "y" : -255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  146. /* 74 */ { "x" : -1190, "y" : -155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  147. /* 75 */ { "x" : -1180, "y" : -155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  148. /* 76 */ { "x" : -1190, "y" : 155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  149. /* 77 */ { "x" : -1180, "y" : 155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  150. /* 78 */ { "x" : -1190, "y" : 255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  151. /* 79 */ { "x" : -1180, "y" : 255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  152. /* 80 */ { "x" : 1190, "y" : -255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  153. /* 81 */ { "x" : 1180, "y" : -255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  154. /* 82 */ { "x" : 1190, "y" : -155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  155. /* 83 */ { "x" : 1180, "y" : -155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  156. /* 84 */ { "x" : 1190, "y" : 255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  157. /* 85 */ { "x" : 1180, "y" : 255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  158. /* 86 */ { "x" : 1190, "y" : 155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  159. /* 87 */ { "x" : 1180, "y" : 155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
  160. /* 88 */ { "x" : -1148, "y" : -525, "trait" : "line", "curve" : -90, "color" : "5E844D" },
  161. /* 89 */ { "x" : 1148, "y" : -525, "trait" : "line", "color" : "5E844D" },
  162. /* 90 */ { "x" : -1148, "y" : 525, "trait" : "line", "curve" : -90, "color" : "5E844D" },
  163. /* 91 */ { "x" : 1148, "y" : 525, "trait" : "line", "color" : "5E844D" },
  164. /* 92 */ { "x" : -1150, "y" : -260, "trait" : "line", "curve" : -100, "color" : "5E844D" },
  165. /* 93 */ { "x" : -840, "y" : -600, "trait" : "line", "color" : "5E844D", "curve" : -100 },
  166. /* 94 */ { "x" : -1150, "y" : 260, "trait" : "line", "curve" : 100, "color" : "5E844D" },
  167. /* 95 */ { "x" : -840, "y" : 600, "trait" : "line", "color" : "5E844D", "curve" : 100 },
  168. /* 96 */ { "x" : -840, "y" : -1150, "trait" : "line", "color" : "5E844D", "curve" : -100 },
  169. /* 97 */ { "x" : 1150, "y" : -260, "trait" : "line", "curve" : 100, "color" : "5E844D" },
  170. /* 98 */ { "x" : 840, "y" : -600, "trait" : "line", "color" : "5E844D", "curve" : 100 },
  171. /* 99 */ { "x" : 1150, "y" : 260, "trait" : "line", "curve" : -100, "color" : "5E844D" },
  172. /* 100 */ { "x" : 840, "y" : 600, "trait" : "line", "color" : "5E844D", "curve" : -100 }
  173.  
  174. ],
  175.  
  176. "segments" : [
  177. { "v0" : 37, "v1" : 39, "curve" : 5, "color" : "ffffff", "trait" : "reargoalNetleft", "x" : -1210 },
  178.  
  179. { "v0" : 41, "v1" : 43, "curve" : -5, "color" : "ffffff", "trait" : "reargoalNetright" },
  180.  
  181. { "v0" : 4, "v1" : 5, "trait" : "line", "y" : 250 },
  182. { "v0" : 5, "v1" : 7, "trait" : "line", "x" : 840 },
  183. { "v0" : 6, "v1" : 7, "trait" : "line", "y" : -250 },
  184. { "v0" : 8, "v1" : 9, "trait" : "line", "y" : 150 },
  185. { "v0" : 9, "v1" : 11, "trait" : "line", "x" : 1030 },
  186. { "v0" : 10, "v1" : 11, "trait" : "line", "y" : -150 },
  187. { "v0" : 12, "v1" : 13, "curve" : -130, "trait" : "line", "x" : 840 },
  188. { "v0" : 14, "v1" : 15, "trait" : "line", "y" : -250 },
  189. { "v0" : 15, "v1" : 17, "trait" : "line", "x" : -840 },
  190. { "v0" : 16, "v1" : 17, "trait" : "line", "y" : 250 },
  191. { "v0" : 18, "v1" : 19, "trait" : "line", "y" : -150 },
  192. { "v0" : 19, "v1" : 21, "trait" : "line", "x" : -1030 },
  193. { "v0" : 20, "v1" : 21, "trait" : "line", "y" : 150 },
  194. { "v0" : 22, "v1" : 23, "curve" : -130, "trait" : "line", "x" : -840 },
  195. { "v0" : 24, "v1" : 25, "curve" : -180, "trait" : "line", "x" : 935 },
  196. { "v0" : 26, "v1" : 27, "curve" : -180, "trait" : "line", "x" : -935 },
  197. { "v0" : 24, "v1" : 25, "curve" : 180, "trait" : "line", "x" : 935 },
  198. { "v0" : 26, "v1" : 27, "curve" : 180, "trait" : "line", "x" : -935 },
  199. { "v0" : 24, "v1" : 25, "curve" : 90, "trait" : "line", "x" : 935 },
  200. { "v0" : 26, "v1" : 27, "curve" : 90, "trait" : "line", "x" : -935 },
  201. { "v0" : 24, "v1" : 25, "curve" : -90, "trait" : "line", "x" : 935 },
  202. { "v0" : 26, "v1" : 27, "curve" : -90, "trait" : "line", "x" : -935 },
  203. { "v0" : 24, "v1" : 25, "trait" : "line", "x" : 935 },
  204. { "v0" : 26, "v1" : 27, "trait" : "line", "x" : -935 },
  205. { "v0" : 28, "v1" : 29, "curve" : 90, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  206. { "v0" : 30, "v1" : 31, "curve" : 90, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  207. { "v0" : 32, "v1" : 33, "curve" : 90, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  208. { "v0" : 34, "v1" : 35, "curve" : 90, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
  209.  
  210. { "v0" : 36, "v1" : 37, "curve" : 5, "color" : "ffffff", "trait" : "sidegoalNet" },
  211. { "v0" : 38, "v1" : 39, "curve" : -5, "color" : "ffffff", "trait" : "sidegoalNet" },
  212. { "v0" : 40, "v1" : 41, "curve" : -5, "color" : "ffffff", "trait" : "sidegoalNet" },
  213. { "v0" : 42, "v1" : 43, "curve" : 5, "color" : "ffffff", "trait" : "sidegoalNet" },
  214.  
  215. { "v0" : 44, "v1" : 45, "curve" : -180, "trait" : "line" },
  216. { "v0" : 46, "v1" : 47, "curve" : 180, "trait" : "line" },
  217. { "v0" : 44, "v1" : 45, "curve" : -90, "trait" : "line" },
  218. { "v0" : 46, "v1" : 47, "curve" : 90, "trait" : "line" },
  219. { "v0" : 48, "v1" : 49, "color" : "ffffff", "trait" : "line" },
  220. { "v0" : 50, "v1" : 51, "color" : "ffffff", "trait" : "line" },
  221. { "v0" : 52, "v1" : 53, "color" : "ffffff", "trait" : "line" },
  222. { "v0" : 54, "v1" : 55, "color" : "ffffff", "trait" : "line" },
  223. { "v0" : 56, "v1" : 57, "curve" : 40, "vis" : true, "color" : "BEB86C", "bCoef" : -4.7, "cMask" : ["ball" ], "trait" : "line", "x" : -1220 },
  224. { "v0" : 58, "v1" : 59, "curve" : -40, "vis" : true, "color" : "BEB86C", "bCoef" : -4.7, "cMask" : ["ball" ], "trait" : "line", "x" : 1220 },
  225. { "v0" : 60, "v1" : 61, "curve" : -40, "vis" : true, "color" : "BEB86C", "bCoef" : -4.7, "cMask" : ["ball" ], "trait" : "line", "x" : -1220 },
  226. { "v0" : 62, "v1" : 63, "curve" : 40, "vis" : true, "color" : "BEB86C", "bCoef" : -4.7, "cMask" : ["ball" ], "trait" : "line", "x" : 1220 },
  227. { "v0" : 64, "v1" : 65, "curve" : -60, "vis" : true, "color" : "BEB86C", "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line" },
  228. { "v0" : 66, "v1" : 67, "curve" : 60, "vis" : true, "color" : "BEB86C", "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line" },
  229. { "v0" : 68, "v1" : 69, "curve" : -60, "vis" : true, "color" : "BEB86C", "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line" },
  230. { "v0" : 70, "v1" : 71, "curve" : 60, "vis" : true, "color" : "BEB86C", "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line" },
  231.  
  232. { "v0" : 0, "v1" : 1, "trait" : "kickOffBarrier" },
  233. { "v0" : 1, "v1" : 2, "curve" : 180, "cGroup" : ["blueKO" ], "trait" : "kickOffBarrier" },
  234. { "v0" : 1, "v1" : 2, "curve" : -180, "cGroup" : ["redKO" ], "trait" : "kickOffBarrier" },
  235. { "v0" : 2, "v1" : 3, "trait" : "kickOffBarrier" },
  236.  
  237. { "v0" : 72, "v1" : 73, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
  238. { "v0" : 74, "v1" : 75, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
  239. { "v0" : 76, "v1" : 77, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
  240. { "v0" : 78, "v1" : 79, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
  241. { "v0" : 80, "v1" : 81, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
  242. { "v0" : 82, "v1" : 83, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
  243. { "v0" : 84, "v1" : 85, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
  244. { "v0" : 86, "v1" : 87, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
  245. { "v0" : 88, "v1" : 89, "color" : "5E844D", "trait" : "line", "y" : -475 },
  246. { "v0" : 90, "v1" : 91, "color" : "5E844D", "trait" : "line", "y" : -475 },
  247. { "v0" : 92, "v1" : 93, "curve" : -100, "color" : "5E844D", "trait" : "line", "y" : -475 },
  248. { "v0" : 94, "v1" : 95, "curve" : 100, "color" : "5E844D", "trait" : "line", "y" : -475 },
  249. { "v0" : 97, "v1" : 98, "curve" : 100, "color" : "5E844D", "trait" : "line", "y" : -475 },
  250. { "v0" : 99, "v1" : 100, "curve" : -100, "color" : "5E844D", "trait" : "line", "y" : -475 }
  251.  
  252. ],
  253.  
  254. "goals" : [
  255. { "p0" : [-1160,-124 ], "p1" : [-1160,124 ], "team" : "red" },
  256. { "p0" : [1160,124 ], "p1" : [1160,-124 ], "team" : "blue" }
  257.  
  258. ],
  259.  
  260. "discs" : [
  261. { "pos" : [-1150,127 ], "color" : "FF0000", "bCoef" : 0.5, "trait" : "goalPost" },
  262. { "pos" : [-1150,-127 ], "color" : "FF0000", "bCoef" : 0.5, "trait" : "goalPost" },
  263. { "pos" : [1150,127 ], "color" : "0000FF", "bCoef" : 0.5, "trait" : "goalPost" },
  264. { "pos" : [1150,-127 ], "color" : "0000FF", "bCoef" : 0.5, "trait" : "goalPost" },
  265.  
  266. { "pos" : [-1250,150 ], "color" : "FF0000", "trait" : "stanchion" },
  267. { "pos" : [-1250,-150 ], "color" : "FF0000", "trait" : "stanchion" },
  268. { "pos" : [1250,150 ], "color" : "0000FF", "trait" : "stanchion", "x" : 1250 },
  269. { "pos" : [1250,-150 ], "color" : "0000FF", "trait" : "stanchion", "x" : 1250 },
  270.  
  271. { "radius" : 2, "invMass" : 0, "pos" : [-1150,-600 ], "color" : "FFFFFF", "bCoef" : -0.1, "cMask" : ["ball" ], "trait" : "goalPost" },
  272. { "radius" : 2, "invMass" : 0, "pos" : [-1150,600 ], "color" : "FFFFFF", "bCoef" : -0.1, "cMask" : ["ball" ], "trait" : "goalPost" },
  273. { "radius" : 2, "invMass" : 0, "pos" : [1150,-600 ], "color" : "FFFFFF", "bCoef" : -0.1, "cMask" : ["ball" ], "trait" : "goalPost" },
  274. { "radius" : 2, "invMass" : 0, "pos" : [1150,600 ], "color" : "FFFFFF", "bCoef" : -0.1, "cMask" : ["ball" ], "trait" : "goalPost" }
  275.  
  276. ],
  277.  
  278. "planes" : [
  279. { "normal" : [0,1 ], "dist" : -635, "bCoef" : 0, "trait" : "ballArea" },
  280. { "normal" : [0,-1 ], "dist" : -635, "bCoef" : 0, "trait" : "ballArea" },
  281.  
  282. { "normal" : [0,1 ], "dist" : -670, "bCoef" : 0 },
  283. { "normal" : [0,-1 ], "dist" : -670, "bCoef" : 0 },
  284. { "normal" : [1,0 ], "dist" : -1300, "bCoef" : 0 },
  285. { "normal" : [-1,0 ], "dist" : -1300, "bCoef" : 0.1 },
  286. { "normal" : [1,0 ], "dist" : -1214, "bCoef" : 0, "cMask" : ["ball" ] },
  287. { "normal" : [-1,0 ], "dist" : -1214, "bCoef" : 0, "cMask" : ["ball" ] }
  288.  
  289. ],
  290.  
  291. "traits" : {
  292. "ballArea" : { "vis" : false, "bCoef" : 0, "cMask" : ["ball" ] },
  293. "goalPost" : { "radius" : 5, "invMass" : 0, "bCoef" : 2 },
  294. "stanchion" : { "radius" : 3, "invMass" : 0, "bCoef" : 3, "cMask" : ["none" ] },
  295. "cornerflag" : { "radius" : 3, "invMass" : 0, "bCoef" : 0.5, "color" : "FFFF00", "cGroup" : [ ] },
  296. "reargoalNetleft" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball","red","blue" ], "curve" : 10, "color" : "C7E6BD" },
  297. "reargoalNetright" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball","red","blue" ], "curve" : -10, "color" : "C7E6BD" },
  298. "sidegoalNet" : { "vis" : true, "bCoef" : 1, "cMask" : ["ball","red","blue" ], "color" : "C7E6BD" },
  299. "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] },
  300. "line" : { "vis" : true, "cMask" : [ ], "color" : "C7E6BD" },
  301. "tunnel" : { "vis" : true, "cMask" : ["red","blue" ], "color" : "000000" },
  302. "advertising" : { "vis" : true, "cMask" : ["red","blue" ], "color" : "333333" },
  303. "teambench" : { "vis" : true, "cMask" : [ ], "color" : "000000" },
  304. "manager" : { "radius" : 15, "vis" : true, "cMask" : ["red","blue" ], "invMass" : 0, "color" : "333333" },
  305. "physio" : { "radius" : 15, "vis" : true, "cMask" : ["red","blue" ], "invMass" : 0, "color" : "666666" },
  306. "redsubs" : { "radius" : 15, "vis" : true, "cMask" : ["red","blue" ], "invMass" : 0, "color" : "E56E56" },
  307. "bluesubs" : { "radius" : 15, "vis" : true, "cMask" : ["red","blue" ], "invMass" : 0, "color" : "5689E5" }
  308.  
  309. },
  310.  
  311. "ballPhysics" : {
  312. "invMass" : 1.05,
  313. "radius" : 9.8
  314.  
  315. }
  316. }`;
  317.  
  318. room.setCustomStadium(RSHLMap);
  319.  
  320. room.onGameStart = function(player) {
  321. lineCrossedPlayers = [{name: "temp", times: 0}];
  322. lastScores = room.getScores().red + room.getScores().blue;
  323. timeOutside = 0;
  324. isTimeAddedShown = false;
  325. lineBallPosition = 0;
  326. }
  327.  
  328. room.onPlayerBallKick = function(player) {
  329. var ballPosition = room.getBallPosition();
  330. if(player.name!=lastPlayerTouched)
  331. {
  332. if(lastTeamTouched==player.team)
  333. {
  334. assistingTouch = lastPlayerTouched;
  335. }else assistingTouch = "";
  336. }
  337. previousPlayerTouched = lastPlayerTouched;
  338. lastPlayerTouched = player.name;
  339. lastTeamTouched = player.team;
  340. if(isBallOutsideStadium)
  341. {
  342. getPlayersNotWithinLine();
  343. }
  344. if(isBallOutsideStadium && ballPosition.y<0)
  345. {
  346. isBallKickedOutside = true;
  347. }else if(isBallOutsideStadium && ballPosition.y>0)
  348. {
  349. isBallKickedOutside = true;
  350. }else isBallKickedOutside = false;
  351. }
  352.  
  353. function isBallGoingUp() {
  354. previousBallPosForGoingUp = currentBallPosForGoingUp;
  355. currentBallPosForGoingUp = room.getBallPosition().y;
  356. if (previousBallPosForGoingUp - currentBallPosForGoingUp > 0.01) {
  357. isBallUp = 2;
  358. } else if (previousBallPosForGoingUp - currentBallPosForGoingUp < -0.01) {
  359.  
  360. isBallUp = 1;
  361. } else {
  362. isBallUp = 0;
  363. }
  364. }
  365.  
  366. function addedTime()
  367. {
  368. var ballPosition = room.getBallPosition();
  369. if(isOutsideStadium(ballPosition))
  370. {
  371. timeOutside++;
  372. return true;
  373. }
  374. }
  375.  
  376. function checkEnd() {
  377. var scores = room.getScores();
  378. if (scores.time > 590 && !isTimeAddedShown) {
  379. var actualTimeAdded = Math.round((timeOutside-(100*60))/120);
  380. if(actualTimeAdded<60&&actualTimeAdded>-1)
  381. {
  382. room.sendChat("ADDED TIME: + " + actualTimeAdded + " SECONDS");
  383. }else if(actualTimeAdded<0)
  384. {
  385. room.sendChat("NO ADDED TIME. (+0)");
  386. }else
  387. {
  388. room.sendChat("ADDED TIME: + 1 MINUTE");
  389. }
  390. isTimeAddedShown = true;
  391. }
  392. }
  393. var tickCount = 0;
  394. room.onGameTick = function() {
  395. isThrowInCorrect();
  396. getLastTouchTheBall();
  397. checkBallPosition();
  398. isBackRequired();
  399. hasBallLeftTheLine();
  400. addedTime();
  401. checkEnd();
  402. tickCount++;
  403. }
  404.  
  405. room.onPlayerJoin = function(player) {
  406. var players = room.getPlayerList();
  407. var adminNumber = 0;
  408. for (var i = 0; i < players.length; i++) {
  409. if (players[i].admin) {
  410. adminNumber++;
  411. }
  412. }
  413. if (adminNumber < 2) {
  414. room.setPlayerAdmin(players[1].id, true);
  415. }
  416. }
  417.  
  418. function isOutsideStadium(ballPosition) {
  419. return ballPosition.x > stadiumWidth || ballPosition.x < -stadiumWidth || ballPosition.y > stadiumHeight || ballPosition.y < -stadiumHeight;
  420. }
  421.  
  422. var isBallOutsideStadium = false;
  423.  
  424. function checkBallPosition() {
  425. var ballPosition = room.getBallPosition();
  426. if(isOutsideStadium(ballPosition)) {
  427. if(!isBallOutsideStadium) {
  428. isBallOutsideStadium = true;
  429. exitingPos = ballPosition.x;
  430. var totalScores = room.getScores().red + room.getScores().blue;
  431. if(lastScores != totalScores) {
  432. lastScores = totalScores;
  433. return false;
  434. }
  435. if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.RED || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.BLUE) {
  436. lastCall = "GK";
  437. room.sendChat("GK");
  438. }
  439. else if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.BLUE || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.RED) {
  440. room.sendChat("CK");
  441. lastCall = "CK";
  442. }
  443. else {
  444. isBallKickedOutside = false;
  445. room.sendChat(lastTeamTouched == Team.RED ? "B" : "R");
  446. lastCall = lastTeamTouched == Team.RED ? "2" : "1";
  447. }
  448.  
  449. }
  450. }
  451. else {
  452. isBallOutsideStadium = false;
  453. backMSG = true;
  454.  
  455. }
  456. return true;
  457. }
  458.  
  459. function getLastTouchTheBall() {
  460. var ballPosition = room.getBallPosition();
  461. var players = room.getPlayerList();
  462. for(var i = 0; i < players.length; i++) {
  463. if(players[i].position != null) {
  464. var distanceToBall = pointDistance(players[i].position, ballPosition);
  465. if(distanceToBall < triggerDistance) {
  466. if(lastPlayerTouched!=players[i].name)
  467. {
  468. if(lastTeamTouched==players[i].team)
  469. {
  470. assistingTouch = lastPlayerTouched;
  471. }else assistingTouch = "";
  472. }
  473. lastTeamTouched = players[i].team;
  474. previousPlayerTouched == lastPlayerTouched;
  475. lastPlayerTouched = players[i].name;
  476. }
  477. }
  478. }
  479. return lastPlayerTouched;
  480. }
  481.  
  482. function pointDistance(p1, p2) {
  483. var d1 = p1.x - p2.x;
  484. var d2 = p1.y - p2.y;
  485. return Math.sqrt(d1 * d1 + d2 * d2);
  486. }
  487. var playersNotInLine = new Array;
  488.  
  489. function getPlayersNotWithinLine() {
  490. playersNotInLine = new Array;
  491. var players = room.getPlayerList();
  492. for (var i = 0; i < players.length; i++) {
  493. if (players[i].position != null) {
  494. if (players[i].team != lastTeamTouched && players[i].team != lastCall && lastCall != "CK" && lastCall != "GK") {
  495. if ((players[i].position.y > greenLine || players[i].position.y < -greenLine) && pointDistance(room.getBallPosition(), players[i].position) < 500) {
  496. playersNotInLine.push(players[i].name);
  497. }
  498. }
  499.  
  500. }
  501. }
  502. }
  503. function checkPlayersLine() {
  504. for (var i = 0; i < playersNotInLine.length; i++)
  505. {
  506. var found = false;
  507. for (var j = 0; j < lineCrossedPlayers.length; j++) {
  508. if (lineCrossedPlayers[j].name == playersNotInLine[i]) {
  509. lineCrossedPlayers[j].times = lineCrossedPlayers[j].times + 1;
  510. room.sendChat("LINE - " + lineCrossedPlayers[j].name + " {" + lineCrossedPlayers[j].times + "}");
  511. found = true;
  512. }
  513.  
  514. }
  515. if (!found) {
  516. lineCrossedPlayers.push({
  517. name: playersNotInLine[i],
  518. times: 1,
  519. punished: false
  520. });
  521. room.sendChat("LINE - " + playersNotInLine[i] + " {1}");
  522. }
  523. }
  524.  
  525. }
  526. var trigger = false;
  527. var wrongThrowPosition = false;
  528. function isBackRequired()
  529. {
  530. var ballPosition = room.getBallPosition();
  531. if(!isBallKickedOutside)
  532. {
  533. if(lastCall=="1")
  534. {
  535. if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
  536. {
  537. backMSG = false;
  538. room.sendChat("BACK");
  539. trigger = true;
  540. wrongThrowPosition = true;
  541. }
  542. if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
  543. {
  544. backMSG = false;
  545. room.sendChat("FURTHER");
  546. trigger = true;
  547. wrongThrowPosition = true;
  548. }
  549. }
  550. if(lastCall=="2")
  551. {
  552. if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
  553. {
  554. backMSG = false;
  555. room.sendChat("FURTHER");
  556. trigger = true;
  557. wrongThrowPosition = true;
  558. }
  559. if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
  560. {
  561. backMSG = false;
  562. room.sendChat("BACK");
  563. trigger = true;
  564. wrongThrowPosition = true;
  565. }
  566. }
  567. }
  568. if(lastCall=="2" && trigger && isOutsideStadium && Math.abs(exitingPos - ballPosition.x)< throwInLeeway-20)
  569. {
  570. room.sendChat("OK");
  571. trigger = false;
  572. wrongThrowPosition = false;
  573. backMSG = true;
  574. }
  575. if(lastCall=="1" && trigger && isOutsideStadium && Math.abs(exitingPos - ballPosition.x)< throwInLeeway-20)
  576. {
  577. room.sendChat("OK");
  578. trigger = false;
  579. wrongThrowPosition = false;
  580. backMSG = true;
  581. }
  582.  
  583.  
  584.  
  585. }
  586. function isThrowInCorrect()
  587. {
  588. var ballPosition = room.getBallPosition();
  589. var boolCrossing = isBallCrossingTheLine();
  590. var string = lastTeamTouched.toString();
  591.  
  592. if(boolCrossing && !isBallKickedOutside && string==lastCall && (lastCall=="1" || lastCall=="2"))
  593. {
  594.  
  595. if(lastCall=="2")
  596. {
  597. room.sendChat("RED (BAD THROW-IN)");
  598. }
  599. if(lastCall=="1")
  600. {
  601. room.sendChat("BLUE (BAD THROW-IN)");
  602. }
  603.  
  604. isBallKickedOutside == false;
  605. }else if(boolCrossing && string!=lastCall && (lastCall=="1" || lastCall=="2"))
  606. {
  607. //room.sendChat("WRONG TEAM");
  608. wrongThrowPosition = false;
  609. trigger = false;
  610. }else if(boolCrossing && wrongThrowPosition&& string==lastCall && (lastCall=="1" || lastCall=="2"))
  611. {
  612. room.sendChat("WRONG PLACE");
  613. wrongThrowPosition = false;
  614. trigger = false;
  615. }else if(boolCrossing)
  616. {
  617. checkPlayersLine();
  618. }
  619.  
  620. }
  621. function isBallCrossingTheLine()
  622. {
  623. previousBallPos = lineBallPosition;
  624. lineBallPosition = room.getBallPosition().y;
  625. crossed = (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
  626. return (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
  627. }
  628.  
  629. var previousBallPosForGoingUp;
  630. var currentBallPosForGoingUp;
  631.  
  632. function hasBallLeftTheLine()
  633. {
  634. var ballPosition = room.getBallPosition();
  635. if(ballPosition.y<outLineY && isBallKickedOutside)
  636. {
  637. }else if (ballPosition.y>outLineY && isBallKickedOutside && lastPlayerTouched==previousPlayerTouched)
  638. {
  639. room.sendChat("BAD THROW-IN");
  640. }
  641.  
  642. }
  643. room.onStadiumChange = function(newStadiumName, byPlayer) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement