Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var room = HBInit({ roomName: "[NAFC] FutsaBot 4v4", maxPlayers: 20, playerName : "NAFC's Futsabot", public : true});
- var futsal = `{
- "name" : "[NAFC] Official",
- "width" : 760,
- "height" : 370,
- "spawnDistance" : 310,
- "bg" : { "type" : "hockey", "width" : 671, "height" : 330, "kickOffRadius" : 80, "cornerRadius" : 0 },
- "vertexes" : [
- /* 0 */ { "x" : -671, "y" : 330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
- /* 1 */ { "x" : -671, "y" : 77.5, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
- /* 2 */ { "x" : -671, "y" : -77.5, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
- /* 3 */ { "x" : -671, "y" : -330, "trait" : "ballArea", "bCoef" : 0.97, "cMask" : ["ball" ] },
- /* 4 */ { "x" : 671, "y" : 330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97 },
- /* 5 */ { "x" : 671, "y" : 77.5, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
- /* 6 */ { "x" : 671, "y" : -77.5, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97, "curve" : 0 },
- /* 7 */ { "x" : 671, "y" : -330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 0.97 },
- /* 8 */ { "x" : 0, "y" : 339, "trait" : "kickOffBarrier" },
- /* 9 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier" },
- /* 10 */ { "x" : 0, "y" : -80, "trait" : "line" },
- /* 11 */ { "x" : 0, "y" : -339, "trait" : "kickOffBarrier" },
- /* 12 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : -705, "y" : -77.5, "curve" : 0 },
- /* 13 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : 705, "y" : -77.5, "curve" : 0 },
- /* 14 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : -705, "y" : 77.5, "curve" : 0 },
- /* 15 */ { "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "x" : 705, "y" : 77.5, "curve" : 0 },
- /* 16 */ { "trait" : "line", "x" : -671, "y" : -220 },
- /* 17 */ { "trait" : "line", "x" : -475, "y" : -50, "curve" : 0 },
- /* 18 */ { "trait" : "line", "x" : 671, "y" : -220 },
- /* 19 */ { "trait" : "line", "x" : 475, "y" : -50, "curve" : 0 },
- /* 20 */ { "bCoef" : 0, "trait" : "line", "x" : -651, "y" : -330 },
- /* 21 */ { "bCoef" : 0, "trait" : "line", "x" : -671, "y" : -310 },
- /* 22 */ { "bCoef" : 0, "trait" : "line", "x" : 651, "y" : -330 },
- /* 23 */ { "bCoef" : 0, "trait" : "line", "x" : 671, "y" : -310 },
- /* 24 */ { "bCoef" : 0, "trait" : "line", "x" : -651, "y" : 330 },
- /* 25 */ { "bCoef" : 0, "trait" : "line", "x" : -671, "y" : 310 },
- /* 26 */ { "bCoef" : 0, "trait" : "line", "x" : 651, "y" : 330 },
- /* 27 */ { "bCoef" : 0, "trait" : "line", "x" : 671, "y" : 310 },
- /* 28 */ { "bCoef" : 0.97, "trait" : "ballArea", "x" : 671, "y" : 330 },
- /* 29 */ { "bCoef" : 0.97, "trait" : "ballArea", "x" : 671, "y" : -330 },
- /* 30 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 330 },
- /* 31 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -330 },
- /* 32 */ { "x" : 0, "y" : 80, "trait" : "kickOffBarrier" },
- /* 33 */ { "x" : 0, "y" : -80, "trait" : "kickOffBarrier" },
- /* 34 */ { "bCoef" : 0, "trait" : "line", "x" : -280, "y" : 345 },
- /* 35 */ { "bCoef" : 0, "trait" : "line", "x" : -280, "y" : 310 },
- /* 36 */ { "bCoef" : 0, "trait" : "line", "x" : 280, "y" : 345 },
- /* 37 */ { "bCoef" : 0, "trait" : "line", "x" : 280, "y" : 310 },
- /* 38 */ { "bCoef" : 0, "trait" : "line", "x" : -160, "y" : 345 },
- /* 39 */ { "bCoef" : 0, "trait" : "line", "x" : -160, "y" : 310 },
- /* 40 */ { "bCoef" : 0, "trait" : "line", "x" : 160, "y" : 345 },
- /* 41 */ { "bCoef" : 0, "trait" : "line", "x" : 160, "y" : 310 },
- /* 42 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -671, "y" : -130 },
- /* 43 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -690, "y" : -130 },
- /* 44 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 671, "y" : -130 },
- /* 45 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 690, "y" : -130 },
- /* 46 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -671, "y" : 130 },
- /* 47 */ { "bCoef" : 0, "trait" : "ballArea", "x" : -690, "y" : 130 },
- /* 48 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 671, "y" : 130 },
- /* 49 */ { "bCoef" : 0, "trait" : "ballArea", "x" : 690, "y" : 130 },
- /* 50 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : -3 },
- /* 51 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : 3 },
- /* 52 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : -3 },
- /* 53 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : 3 },
- /* 54 */ { "x" : 680, "y" : -80, "trait" : "line", "cMask" : ["red" ], "bCoef" : 1 },
- /* 55 */ { "x" : 680, "y" : -330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 },
- /* 56 */ { "x" : -680, "y" : -80, "trait" : "line", "cMask" : ["blue" ], "bCoef" : 1 },
- /* 57 */ { "x" : -680, "y" : -330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 },
- /* 58 */ { "x" : -680, "y" : 80, "trait" : "line", "cMask" : ["blue" ], "bCoef" : 1, "curve" : 0 },
- /* 59 */ { "x" : -680, "y" : 330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1, "curve" : 0 },
- /* 60 */ { "x" : 680, "y" : 80, "trait" : "line", "cMask" : ["red" ], "bCoef" : 1 },
- /* 61 */ { "x" : 680, "y" : 330, "trait" : "ballArea", "cMask" : ["ball" ], "bCoef" : 1 },
- /* 62 */ { "bCoef" : 0, "trait" : "line", "x" : -475, "y" : -5 },
- /* 63 */ { "bCoef" : 0, "trait" : "line", "x" : -475, "y" : 5 },
- /* 64 */ { "bCoef" : 0, "trait" : "line", "x" : -480, "y" : 0 },
- /* 65 */ { "bCoef" : 0, "trait" : "line", "x" : -470, "y" : 0 },
- /* 66 */ { "bCoef" : 0, "trait" : "line", "x" : -478, "y" : -3 },
- /* 67 */ { "bCoef" : 0, "trait" : "line", "x" : -472, "y" : 3 },
- /* 68 */ { "bCoef" : 0, "trait" : "line", "x" : -478, "y" : 3 },
- /* 69 */ { "bCoef" : 0, "trait" : "line", "x" : -472, "y" : -3 },
- /* 70 */ { "bCoef" : 0, "trait" : "line", "x" : 475, "y" : -5 },
- /* 71 */ { "bCoef" : 0, "trait" : "line", "x" : 475, "y" : 5 },
- /* 72 */ { "bCoef" : 0, "trait" : "line", "x" : 470, "y" : 0 },
- /* 73 */ { "bCoef" : 0, "trait" : "line", "x" : 480, "y" : 0 },
- /* 74 */ { "bCoef" : 0, "trait" : "line", "x" : 472, "y" : -3 },
- /* 75 */ { "bCoef" : 0, "trait" : "line", "x" : 478, "y" : 3 },
- /* 76 */ { "bCoef" : 0, "trait" : "line", "x" : 472, "y" : 3 },
- /* 77 */ { "bCoef" : 0, "trait" : "line", "x" : 478, "y" : -3 },
- /* 78 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : -129 },
- /* 79 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : -131 },
- /* 80 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : 131 },
- /* 81 */ { "bCoef" : 0, "trait" : "line", "x" : -310, "y" : 129 },
- /* 82 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : -129 },
- /* 83 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : -131 },
- /* 84 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : 131 },
- /* 85 */ { "bCoef" : 0, "trait" : "line", "x" : 310, "y" : 129 },
- /* 86 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
- /* 87 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
- /* 88 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
- /* 89 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
- /* 90 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
- /* 91 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
- /* 92 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
- /* 93 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
- /* 94 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : -3 },
- /* 95 */ { "bCoef" : 0, "trait" : "line", "x" : 0, "y" : 3 },
- /* 96 */ { "bCoef" : 0, "trait" : "line", "x" : -671, "y" : 220, "curve" : -90 },
- /* 97 */ { "bCoef" : 0, "trait" : "line", "x" : -475, "y" : 50, "curve" : 0 },
- /* 98 */ { "bCoef" : 0, "trait" : "line", "x" : 475, "y" : 50, "curve" : 0 },
- /* 99 */ { "bCoef" : 0, "trait" : "line", "x" : 671, "y" : 220, "curve" : 0 }
- ],
- "segments" : [
- { "v0" : 0, "v1" : 1, "trait" : "ballArea", "curve" : 0 },
- { "v0" : 2, "v1" : 3, "trait" : "ballArea" },
- { "v0" : 4, "v1" : 5, "trait" : "ballArea" },
- { "v0" : 6, "v1" : 7, "trait" : "ballArea" },
- { "v0" : 8, "v1" : 9, "trait" : "kickOffBarrier" },
- { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : 180, "cGroup" : ["blueKO" ] },
- { "v0" : 9, "v1" : 10, "trait" : "kickOffBarrier", "curve" : -180, "cGroup" : ["redKO" ] },
- { "v0" : 10, "v1" : 11, "trait" : "kickOffBarrier" },
- { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 2, "v1" : 12, "color" : "f9f9f9", "curve" : 0, "y" : -77.5 },
- { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 6, "v1" : 13, "color" : "f9f9f9", "curve" : 0, "y" : -77.5 },
- { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 1, "v1" : 14, "color" : "f9f9f9", "curve" : 0, "y" : 77.5 },
- { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 5, "v1" : 15, "color" : "f9f9f9", "curve" : 0, "y" : 77.5 },
- { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 12, "v1" : 14, "x" : -705, "color" : "f9f9f9", "curve" : 0 },
- { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ], "trait" : "goalNet", "v0" : 13, "v1" : 15, "x" : 705, "color" : "f9f9f9", "curve" : 0 },
- { "color" : "FFFFFF", "trait" : "line", "v0" : 16, "v1" : 17, "curve" : 90 },
- { "color" : "FFFFFF", "trait" : "line", "v0" : 18, "v1" : 19, "curve" : -90 },
- { "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 20, "v1" : 21, "curve" : 90 },
- { "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 22, "v1" : 23, "curve" : -90 },
- { "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 24, "v1" : 25, "curve" : -90 },
- { "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 26, "v1" : 27, "curve" : 90 },
- { "vis" : true, "color" : "ffffff", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 1, "v1" : 0, "cMask" : ["ball" ], "x" : -671, "curve" : 0 },
- { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 5, "v1" : 4, "cMask" : ["ball" ], "x" : 671 },
- { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 2, "v1" : 3, "cMask" : ["ball" ], "x" : -671 },
- { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 6, "v1" : 7, "cMask" : ["ball" ], "x" : 671 },
- { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 0, "v1" : 28, "y" : 290 },
- { "vis" : true, "color" : "FFFFFF", "bCoef" : 0.97, "trait" : "ballArea", "v0" : 3, "v1" : 29, "y" : -330 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 30, "v1" : 31 },
- { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 10, "v1" : 9 },
- { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 33, "v1" : 32 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 34, "v1" : 35, "x" : -280 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 36, "v1" : 37, "x" : 280 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 38, "v1" : 39, "x" : -160 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 40, "v1" : 41, "x" : 160 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "ballArea", "v0" : 42, "v1" : 43, "y" : -130 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "ballArea", "v0" : 44, "v1" : 45, "y" : -130 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "ballArea", "v0" : 46, "v1" : 47, "y" : 130 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "ballArea", "v0" : 48, "v1" : 49, "y" : 130 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 2, "v1" : 1 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 6, "v1" : 5 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
- { "curve" : 90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
- { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
- { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
- { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 50, "v1" : 51, "x" : -280 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
- { "curve" : 90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
- { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
- { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
- { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 52, "v1" : 53, "x" : 280 },
- { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 54, "v1" : 55, "cMask" : ["ball" ], "x" : 680 },
- { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 56, "v1" : 57, "cMask" : ["ball" ], "x" : -680 },
- { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 58, "v1" : 59, "cMask" : ["ball" ], "x" : -680, "curve" : 0 },
- { "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "trait" : "ballArea", "v0" : 60, "v1" : 61, "cMask" : ["ball" ], "x" : 680 },
- { "vis" : true, "color" : "666666", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "v0" : 57, "v1" : 59, "curve" : -60 },
- { "vis" : true, "color" : "666666", "bCoef" : 1, "cMask" : ["ball" ], "trait" : "ballArea", "v0" : 55, "v1" : 61, "curve" : 60 },
- { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 62, "v1" : 63 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 62, "v1" : 63 },
- { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 62, "v1" : 63 },
- { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 64, "v1" : 65 },
- { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 66, "v1" : 67 },
- { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 68, "v1" : 69 },
- { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 70, "v1" : 71 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 70, "v1" : 71 },
- { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 70, "v1" : 71 },
- { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 72, "v1" : 73 },
- { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 74, "v1" : 75 },
- { "curve" : 0, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 76, "v1" : 77 },
- { "curve" : 180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 78, "v1" : 79 },
- { "curve" : -180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 78, "v1" : 79 },
- { "curve" : 180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 80, "v1" : 81 },
- { "curve" : -180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 80, "v1" : 81 },
- { "curve" : 180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 82, "v1" : 83 },
- { "curve" : -180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 82, "v1" : 83 },
- { "curve" : 180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 84, "v1" : 85 },
- { "curve" : -180, "vis" : true, "color" : "ffffff", "bCoef" : 0, "trait" : "line", "v0" : 84, "v1" : 85 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 86, "v1" : 87, "x" : -280 },
- { "curve" : 90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 88, "v1" : 89, "x" : -280 },
- { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 90, "v1" : 91, "x" : -280 },
- { "curve" : -180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 92, "v1" : 93, "x" : -280 },
- { "curve" : 180, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 94, "v1" : 95, "x" : -280 },
- { "curve" : 60, "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "cMask" : ["red" ], "trait" : "line", "v0" : 54, "v1" : 60 },
- { "curve" : 60, "vis" : false, "color" : "FFFFFF", "bCoef" : 1, "cMask" : ["blue" ], "trait" : "line", "v0" : 58, "v1" : 56 },
- { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 96, "v1" : 97 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 97, "v1" : 17 },
- { "curve" : -90, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 98, "v1" : 99 },
- { "curve" : 0, "vis" : true, "color" : "FFFFFF", "bCoef" : 0, "trait" : "line", "v0" : 98, "v1" : 19 }
- ],
- "goals" : [
- { "p0" : [-679,-77.5 ], "p1" : [-679,77.5 ], "team" : "red" },
- { "p0" : [679,77.5 ], "p1" : [679,-77.5 ], "team" : "blue" }
- ],
- "discs" : [
- { "pos" : [-673,77.5 ], "trait" : "goalPost", "color" : "e56e56", "radius" : 5 },
- { "pos" : [-673,-77.5 ], "trait" : "goalPost", "color" : "e56e56", "radius" : 5 },
- { "pos" : [673,77.5 ], "trait" : "goalPost", "color" : "5689e5", "radius" : 5 },
- { "pos" : [673,-77.5 ], "trait" : "goalPost", "color" : "5689e5", "radius" : 5 },
- { "radius" : 3, "invMass" : 0, "pos" : [705,77.5 ], "color" : "5689e5", "bCoef" : 0, "trait" : "line" },
- { "radius" : 3, "invMass" : 0, "pos" : [-705,77.5 ], "color" : "e56e56", "bCoef" : 0, "trait" : "line" },
- { "radius" : 3, "invMass" : 0, "pos" : [705,-77.5 ], "color" : "5689e5", "bCoef" : 0, "trait" : "line" },
- { "radius" : 3, "invMass" : 0, "pos" : [-705,-77.5 ], "color" : "e56e56", "bCoef" : 0, "trait" : "line" }
- ],
- "planes" : [
- { "normal" : [0,1 ], "dist" : -330, "trait" : "ballArea" },
- { "normal" : [0,-1 ], "dist" : -330, "trait" : "ballArea" },
- { "normal" : [0,1 ], "dist" : -370, "bCoef" : 0.2, "cMask" : ["all" ] },
- { "normal" : [0,-1 ], "dist" : -370, "bCoef" : 0.2, "cMask" : ["all" ] },
- { "normal" : [1,0 ], "dist" : -760, "bCoef" : 0.2, "cMask" : ["all" ] },
- { "normal" : [-1,0 ], "dist" : -755, "bCoef" : 0.2, "cMask" : ["all" ] }
- ],
- "traits" : {
- "ballArea" : { "vis" : false, "bCoef" : 1, "cMask" : ["ball" ] },
- "goalPost" : { "radius" : 8, "invMass" : 0, "bCoef" : 1 },
- "goalNet" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["all" ] },
- "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] },
- "line" : { "vis" : true, "bCoef" : 0, "cMask" : ["" ] },
- "arco" : { "radius" : 2, "cMask" : ["n/d" ], "color" : "cccccc" }
- },
- "playerPhysics" : {
- "acceleration" : 0.115,
- "kickingAcceleration" : 0.1,
- "kickStrength" : 7
- },
- "ballPhysics" : {
- "radius" : 6.225,
- "color" : "D0FA58",
- "invMass" : 0.99,
- "damping" : 0.99
- }
- }`
- room.setCustomStadium(futsal);
- room.setScoreLimit(3);
- room.setTimeLimit(5);
- function clonekick(player){
- players = room.getPlayerList();
- for (i = 0; i < players.length-1; i++){
- if (player.name == players[i].name){
- room.kickPlayer(player.id,"There is already a user with this name",false);
- }
- }
- }
- var boldedNumbers = 'ππππππππππ';
- var circledNumbers = 'πβ΅βΆβ·βΈβΉβΊβ»βΌβ½';
- function boldedNumber(num){
- var result = '';
- var reversedDigits = [];
- do{
- reversedDigits.push(num % 10);
- num = Math.floor(num / 10);
- }while(num > 0);
- for (var i = reversedDigits.length; i-- > 0; ){
- result += boldedNumbers.substr(reversedDigits[i]*2, 2);
- }
- return result;
- }
- function afkFun(player, message){ // !classic
- if (afkPlayerIDs.has(player.id)){
- afkPlayerIDs.delete(player.id);
- room.sendChat("Finally" + player.name + " is back! and ready for play!");}
- else {afkPlayerIDs.add(player.id); room.setPlayerTeam(player.id, 0);room.sendChat("Now " + player.name + " is AFK!");}
- }
- function afksFun(player, message){ // !huge
- afkPlayers_list = room.getPlayerList().filter((x) => afkPlayerIDs.has(x.id));
- afkPlayers_list_string = afkPlayers_list.map(x => x.name).join(", ");
- if (afkPlayers_list == "") {
- room.sendChat("π No one's AFK");
- }
- else {
- room.sendChat("AFK players: " + afkPlayers_list_string);
- }
- }
- function kickafksFun(player, message){ // !huge
- if (player.admin == true){
- afksPlayers = room.getPlayerList().filter((x) => afkPlayerIDs.has(x.id));
- for(var i=0;i<afksPlayers.length;i++){room.kickPlayer(afksPlayers[i].id,"AFK!",false);}
- }
- }
- function circledNumber(num){
- var result = '';
- var reversedDigits = [];
- do{
- reversedDigits.push(num % 10);
- num = Math.floor(num / 10);
- }while(num > 0);
- for (var i = reversedDigits.length; i-- > 0; ){
- if(reversedDigits[i] == 0){
- result += circledNumbers.substr(reversedDigits[i], 2);
- }else{
- result += circledNumbers.substr(1+reversedDigits[i], 1);
- }
- }
- return result;
- }
- function confirmedPlayersFun(player, message){ // !huge
- var overall = [];
- players = room.getPlayerList().filter((x) => confirmedPlayers.has(x.id));
- for (var i = 0; i < players.length; i++) {
- let account = accounts.find(a => a.playerId === players[i].id);
- if (account !== undefined) {
- overall.push({name: players[i].name, value: account.username});
- }
- }
- let top15 = overall.splice(0, 20);
- let pos = 1;
- if (top15.length) {
- room.sendChat("confirmed: ");
- }else{room.sendChat("There is no confirmed players currently");}
- while (top15.length) {
- let tmp = top15.splice(0, 5);
- let message = tmp.map(e => `${e.name}[${e.value}]`).join(", ");
- room.sendChat(message);
- }
- }
- /*
- Functions
- */
- // If there are no admins left in the room give admin to one of the remaining players.
- function updateAdmins() {
- // Get all players except the host (id = 0 is always the host)
- var players = room.getPlayerList().filter((player) => player.id != 0 );
- if ( players.length == 0 ){room.stopGame();} // No players left, do nothing.
- if ( players.find((player) => player.admin) != null ) return; // There's an admin left so do nothing.
- if (players[0] !== undefined){
- room.setPlayerAdmin(players[0].id, true); // Give admin to the first non admin player in the list
- }
- }
- function initPlayerStats(player){
- }
- /*
- for commands
- */
- function swapFun(player){
- if (player.admin == true){
- if (room.getScores() == null) {
- players = room.getPlayerList();
- for (i = 0; i < players.length; i++){
- if (players[i].team == 1){
- room.setPlayerTeam(players[i].id, 2);
- }
- else if (players[i].team == 2){
- room.setPlayerTeam(players[i].id, 1);
- }
- }
- }
- }
- }
- function pushMuteFun(player, message){ // !mute Anddy
- // Prevent somebody to talk in the room (uses the nickname, not the id)
- // need to be admin
- if (player.admin == true){
- if (!(mutedPlayers.includes(message.substr(6)))) mutedPlayers.push(message.substr(6));
- }
- }
- function gotMutedFun(player){
- if (mutedPlayers.includes(player.name)){
- return true;
- }
- }
- function unmuteFun(player, message){ // !unmute Anddy
- // Allow somebody to talk if he has been muted
- // need to be admin
- if (player.admin == true){
- pos = mutedPlayers.indexOf(message.substr(9));
- mutedPlayers.splice(pos, 1);
- }
- }
- function mutelistFun(player, message){ // !unmute Anddy
- // Allow somebody to talk if he has been muted
- // need to be admin
- if (player.admin == true){
- if (mutedPlayers.length > 0){
- var mutelist= mutedPlayers.join(",");
- room.sendChat("Muted Players List: " + mutelist);
- }
- else{room.sendChat("There is no muted players in the list.");}
- }
- }
- function clearmutesFun(player, message){ // !unmute Anddy
- // Allow somebody to talk if he has been muted
- // need to be admin
- if (player.admin == true){
- if (mutedPlayers.length > 0){
- mutedPlayers = [];
- room.sendChat("All muted Players have been unmuted.");
- }
- else{room.sendChat("There are no muted players in the list.");}
- }
- }
- function confirmFun(player, message){ // !confirm aaa
- // Prevent somebody to talk in the room (uses the nickname, not the id)
- // need to be admin
- let password = message.substr(9);
- let account = accounts.find(a => a.password === password);
- if (account !== undefined) {
- account.playerId = player.id;
- room.sendChat("[" + player.name + "] " + account.username + " has confirmed");
- confirmedPlayers.add(player.id);
- }
- return false;
- }
- function adminFun(player, message){ // !admin NAFCstaff51 // Gives admin to the person who type this password
- room.setPlayerAdmin(player.id, true);
- return false; // The message won't be displayed
- }
- function resignFun(player, message){
- room.setPlayerAdmin(player.id, false);
- updateAdmins();
- }
- function helpFun() { // !help
- room.sendChat('π¬ Available commands: "!confirm", "!afk", "afks", "!confirmed_players",');
- room.sendChat('π¬ "!pm", "!poss", "!adminhelp", "!gkhelp", "!bb"');
- }
- function adminHelpFun() {
- room.sendChat('π¬ Available commands: "!mute Player", "!unmute Player", "!mutelist", "!clearmutes", "!clearbans", "!rr", ')
- room.sendChat('π¬ Available commands: "!kickafks", "!resign", "!swap" (to switch reds and blues).')
- }
- function gkHelpFun() { // !gkhelp
- room.sendChat('π¬ The most backward player at the kick off will be set as gk ! (write "!gk" if the bot was wrong).')
- }
- function clearbansFun(player){ // !clear
- if (player.admin == true){ room.clearBans(); room.sendChat("All bans has been reseted.");}
- }
- function resetFun(player){
- if (player.admin == true){
- room.stopGame();
- room.startGame();
- }
- }
- function gkFun(player){ // !gk
- if (room.getScores() != null && room.getScores().time < 60){
- if (player.team == 1) {
- gk[0] = player;
- }
- else if (player.team == 2){
- gk[1] = player;
- }
- }
- return;
- }
- function leaveFun(player){
- room.kickPlayer(player.id, "ggs!", false);
- }
- /*
- For ranking
- */
- function whichTeam(){ // gives the players in the red or blue team
- var players = room.getPlayerList();
- var redTeam = players.filter(player => player.team == 1);
- var blueTeam = players.filter(player => player.team == 2);
- return [redTeam, blueTeam]
- }
- function pmFun(player, message){ //!pm
- var pm = message.substr(4);
- var index = message.split(" ").slice(1);
- var playerID = parseInt(index[0])
- delete index[0];
- var message2 = index.join(" ");
- var message3 = "[PM FROM " + player.name + "(ID:" + player.id + ")]: " + message2;
- room.sendChat(message3, parseInt(playerID))
- var players = room.getPlayerList().filter((player) => player.id != 0 );
- if ( players.find((player => player.id === playerID))) {room.sendChat("PM Sent!", player.id)}
- else {room.sendChat("User ID is not found!, Check # for getting his ID.", player.id)};
- return false;
- }
- function isGk(){ // gives the mosts backward players before the first kickOff
- var players = room.getPlayerList();
- var min = players[0];
- min.position = {x: room.getBallPosition().x + 60}
- var max = min;
- for (var i = 0; i < players.length; i++) {
- if (players[i].position != null){
- if (min.position.x > players[i].position.x) min = players[i];
- if (max.position.x < players[i].position.x) max = players[i];
- }
- }
- return [min, max]
- }
- function initBallCarrying(redTeam, blueTeam){
- var ballCarrying = new Map();
- var playing = redTeam.concat(blueTeam);
- for (var i = 0; i < playing.length; i++) {
- ballCarrying.set(playing[i].name, [0, playing[i].team]); // secs, team, %
- }
- return ballCarrying;
- }
- function updateTeamPoss(value){
- if (value[1] == 1) redPoss += value[0];
- if (value[1] == 2) bluePoss += value[0];
- }
- var bluePoss;
- var redPoss;
- var timeOnHalves;
- /*
- For the game
- */
- // Gives the last player who touched the ball, works only if the ball has the same
- // size than in classics maps.
- var radiusBall = 10;
- var triggerDistance = radiusBall + 15 + 0.1;
- function getLastTouchTheBall(lastPlayerTouched, time) {
- var ballPosition = room.getBallPosition();
- var players = room.getPlayerList();
- for(var i = 0; i < players.length; i++) {
- if(players[i].position != null) {
- var distanceToBall = pointDistance(players[i].position, ballPosition);
- if(distanceToBall < triggerDistance) {
- lastPlayerTouched = players[i];
- return lastPlayerTouched;
- }
- }
- }
- return lastPlayerTouched;
- }
- // Calculate the distance between 2 points
- function pointDistance(p1, p2) {
- var d1 = p1.x - p2.x;
- var d2 = p1.y - p2.y;
- return Math.sqrt(d1 * d1 + d2 * d2);
- }
- function isOvertime(){
- scores = room.getScores();
- if (scores != null){
- if (scores.timeLimit != 0){
- if (scores.time > scores.timeLimit){
- if (scores.red == 0 && hasFinished == false){
- let account = accounts.find(a => a.playerId === gk[0].id);
- if (account !== undefined) {
- }else{};
- let account1 = accounts.find(a => a.playerId === gk[1].id);
- if (account1 !== undefined) {
- }else{};
- hasFinished = true;
- }
- }
- }
- }
- }
- // return: the name of the team who took a goal
- var team_name = team => team == 1 ? "π΄ Red" : "π΅ Blue";
- var team_color = team => team == 1 ? "π΄" : "π΅";
- // return: whether it's an OG
- var isOwnGoal = (team, player) => team != player.team ? " [OG]" : "";
- // return: a better display of the second when a goal is scored
- var floor = s => s < 10 ? "0" + s : s;
- // return: whether there's an assist
- //var playerTouchedTwice = playerList => playerList[0].team == playerList[1].team ? " (" + playerList[1].name + ")" : "";
- playerTouchedTwice = function(playerList){
- let account = accounts.find(a => a.playerId === playerList[1].id);
- if (playerList[0].team == playerList[1].team && account !== undefined){ return " (" + playerList[1].name + "[" + account.username + "]" + ")"; }
- else if (playerList[0].team == playerList[1].team && account == undefined){ return " (" + playerList[1].name + ")"; }
- else{ return "";};
- }
- /*
- Events
- */
- /* window.setInterval(saveStatsFun, 300000); */
- var mutedPlayers = []; // Array where will be added muted players
- const confirmedPlayers = new Set()
- const afkPlayerIDs = new Set()
- var init = "init"; // Smth to initialize smth
- init.id = 0; // Faster than getting host's id with the method
- init.name = "init";
- var scorers ; // Map where will be set all scorers in the current game (undefined if reset or end)
- var whoTouchedLast; // var representing the last player who touched the ball
- var whoTouchedBall = [init, init]; // Array where will be set the 2 last players who touched the ball
- var gk = [init, init];
- var goalScored = false;
- let accounts = [];
- accounts.push({username: "Enzo",password:
- "caralho"});
- accounts.push({username: "Bigfatsnoozy",password: "opensesame123"});
- accounts.push({username: "Nogo",password: "Nogoisgreat"});
- accounts.push({username: "rix",password: "amsterdamsche"});
- accounts.push({username: "Kernoa",password: "Kernoa8"});
- accounts.push({username: "CreeperReaperX",password: "F0rmuoli"});
- accounts.push({username: "Andre Gomes",password: "dolph1n"});
- accounts.push({username: "ICLemon",password: "faS78"});
- accounts.push({username: "Messi Da Best",password: "FCB2013"});
- accounts.push({username: "Spongebob",password: "07095"});
- accounts.push({username: "LemΓ‘r",password: "L2E0M1A9R"});
- accounts.push({username: "Kaz",password: "hundred1"});
- accounts.push({username: "Starbucks",password: "imsexy"});
- accounts.push({username: "earth",password: "Smdb7"});
- accounts.push({username: "geoff",password: "realsock"});
- accounts.push({username: "owner",password: "geoffisgayaf"});
- accounts.push({username: "Lucas PaquetΓ‘",password: "idontknow"});
- accounts.push({username: "Lebron",password: "BBC553"});
- accounts.push({username: "Local",password: "DET62065"});
- accounts.push({username: "Star[bucks]",password: "imsexy"});
- accounts.push({username: "anon",password: "zeronine"});
- accounts.push({username: "question",password: "faraisbad123"});
- accounts.push({username: "the 4 time",password: "smellyhugefatcock"});
- accounts.push({username: "XClutch2",password: "Finesse"});
- accounts.push({username: "_Matt_",password: "Brian61202"});
- accounts.push({username: "Beto",password: "psver123"});
- accounts.push({username: "Chris24",password: "24chris"});
- accounts.push({username: "retroz",password: "number14"});
- accounts.push({username: "Yasssss",password: "p3n15"});
- accounts.push({username: "Klister",password: "bigdick10"});
- accounts.push({username: "earth",password: "Smdb7"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Nantes",password: "geoffsgay"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- accounts.push({username: "Player",password: "Confirmcode"});
- var commands = {
- // Command that doesnt need to know players attributes.
- "!help": helpFun,
- "!gkhelp": gkHelpFun,
- "!adminhelp": adminHelpFun,
- // Command that need to know who is the player.
- "!gk": gkFun,
- // Command that need to know if a player is admin.
- "!swap": swapFun,
- "!rr": resetFun,
- "!clearbans": clearbansFun,
- "!admin NAFCstaff51": adminFun,
- // Command that need to know who is the player and what's the message.
- "!bb" : leaveFun,
- "!leave" : leaveFun,
- "!quit" : leaveFun,
- "!confirm" : confirmFun,
- "!confirmed_players" : confirmedPlayersFun,
- "!afk" : afkFun,
- "!afks" : afksFun,
- "!kickafks" : kickafksFun,
- "!resign" : resignFun,
- "!mute" : pushMuteFun,
- "!unmute": unmuteFun,
- "!pm": pmFun,
- "!mutelist": mutelistFun,
- "!clearmutes": clearmutesFun,
- }
- initPlayerStats(room.getPlayerList()[0]) // lazy lol, i'll fix it later
- initPlayerStats(init);
- room.onPlayerLeave = function(player) {
- updateAdmins();
- }
- room.onPlayerJoin = function(player) {
- updateAdmins(); // Gives admin to the first player who join the room if there's no one
- clonekick(player);
- playerName = player.name.replace(/ /g,"_");
- room.sendChat("π¬ Hi @" + playerName + " welcome to EFL Futsabot by Faraone, If you want to join league, ask anyone availible for link!" )
- room.sendChat("@" + playerName + " Write !help, !adminhelp, !rankhelp for commands." )
- }
- var redTeam;
- var blueTeam;
- room.onGameStart = function() {
- [redTeam,blueTeam] = whichTeam();
- ballCarrying = initBallCarrying(redTeam, blueTeam);
- timeOnHalves = [0,0];
- }
- room.onPlayerTeamChange = function(player){
- if (room.getScores() != null){
- if (1 <= player.team <= 2) ballCarrying.set(player.name, [0, player.team]);
- }
- if (player.team !== 0 && afkPlayerIDs.has(player.id))
- {room.setPlayerTeam(player.id, 0)
- room.sendChat("Now" + player.name + " is AFK!")}
- if (player.id <= 0){
- room.setPlayerTeam(player.id, 0)}
- }
- room.onPlayerChat = function(player, message) {
- if (mutedPlayers.includes(player.name)) return false;
- let spacePos = message.search(" ");
- let command = message.substr(0, spacePos !== -1 ? spacePos : message.length);
- if (commands.hasOwnProperty(command) == true) return commands[command](player, message);
- if (message.indexOf("!") == 0) return false;
- }
- room.onPlayerBallKick = function (player){
- whoTouchedLast = player;
- }
- var kickOff = false;
- var hasFinished = false;
- room.onGameTick = function() {
- if (kickOff == false) { // simplest comparison to not charge usulessly the tick thing
- if (room.getScores().time != 0){
- kickOff = true;
- gk = isGk();
- room.sendChat("Red GK: " + gk[0].name + ", Blue GK: " + gk[1].name);
- }
- }
- if (goalScored == false){
- whoTouchedLast = getLastTouchTheBall(whoTouchedLast);
- }
- if (whoTouchedLast != undefined) {
- if (ballCarrying.get(whoTouchedLast.name)) {
- ballCarrying.get(whoTouchedLast.name)[0] += 1/60;
- }
- if ( whoTouchedLast.id != whoTouchedBall[0].id){
- whoTouchedBall[1] = whoTouchedBall[0];
- whoTouchedBall[0] = whoTouchedLast; // last player who touched the ball
- }
- }
- updateTimeOnHalves();
- }
- updateTimeOnHalves = function(){
- if(room.getBallPosition().x < 0){
- timeOnHalves[0] += 1/60;
- }else if(room.getBallPosition().x > 0){
- timeOnHalves[1] += 1/60;
- }
- }
- room.onTeamGoal = function(team){ // Write on chat who scored and when.
- goalScored = true;
- var time = room.getScores().time;
- var m = Math.trunc(time/60); var s = Math.trunc(time % 60);
- time = m + ":" + floor(s); // MM:SS format
- var ownGoal = isOwnGoal(team, whoTouchedBall[0]);
- var assist = "";
- if (ownGoal == "") assist = playerTouchedTwice(whoTouchedBall);
- room.sendChat("β½ GOAL scored by " + whoTouchedBall[0].name +
- assist + ownGoal + " at [" +
- time + "] for team " + team_name(team));
- room.sendChat("Match Score now: " + team_color(1) + " " +
- boldedNumber(room.getScores().red) + " - " + boldedNumber(room.getScores().blue) + " " + team_color(2));
- if (scorers == undefined) scorers = new Map(); // Initializing dict of scorers
- scorers.set(scorers.size + 1 +") " + whoTouchedLast.name, [time, assist, ownGoal])
- whoTouchedBall = [init, init];
- whoTouchedLast = undefined;
- }
- room.onPositionsReset = function(){
- goalScored = false;
- }
- room.onTeamVictory = function(scores){ // Sum up all scorers since the beginning of the match.
- room.sendChat("Scored goals β½:")
- for (var [key, value] of scorers) { // key: name of the player, value: time of the goal
- room.sendChat(key + " " + value[1] + value[2] + ": " + value[0]);
- }
- room.stopGame();
- }
- room.onGameStop = function(){
- scorers = undefined;
- whoTouchedBall = [init, init];
- whoTouchedLast = undefined;
- gk = [init, init];
- kickOff = false;
- hasFinished = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement