Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.01 KB | None | 0 0
  1. var roomName = "[RSFR] France vs Belgique";
  2. var maxPlayers = 20;
  3. var roomPublic = false;
  4. var playerName = "Arbitre";
  5.  
  6. /* STADIUM */
  7. //Wartości dotyczą boiska na którym rozgrywany jest mecz - wartości domyślne to oficjalna mapa 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": "PL", "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. room.setCustomStadium(RSHLMap);
  318. room.onGameStart = function(player) {
  319. lineCrossedPlayers = [{name: "temp", times: 0}];
  320. lastScores = room.getScores().red + room.getScores().blue;
  321. timeOutside = 0;
  322. isTimeAddedShown = false;
  323. lineBallPosition = 0;
  324. }
  325.  
  326. room.onPlayerBallKick = function(player) {
  327. var ballPosition = room.getBallPosition();
  328. if(player.name!=lastPlayerTouched)
  329. {
  330. if(lastTeamTouched==player.team)
  331. {
  332. assistingTouch = lastPlayerTouched;
  333. }else assistingTouch = "";
  334. }
  335. previousPlayerTouched = lastPlayerTouched;
  336. lastPlayerTouched = player.name;
  337. lastTeamTouched = player.team;
  338.  
  339. if(isBallOutsideStadium && ballPosition.y<0)
  340. {
  341. isBallKickedOutside = true;
  342. }else if(isBallOutsideStadium && ballPosition.y>0)
  343. {
  344. isBallKickedOutside = true;
  345. }else isBallKickedOutside = false;
  346. }
  347. function isBallGoingUp() {
  348. previousBallPosForGoingUp = currentBallPosForGoingUp;
  349. currentBallPosForGoingUp = room.getBallPosition().y;
  350. if (previousBallPosForGoingUp - currentBallPosForGoingUp > 0.01) {
  351. isBallUp = 2;
  352. } else if (previousBallPosForGoingUp - currentBallPosForGoingUp < -0.01) {
  353.  
  354. isBallUp = 1;
  355. } else {
  356. isBallUp = 0;
  357. }
  358. }
  359. function addedTime()
  360. {
  361. var ballPosition = room.getBallPosition();
  362. if(isOutsideStadium(ballPosition))
  363. {
  364. timeOutside++;
  365. return true;
  366. }
  367. }
  368.  
  369. function checkEnd() {
  370. var scores = room.getScores();
  371. if (scores.time > 590 && !isTimeAddedShown) {
  372. var actualTimeAdded = Math.round(timeOutside/240);
  373. if(actualTimeAdded<60)
  374. {
  375. room.sendChat("ADDED TIME: + " + actualTimeAdded + " SECONDS");
  376. }else
  377. {
  378. room.sendChat("ADDED TIME: + 1 MINUTE");
  379. }
  380. isTimeAddedShown = true;
  381. }
  382. }
  383. var tickCount = 0;
  384. room.onGameTick = function() {
  385. isThrowInCorrect();
  386. getLastTouchTheBall();
  387. checkBallPosition();
  388. isBackRequired();
  389. hasBallLeftTheLine();
  390. addedTime();
  391. checkEnd();
  392. tickCount++;
  393. }
  394.  
  395. room.onPlayerJoin = function(player) {
  396. var players = room.getPlayerList();
  397. var adminNumber = 0;
  398. for (var i = 0; i < players.length; i++) {
  399. if (players[i].admin) {
  400. adminNumber++;
  401. room.sendChat("Discord officiel: https://discord.gg/YnAGVdQ")
  402. }
  403. }
  404. if (adminNumber < 2) {
  405. room.setPlayerAdmin(players[1].id, true);
  406. }
  407. }
  408.  
  409. function isOutsideStadium(ballPosition) {
  410. return ballPosition.x > stadiumWidth || ballPosition.x < -stadiumWidth || ballPosition.y > stadiumHeight || ballPosition.y < -stadiumHeight;
  411. }
  412.  
  413. var isBallOutsideStadium = false;
  414.  
  415. function checkBallPosition() {
  416. var ballPosition = room.getBallPosition();
  417. if(isOutsideStadium(ballPosition)) {
  418. if(!isBallOutsideStadium) {
  419. isBallOutsideStadium = true;
  420. exitingPos = ballPosition.x;
  421. var totalScores = room.getScores().red + room.getScores().blue;
  422. if(lastScores != totalScores) {
  423. lastScores = totalScores;
  424. return false;
  425. }
  426. if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.RED || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.BLUE) {
  427. lastCall = "Six mètres";
  428. room.sendChat("Six mètres");
  429. }
  430. else if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.BLUE || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.RED) {
  431. room.sendChat("Corner");
  432. lastCall = "Corner";
  433. }
  434. else {
  435. isBallKickedOutside = false;
  436. room.sendChat(lastTeamTouched == Team.RED ? "B" : "R");
  437. lastCall = lastTeamTouched == Team.RED ? "2" : "1";
  438. }
  439.  
  440. }
  441. }
  442. else {
  443. isBallOutsideStadium = false;
  444. backMSG = true;
  445.  
  446. }
  447. return true;
  448. }
  449.  
  450. function getLastTouchTheBall() {
  451. var ballPosition = room.getBallPosition();
  452. var players = room.getPlayerList();
  453. for(var i = 0; i < players.length; i++) {
  454. if(players[i].position != null) {
  455. var distanceToBall = pointDistance(players[i].position, ballPosition);
  456. if(distanceToBall < triggerDistance) {
  457. if(lastPlayerTouched!=players[i].name)
  458. {
  459. if(lastTeamTouched==players[i].team)
  460. {
  461. assistingTouch = lastPlayerTouched;
  462. }else assistingTouch = "";
  463. }
  464. lastTeamTouched = players[i].team;
  465. previousPlayerTouched == lastPlayerTouched;
  466. lastPlayerTouched = players[i].name;
  467. }
  468. }
  469. }
  470. return lastPlayerTouched;
  471. }
  472.  
  473. function filter(message)
  474. {
  475. message = message.toLowerCase();
  476. message = message.replace(/\s/g, '');
  477. message = message.replace(/\./g,' ')
  478. if(message.includes("pizd") || message.includes("pedal") || message.includes("retard") || message.includes("debil") || message.includes("idiot") || message.includes("kurw") || message.includes("pierd") || message.includes("jeb") || message.includes("fuck") || message.includes("szmat") || message.includes("bitch") || message.includes("suck") || message.includes("dick") || message.includes("sikerim") || message.includes("orospu") || message.includes("çocuğu") || message.includes("scheiße") || message.includes("dich") || message.includes("fick") || message.includes("hure") || message.includes("ass") || message.includes("whore") || message.includes("shit") || message.includes("gown") || message.includes("huj") || message.includes("kutas"))
  479. {
  480. return true;
  481. }else return false;
  482. }
  483. room.onPlayerChat = function(player, message) {
  484. if(filter(message))
  485. {
  486. return false;
  487. }
  488. }
  489.  
  490. function pointDistance(p1, p2) {
  491. var d1 = p1.x - p2.x;
  492. var d2 = p1.y - p2.y;
  493. return Math.sqrt(d1 * d1 + d2 * d2);
  494. }
  495.  
  496. function getPlayersNotWithinLine() {
  497. var players = room.getPlayerList();
  498. var found = false;
  499. if (crossed) {
  500. for (var i = 0; i < players.length; i++) {
  501. if (players[i].position != null) {
  502. if (players[i].team != lastTeamTouched && players[i].team != lastCall && lastCall != "Corner" && lastCall != "Six mètres") {
  503. if ((players[i].position.y > greenLine || players[i].position.y < -greenLine) && pointDistance(room.getBallPosition(), players[i].position) < 500) {
  504. for (var j = 0; j < lineCrossedPlayers.length; j++) {
  505. if (lineCrossedPlayers[j].name == players[i].name) {
  506. lineCrossedPlayers[j].times = lineCrossedPlayers[j].times + 1;
  507. room.sendChat("LINE - " + players[i].name + " {" + lineCrossedPlayers[j].times + "}");
  508. found = true;
  509. }
  510.  
  511. }
  512. if (!found) {
  513. lineCrossedPlayers.push({
  514. name: players[i].name,
  515. times: 1,
  516. punished: false
  517. });
  518. room.sendChat("LINE - " + players[i].name + " {1}");
  519. }
  520. }
  521. }
  522.  
  523. }
  524. }
  525. }
  526. crossed = false;
  527. }
  528. var trigger = false;
  529. var wrongThrowPosition = false;
  530. function isBackRequired()
  531. {
  532. var ballPosition = room.getBallPosition();
  533.  
  534. if(lastCall=="1")
  535. {
  536. if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
  537. {
  538. backMSG = false;
  539. room.sendChat("Arrière");
  540. trigger = true;
  541. wrongThrowPosition = true;
  542. }
  543. if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
  544. {
  545. backMSG = false;
  546. room.sendChat("Plus loin");
  547. trigger = true;
  548. wrongThrowPosition = true;
  549. }
  550. }
  551. if(lastCall=="2")
  552. {
  553. if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
  554. {
  555. backMSG = false;
  556. room.sendChat("Plus loin");
  557. trigger = true;
  558. wrongThrowPosition = true;
  559. }
  560. if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
  561. {
  562. backMSG = false;
  563. room.sendChat("Arrière");
  564. trigger = true;
  565. wrongThrowPosition = true;
  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 (Mauvaise Relance)");
  598. }
  599. if(lastCall=="1")
  600. {
  601. room.sendChat("BLUE (Mauvaise Relance)");
  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("Mauvaise Place");
  613. wrongThrowPosition = false;
  614. trigger = false;
  615. }else getPlayersNotWithinLine();
  616.  
  617. }
  618. function isBallCrossingTheLine()
  619. {
  620. previousBallPos = lineBallPosition;
  621. lineBallPosition = room.getBallPosition().y;
  622. crossed = (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
  623. return (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
  624. }
  625.  
  626. var previousBallPosForGoingUp;
  627. var currentBallPosForGoingUp;
  628.  
  629. function hasBallLeftTheLine()
  630. {
  631. var ballPosition = room.getBallPosition();
  632. if(ballPosition.y<outLineY && isBallKickedOutside)
  633. {
  634.  
  635. }else if (ballPosition.y>outLineY && isBallKickedOutside && lastPlayerTouched==previousPlayerTouched)
  636. {
  637. room.sendChat("Mauvais Relance");
  638. }
  639.  
  640.  
  641. }
  642. room.onStadiumChange = function(newStadiumName, byPlayer) {
  643. if (newStadiumName != "Real Soccer 1.3D by RawR") {
  644. room.setCustomStadium(RSHLMap);
  645. }
  646. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement