Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var roomName = "🌙 ITALIAN DEERS VPS 🌙";
- var maxPlayers = 14;
- var roomPublic = false;
- var playerName = "PetitDiable";
- /* STADIUM */
- //Les valeures suivantes sont celles de la hauteur lors du match - Les valeures par défault sont celles de la map RS
- var stadiumWidth = 1150;
- var stadiumHeight = 600;
- var radiusBall = 9.8;
- var throwInLeeway = 350;
- var greenLine = 510;
- /* SETTINGS */
- var triggerDistance = radiusBall + 15 + 0.01;
- var outLineY = stadiumWidth - (radiusBall / 2) + 6;
- stadiumWidth += (radiusBall / 2) + 6;
- stadiumHeight += (radiusBall / 2) + 6;
- var Team = {
- SPECTATORS: 0,
- RED: 1,
- BLUE: 2
- };
- var lastScores = 0;
- var lastTeamTouched = 0;
- var lineBallPosition;
- var exitingPos = null;
- var previousBallPos;
- var assistingTouch = "";
- var lastPlayerTouched = "";
- var lat = 52;
- var long = 21;
- var backMSG = false;
- var lastCall;
- var isBallUp = false;
- var crossed = false;
- var isTimeAddedShown = false;
- var lineCrossedPlayers = [{name: "temp", times: 0}];
- var isBallKickedOutside = false;
- var previousPlayerTouched;
- var timeOutside = 0;
- var room = HBInit({ roomName: roomName, maxPlayers: maxPlayers, public: roomPublic, playerName: playerName, geo: {"code": "FR", "lat": lat, "lon": long }});
- room.setScoreLimit(0);
- room.setTimeLimit(0);
- var RSHLMap = `{
- "name" : "Real Soccer 1.3D by RawR",
- "width" : 1300,
- "height" : 670,
- "spawnDistance" : 500,
- "bg" : { "type" : "grass", "width" : 1150, "height" : 600, "kickOffRadius" : 180, "cornerRadius" : 0 },
- "playerPhysics" : {
- "bCoef" : 0.5,
- "invMass" : 0.5,
- "damping" : 0.96,
- "acceleration" : 0.12,
- "kickingAcceleration" : 0.07,
- "kickingDamping" : 0.96,
- "kickStrength" : 5.65
- },
- "vertexes" : [
- /* 0 */ { "x" : 0, "y" : 700, "trait" : "kickOffBarrier" },
- /* 1 */ { "x" : 0, "y" : 180, "trait" : "kickOffBarrier" },
- /* 2 */ { "x" : 0, "y" : -180, "trait" : "kickOffBarrier" },
- /* 3 */ { "x" : 0, "y" : -700, "trait" : "kickOffBarrier" },
- /* 4 */ { "x" : 1150, "y" : 255, "trait" : "line" },
- /* 5 */ { "x" : 840, "y" : 255, "trait" : "line" },
- /* 6 */ { "x" : 1150, "y" : -255, "trait" : "line" },
- /* 7 */ { "x" : 840, "y" : -255, "trait" : "line" },
- /* 8 */ { "x" : 1150, "y" : 155, "trait" : "line" },
- /* 9 */ { "x" : 1030, "y" : 155, "trait" : "line" },
- /* 10 */ { "x" : 1150, "y" : -155, "trait" : "line" },
- /* 11 */ { "x" : 1030, "y" : -155, "trait" : "line" },
- /* 12 */ { "x" : 840, "y" : -135, "trait" : "line", "curve" : -130 },
- /* 13 */ { "x" : 840, "y" : 135, "trait" : "line", "curve" : -130 },
- /* 14 */ { "x" : -1150, "y" : -255, "trait" : "line", "curve" : -90, "color" : "97AC86" },
- /* 15 */ { "x" : -840, "y" : -255, "trait" : "line" },
- /* 16 */ { "x" : -1150, "y" : 255, "trait" : "line" },
- /* 17 */ { "x" : -840, "y" : 255, "trait" : "line" },
- /* 18 */ { "x" : -1150, "y" : -155, "trait" : "line" },
- /* 19 */ { "x" : -1030, "y" : -155, "trait" : "line" },
- /* 20 */ { "x" : -1150, "y" : 155, "trait" : "line" },
- /* 21 */ { "x" : -1030, "y" : 155, "trait" : "line" },
- /* 22 */ { "x" : -840, "y" : 135, "trait" : "line", "curve" : -130 },
- /* 23 */ { "x" : -840, "y" : -135, "trait" : "line", "curve" : -130 },
- /* 24 */ { "x" : 935, "y" : 4, "trait" : "line" },
- /* 25 */ { "x" : 935, "y" : -4, "trait" : "line" },
- /* 26 */ { "x" : -935, "y" : 4, "trait" : "line" },
- /* 27 */ { "x" : -935, "y" : -4, "trait" : "line" },
- /* 28 */ { "x" : -1150, "y" : 525, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- /* 29 */ { "x" : -1075, "y" : 600, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line", "_selected" : true },
- /* 30 */ { "x" : -1075, "y" : -600, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- /* 31 */ { "x" : -1150, "y" : -525, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- /* 32 */ { "x" : 1075, "y" : 600, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- /* 33 */ { "x" : 1150, "y" : 525, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- /* 34 */ { "x" : 1150, "y" : -525, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- /* 35 */ { "x" : 1075, "y" : -600, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- /* 36 */ { "x" : -1150, "y" : 127, "trait" : "line", "color" : "ffffff" },
- /* 37 */ { "x" : -1214, "y" : 124, "trait" : "line", "color" : "ffffff", "curve" : 5 },
- /* 38 */ { "x" : -1150, "y" : -127, "trait" : "line", "color" : "ffffff" },
- /* 39 */ { "x" : -1214, "y" : -124, "trait" : "line", "color" : "ffffff", "curve" : 5 },
- /* 40 */ { "x" : 1150, "y" : 127, "trait" : "line", "color" : "ffffff" },
- /* 41 */ { "x" : 1214, "y" : 124, "trait" : "line", "color" : "ffffff", "curve" : -5 },
- /* 42 */ { "x" : 1150, "y" : -127, "trait" : "line", "color" : "ffffff" },
- /* 43 */ { "x" : 1214, "y" : -124, "trait" : "line", "color" : "ffffff", "curve" : -5 },
- /* 44 */ { "x" : 0, "y" : -4, "trait" : "line" },
- /* 45 */ { "x" : 0, "y" : 4, "trait" : "line" },
- /* 46 */ { "x" : 0, "y" : -4, "trait" : "line" },
- /* 47 */ { "x" : 0, "y" : 4, "trait" : "line" },
- /* 48 */ { "x" : -1214, "y" : 124, "trait" : "line", "color" : "ffffff" },
- /* 49 */ { "x" : -1250, "y" : 150, "trait" : "line", "color" : "ffffff", "pos" : [-1250,150 ] },
- /* 50 */ { "x" : -1214, "y" : -124, "trait" : "line", "color" : "ffffff" },
- /* 51 */ { "x" : -1250, "y" : -150, "trait" : "line", "color" : "ffffff", "pos" : [-1250,-150 ] },
- /* 52 */ { "x" : 1214, "y" : 124, "trait" : "line", "color" : "ffffff" },
- /* 53 */ { "x" : 1250, "y" : 150, "trait" : "line", "color" : "ffffff" },
- /* 54 */ { "x" : 1214, "y" : -124, "trait" : "line", "color" : "ffffff" },
- /* 55 */ { "x" : 1250, "y" : -150, "trait" : "line", "color" : "ffffff" },
- /* 56 */ { "x" : -1185, "y" : 155, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : 40, "color" : "BEB86C" },
- /* 57 */ { "x" : -1185, "y" : 255, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : 40, "color" : "BEB86C" },
- /* 58 */ { "x" : 1185, "y" : 155, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : -40, "color" : "BEB86C" },
- /* 59 */ { "x" : 1185, "y" : 255, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : -40, "color" : "BEB86C" },
- /* 60 */ { "x" : -1185, "y" : -155, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : -40, "color" : "BEB86C" },
- /* 61 */ { "x" : -1185, "y" : -255, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : -40, "color" : "BEB86C" },
- /* 62 */ { "x" : 1185, "y" : -155, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : 40, "color" : "BEB86C" },
- /* 63 */ { "x" : 1185, "y" : -255, "bCoef" : -4.5, "cMask" : ["ball" ], "trait" : "line", "curve" : 40, "color" : "BEB86C" },
- /* 64 */ { "x" : 1158, "y" : -607, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 0, "color" : "BEB86C" },
- /* 65 */ { "x" : 1187, "y" : -578, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : -60, "color" : "BEB86C" },
- /* 66 */ { "x" : 1158, "y" : 607, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 0, "color" : "BEB86C" },
- /* 67 */ { "x" : 1187, "y" : 578, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 60, "color" : "BEB86C" },
- /* 68 */ { "x" : -1158, "y" : 607, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 0, "color" : "BEB86C" },
- /* 69 */ { "x" : -1187, "y" : 578, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : -60, "color" : "BEB86C" },
- /* 70 */ { "x" : -1158, "y" : -607, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 0, "color" : "BEB86C" },
- /* 71 */ { "x" : -1187, "y" : -578, "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line", "curve" : 60, "color" : "BEB86C" },
- /* 72 */ { "x" : -1190, "y" : -255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 73 */ { "x" : -1180, "y" : -255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 74 */ { "x" : -1190, "y" : -155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 75 */ { "x" : -1180, "y" : -155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 76 */ { "x" : -1190, "y" : 155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 77 */ { "x" : -1180, "y" : 155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 78 */ { "x" : -1190, "y" : 255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 79 */ { "x" : -1180, "y" : 255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 80 */ { "x" : 1190, "y" : -255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 81 */ { "x" : 1180, "y" : -255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 82 */ { "x" : 1190, "y" : -155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 83 */ { "x" : 1180, "y" : -155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 84 */ { "x" : 1190, "y" : 255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 85 */ { "x" : 1180, "y" : 255, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 86 */ { "x" : 1190, "y" : 155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 87 */ { "x" : 1180, "y" : 155, "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line", "color" : "000000", "curve" : 0 },
- /* 88 */ { "x" : -1148, "y" : -525, "trait" : "line", "curve" : -90, "color" : "5E844D" },
- /* 89 */ { "x" : 1148, "y" : -525, "trait" : "line", "color" : "5E844D" },
- /* 90 */ { "x" : -1148, "y" : 525, "trait" : "line", "curve" : -90, "color" : "5E844D" },
- /* 91 */ { "x" : 1148, "y" : 525, "trait" : "line", "color" : "5E844D" },
- /* 92 */ { "x" : -1150, "y" : -260, "trait" : "line", "curve" : -100, "color" : "5E844D" },
- /* 93 */ { "x" : -840, "y" : -600, "trait" : "line", "color" : "5E844D", "curve" : -100 },
- /* 94 */ { "x" : -1150, "y" : 260, "trait" : "line", "curve" : 100, "color" : "5E844D" },
- /* 95 */ { "x" : -840, "y" : 600, "trait" : "line", "color" : "5E844D", "curve" : 100 },
- /* 96 */ { "x" : -840, "y" : -1150, "trait" : "line", "color" : "5E844D", "curve" : -100 },
- /* 97 */ { "x" : 1150, "y" : -260, "trait" : "line", "curve" : 100, "color" : "5E844D" },
- /* 98 */ { "x" : 840, "y" : -600, "trait" : "line", "color" : "5E844D", "curve" : 100 },
- /* 99 */ { "x" : 1150, "y" : 260, "trait" : "line", "curve" : -100, "color" : "5E844D" },
- /* 100 */ { "x" : 840, "y" : 600, "trait" : "line", "color" : "5E844D", "curve" : -100 }
- ],
- "segments" : [
- { "v0" : 37, "v1" : 39, "curve" : 5, "color" : "ffffff", "trait" : "reargoalNetleft", "x" : -1210 },
- { "v0" : 41, "v1" : 43, "curve" : -5, "color" : "ffffff", "trait" : "reargoalNetright" },
- { "v0" : 4, "v1" : 5, "trait" : "line", "y" : 250 },
- { "v0" : 5, "v1" : 7, "trait" : "line", "x" : 840 },
- { "v0" : 6, "v1" : 7, "trait" : "line", "y" : -250 },
- { "v0" : 8, "v1" : 9, "trait" : "line", "y" : 150 },
- { "v0" : 9, "v1" : 11, "trait" : "line", "x" : 1030 },
- { "v0" : 10, "v1" : 11, "trait" : "line", "y" : -150 },
- { "v0" : 12, "v1" : 13, "curve" : -130, "trait" : "line", "x" : 840 },
- { "v0" : 14, "v1" : 15, "trait" : "line", "y" : -250 },
- { "v0" : 15, "v1" : 17, "trait" : "line", "x" : -840 },
- { "v0" : 16, "v1" : 17, "trait" : "line", "y" : 250 },
- { "v0" : 18, "v1" : 19, "trait" : "line", "y" : -150 },
- { "v0" : 19, "v1" : 21, "trait" : "line", "x" : -1030 },
- { "v0" : 20, "v1" : 21, "trait" : "line", "y" : 150 },
- { "v0" : 22, "v1" : 23, "curve" : -130, "trait" : "line", "x" : -840 },
- { "v0" : 24, "v1" : 25, "curve" : -180, "trait" : "line", "x" : 935 },
- { "v0" : 26, "v1" : 27, "curve" : -180, "trait" : "line", "x" : -935 },
- { "v0" : 24, "v1" : 25, "curve" : 180, "trait" : "line", "x" : 935 },
- { "v0" : 26, "v1" : 27, "curve" : 180, "trait" : "line", "x" : -935 },
- { "v0" : 24, "v1" : 25, "curve" : 90, "trait" : "line", "x" : 935 },
- { "v0" : 26, "v1" : 27, "curve" : 90, "trait" : "line", "x" : -935 },
- { "v0" : 24, "v1" : 25, "curve" : -90, "trait" : "line", "x" : 935 },
- { "v0" : 26, "v1" : 27, "curve" : -90, "trait" : "line", "x" : -935 },
- { "v0" : 24, "v1" : 25, "trait" : "line", "x" : 935 },
- { "v0" : 26, "v1" : 27, "trait" : "line", "x" : -935 },
- { "v0" : 28, "v1" : 29, "curve" : 90, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- { "v0" : 30, "v1" : 31, "curve" : 90, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- { "v0" : 32, "v1" : 33, "curve" : 90, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- { "v0" : 34, "v1" : 35, "curve" : 90, "bCoef" : 0, "cMask" : ["wall" ], "trait" : "line" },
- { "v0" : 36, "v1" : 37, "curve" : 5, "color" : "ffffff", "trait" : "sidegoalNet" },
- { "v0" : 38, "v1" : 39, "curve" : -5, "color" : "ffffff", "trait" : "sidegoalNet" },
- { "v0" : 40, "v1" : 41, "curve" : -5, "color" : "ffffff", "trait" : "sidegoalNet" },
- { "v0" : 42, "v1" : 43, "curve" : 5, "color" : "ffffff", "trait" : "sidegoalNet" },
- { "v0" : 44, "v1" : 45, "curve" : -180, "trait" : "line" },
- { "v0" : 46, "v1" : 47, "curve" : 180, "trait" : "line" },
- { "v0" : 44, "v1" : 45, "curve" : -90, "trait" : "line" },
- { "v0" : 46, "v1" : 47, "curve" : 90, "trait" : "line" },
- { "v0" : 48, "v1" : 49, "color" : "ffffff", "trait" : "line" },
- { "v0" : 50, "v1" : 51, "color" : "ffffff", "trait" : "line" },
- { "v0" : 52, "v1" : 53, "color" : "ffffff", "trait" : "line" },
- { "v0" : 54, "v1" : 55, "color" : "ffffff", "trait" : "line" },
- { "v0" : 56, "v1" : 57, "curve" : 40, "vis" : true, "color" : "BEB86C", "bCoef" : -4.7, "cMask" : ["ball" ], "trait" : "line", "x" : -1220 },
- { "v0" : 58, "v1" : 59, "curve" : -40, "vis" : true, "color" : "BEB86C", "bCoef" : -4.7, "cMask" : ["ball" ], "trait" : "line", "x" : 1220 },
- { "v0" : 60, "v1" : 61, "curve" : -40, "vis" : true, "color" : "BEB86C", "bCoef" : -4.7, "cMask" : ["ball" ], "trait" : "line", "x" : -1220 },
- { "v0" : 62, "v1" : 63, "curve" : 40, "vis" : true, "color" : "BEB86C", "bCoef" : -4.7, "cMask" : ["ball" ], "trait" : "line", "x" : 1220 },
- { "v0" : 64, "v1" : 65, "curve" : -60, "vis" : true, "color" : "BEB86C", "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 66, "v1" : 67, "curve" : 60, "vis" : true, "color" : "BEB86C", "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 68, "v1" : 69, "curve" : -60, "vis" : true, "color" : "BEB86C", "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 70, "v1" : 71, "curve" : 60, "vis" : true, "color" : "BEB86C", "bCoef" : -2.45, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 0, "v1" : 1, "trait" : "kickOffBarrier" },
- { "v0" : 1, "v1" : 2, "curve" : 180, "cGroup" : ["blueKO" ], "trait" : "kickOffBarrier" },
- { "v0" : 1, "v1" : 2, "curve" : -180, "cGroup" : ["redKO" ], "trait" : "kickOffBarrier" },
- { "v0" : 2, "v1" : 3, "trait" : "kickOffBarrier" },
- { "v0" : 72, "v1" : 73, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 74, "v1" : 75, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 76, "v1" : 77, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 78, "v1" : 79, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 80, "v1" : 81, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 82, "v1" : 83, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 84, "v1" : 85, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 86, "v1" : 87, "curve" : 0, "vis" : true, "color" : "000000", "bCoef" : -1, "cMask" : ["ball" ], "trait" : "line" },
- { "v0" : 88, "v1" : 89, "color" : "5E844D", "trait" : "line", "y" : -475 },
- { "v0" : 90, "v1" : 91, "color" : "5E844D", "trait" : "line", "y" : -475 },
- { "v0" : 92, "v1" : 93, "curve" : -100, "color" : "5E844D", "trait" : "line", "y" : -475 },
- { "v0" : 94, "v1" : 95, "curve" : 100, "color" : "5E844D", "trait" : "line", "y" : -475 },
- { "v0" : 97, "v1" : 98, "curve" : 100, "color" : "5E844D", "trait" : "line", "y" : -475 },
- { "v0" : 99, "v1" : 100, "curve" : -100, "color" : "5E844D", "trait" : "line", "y" : -475 }
- ],
- "goals" : [
- { "p0" : [-1160,-124 ], "p1" : [-1160,124 ], "team" : "red" },
- { "p0" : [1160,124 ], "p1" : [1160,-124 ], "team" : "blue" }
- ],
- "discs" : [
- { "pos" : [-1150,127 ], "color" : "FF0000", "bCoef" : 0.5, "trait" : "goalPost" },
- { "pos" : [-1150,-127 ], "color" : "FF0000", "bCoef" : 0.5, "trait" : "goalPost" },
- { "pos" : [1150,127 ], "color" : "0000FF", "bCoef" : 0.5, "trait" : "goalPost" },
- { "pos" : [1150,-127 ], "color" : "0000FF", "bCoef" : 0.5, "trait" : "goalPost" },
- { "pos" : [-1250,150 ], "color" : "FF0000", "trait" : "stanchion" },
- { "pos" : [-1250,-150 ], "color" : "FF0000", "trait" : "stanchion" },
- { "pos" : [1250,150 ], "color" : "0000FF", "trait" : "stanchion", "x" : 1250 },
- { "pos" : [1250,-150 ], "color" : "0000FF", "trait" : "stanchion", "x" : 1250 },
- { "radius" : 2, "invMass" : 0, "pos" : [-1150,-600 ], "color" : "FFFFFF", "bCoef" : -0.1, "cMask" : ["ball" ], "trait" : "goalPost" },
- { "radius" : 2, "invMass" : 0, "pos" : [-1150,600 ], "color" : "FFFFFF", "bCoef" : -0.1, "cMask" : ["ball" ], "trait" : "goalPost" },
- { "radius" : 2, "invMass" : 0, "pos" : [1150,-600 ], "color" : "FFFFFF", "bCoef" : -0.1, "cMask" : ["ball" ], "trait" : "goalPost" },
- { "radius" : 2, "invMass" : 0, "pos" : [1150,600 ], "color" : "FFFFFF", "bCoef" : -0.1, "cMask" : ["ball" ], "trait" : "goalPost" }
- ],
- "planes" : [
- { "normal" : [0,1 ], "dist" : -635, "bCoef" : 0, "trait" : "ballArea" },
- { "normal" : [0,-1 ], "dist" : -635, "bCoef" : 0, "trait" : "ballArea" },
- { "normal" : [0,1 ], "dist" : -670, "bCoef" : 0 },
- { "normal" : [0,-1 ], "dist" : -670, "bCoef" : 0 },
- { "normal" : [1,0 ], "dist" : -1300, "bCoef" : 0 },
- { "normal" : [-1,0 ], "dist" : -1300, "bCoef" : 0.1 },
- { "normal" : [1,0 ], "dist" : -1214, "bCoef" : 0, "cMask" : ["ball" ] },
- { "normal" : [-1,0 ], "dist" : -1214, "bCoef" : 0, "cMask" : ["ball" ] }
- ],
- "traits" : {
- "ballArea" : { "vis" : false, "bCoef" : 0, "cMask" : ["ball" ] },
- "goalPost" : { "radius" : 5, "invMass" : 0, "bCoef" : 2 },
- "stanchion" : { "radius" : 3, "invMass" : 0, "bCoef" : 3, "cMask" : ["none" ] },
- "cornerflag" : { "radius" : 3, "invMass" : 0, "bCoef" : 0.5, "color" : "FFFF00", "cGroup" : [ ] },
- "reargoalNetleft" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball","red","blue" ], "curve" : 10, "color" : "C7E6BD" },
- "reargoalNetright" : { "vis" : true, "bCoef" : 0.1, "cMask" : ["ball","red","blue" ], "curve" : -10, "color" : "C7E6BD" },
- "sidegoalNet" : { "vis" : true, "bCoef" : 1, "cMask" : ["ball","red","blue" ], "color" : "C7E6BD" },
- "kickOffBarrier" : { "vis" : false, "bCoef" : 0.1, "cGroup" : ["redKO","blueKO" ], "cMask" : ["red","blue" ] },
- "line" : { "vis" : true, "cMask" : [ ], "color" : "C7E6BD" },
- "tunnel" : { "vis" : true, "cMask" : ["red","blue" ], "color" : "000000" },
- "advertising" : { "vis" : true, "cMask" : ["red","blue" ], "color" : "333333" },
- "teambench" : { "vis" : true, "cMask" : [ ], "color" : "000000" },
- "manager" : { "radius" : 15, "vis" : true, "cMask" : ["red","blue" ], "invMass" : 0, "color" : "333333" },
- "physio" : { "radius" : 15, "vis" : true, "cMask" : ["red","blue" ], "invMass" : 0, "color" : "666666" },
- "redsubs" : { "radius" : 15, "vis" : true, "cMask" : ["red","blue" ], "invMass" : 0, "color" : "E56E56" },
- "bluesubs" : { "radius" : 15, "vis" : true, "cMask" : ["red","blue" ], "invMass" : 0, "color" : "5689E5" }
- },
- "ballPhysics" : {
- "invMass" : 1.05,
- "radius" : 9.8
- }
- }`;
- room.setCustomStadium(RSHLMap);
- room.onGameStart = function(player) {
- lineCrossedPlayers = [{name: "temp", times: 0}];
- lastScores = room.getScores().red + room.getScores().blue;
- timeOutside = 0;
- isTimeAddedShown = false;
- lineBallPosition = 0;
- }
- room.onPlayerBallKick = function(player) {
- var ballPosition = room.getBallPosition();
- if(player.name!=lastPlayerTouched)
- {
- if(lastTeamTouched==player.team)
- {
- assistingTouch = lastPlayerTouched;
- }else assistingTouch = "";
- }
- previousPlayerTouched = lastPlayerTouched;
- lastPlayerTouched = player.name;
- lastTeamTouched = player.team;
- if(isBallOutsideStadium)
- {
- getPlayersNotWithinLine();
- }
- if(isBallOutsideStadium && ballPosition.y<0)
- {
- isBallKickedOutside = true;
- }else if(isBallOutsideStadium && ballPosition.y>0)
- {
- isBallKickedOutside = true;
- }else isBallKickedOutside = false;
- }
- function isBallGoingUp() {
- previousBallPosForGoingUp = currentBallPosForGoingUp;
- currentBallPosForGoingUp = room.getBallPosition().y;
- if (previousBallPosForGoingUp - currentBallPosForGoingUp > 0.01) {
- isBallUp = 2;
- } else if (previousBallPosForGoingUp - currentBallPosForGoingUp < -0.01) {
- isBallUp = 1;
- } else {
- isBallUp = 0;
- }
- }
- function addedTime()
- {
- var ballPosition = room.getBallPosition();
- if(isOutsideStadium(ballPosition))
- {
- timeOutside++;
- return true;
- }
- }
- function checkEnd() {
- var scores = room.getScores();
- if (scores.time > 590 && !isTimeAddedShown) {
- var actualTimeAdded = Math.round((timeOutside-(100*60))/120);
- if(actualTimeAdded<60&&actualTimeAdded>-1)
- {
- room.sendChat("ADDED TIME: + " + actualTimeAdded + " SECONDS");
- }else if(actualTimeAdded<0)
- {
- room.sendChat("NO ADDED TIME. (+0)");
- }else
- {
- room.sendChat("ADDED TIME: + 1 MINUTE");
- }
- isTimeAddedShown = true;
- }
- }
- var tickCount = 0;
- room.onGameTick = function() {
- isThrowInCorrect();
- getLastTouchTheBall();
- checkBallPosition();
- isBackRequired();
- hasBallLeftTheLine();
- addedTime();
- checkEnd();
- tickCount++;
- }
- room.onPlayerJoin = function(player) {
- var players = room.getPlayerList();
- var adminNumber = 0;
- for (var i = 0; i < players.length; i++) {
- if (players[i].admin) {
- adminNumber++;
- }
- }
- if (adminNumber < 2) {
- room.setPlayerAdmin(players[1].id, true);
- }
- }
- function isOutsideStadium(ballPosition) {
- return ballPosition.x > stadiumWidth || ballPosition.x < -stadiumWidth || ballPosition.y > stadiumHeight || ballPosition.y < -stadiumHeight;
- }
- var isBallOutsideStadium = false;
- function checkBallPosition() {
- var ballPosition = room.getBallPosition();
- if(isOutsideStadium(ballPosition)) {
- if(!isBallOutsideStadium) {
- isBallOutsideStadium = true;
- exitingPos = ballPosition.x;
- var totalScores = room.getScores().red + room.getScores().blue;
- if(lastScores != totalScores) {
- lastScores = totalScores;
- return false;
- }
- if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.RED || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.BLUE) {
- lastCall = "GK";
- room.sendChat("GK");
- }
- else if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.BLUE || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.RED) {
- room.sendChat("CK");
- lastCall = "CK";
- }
- else {
- isBallKickedOutside = false;
- room.sendChat(lastTeamTouched == Team.RED ? "B" : "R");
- lastCall = lastTeamTouched == Team.RED ? "2" : "1";
- }
- }
- }
- else {
- isBallOutsideStadium = false;
- backMSG = true;
- }
- return true;
- }
- function getLastTouchTheBall() {
- 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) {
- if(lastPlayerTouched!=players[i].name)
- {
- if(lastTeamTouched==players[i].team)
- {
- assistingTouch = lastPlayerTouched;
- }else assistingTouch = "";
- }
- lastTeamTouched = players[i].team;
- previousPlayerTouched == lastPlayerTouched;
- lastPlayerTouched = players[i].name;
- }
- }
- }
- return lastPlayerTouched;
- }
- function pointDistance(p1, p2) {
- var d1 = p1.x - p2.x;
- var d2 = p1.y - p2.y;
- return Math.sqrt(d1 * d1 + d2 * d2);
- }
- var playersNotInLine = new Array;
- function getPlayersNotWithinLine() {
- playersNotInLine = new Array;
- var players = room.getPlayerList();
- for (var i = 0; i < players.length; i++) {
- if (players[i].position != null) {
- if (players[i].team != lastTeamTouched && players[i].team != lastCall && lastCall != "CK" && lastCall != "GK") {
- if ((players[i].position.y > greenLine || players[i].position.y < -greenLine) && pointDistance(room.getBallPosition(), players[i].position) < 500) {
- playersNotInLine.push(players[i].name);
- }
- }
- }
- }
- }
- function checkPlayersLine() {
- for (var i = 0; i < playersNotInLine.length; i++)
- {
- var found = false;
- for (var j = 0; j < lineCrossedPlayers.length; j++) {
- if (lineCrossedPlayers[j].name == playersNotInLine[i]) {
- lineCrossedPlayers[j].times = lineCrossedPlayers[j].times + 1;
- room.sendChat("LINE - " + lineCrossedPlayers[j].name + " {" + lineCrossedPlayers[j].times + "}");
- found = true;
- }
- }
- if (!found) {
- lineCrossedPlayers.push({
- name: playersNotInLine[i],
- times: 1,
- punished: false
- });
- room.sendChat("LINE - " + playersNotInLine[i] + " {1}");
- }
- }
- }
- var trigger = false;
- var wrongThrowPosition = false;
- function isBackRequired()
- {
- var ballPosition = room.getBallPosition();
- if(!isBallKickedOutside)
- {
- if(lastCall=="1")
- {
- if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
- {
- backMSG = false;
- room.sendChat("BACK");
- trigger = true;
- wrongThrowPosition = true;
- }
- if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
- {
- backMSG = false;
- room.sendChat("FURTHER");
- trigger = true;
- wrongThrowPosition = true;
- }
- }
- if(lastCall=="2")
- {
- if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
- {
- backMSG = false;
- room.sendChat("FURTHER");
- trigger = true;
- wrongThrowPosition = true;
- }
- if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition) && ((ballPosition.y - outLineY > 20) || (ballPosition.y - outLineY < -20)))
- {
- backMSG = false;
- room.sendChat("BACK");
- trigger = true;
- wrongThrowPosition = true;
- }
- }
- }
- if(lastCall=="2" && trigger && isOutsideStadium && Math.abs(exitingPos - ballPosition.x)< throwInLeeway-20)
- {
- room.sendChat("OK");
- trigger = false;
- wrongThrowPosition = false;
- backMSG = true;
- }
- if(lastCall=="1" && trigger && isOutsideStadium && Math.abs(exitingPos - ballPosition.x)< throwInLeeway-20)
- {
- room.sendChat("OK");
- trigger = false;
- wrongThrowPosition = false;
- backMSG = true;
- }
- }
- function isThrowInCorrect()
- {
- var ballPosition = room.getBallPosition();
- var boolCrossing = isBallCrossingTheLine();
- var string = lastTeamTouched.toString();
- if(boolCrossing && !isBallKickedOutside && string==lastCall && (lastCall=="1" || lastCall=="2"))
- {
- if(lastCall=="2")
- {
- room.sendChat("RED (BAD THROW-IN)");
- }
- if(lastCall=="1")
- {
- room.sendChat("BLUE (BAD THROW-IN)");
- }
- isBallKickedOutside == false;
- }else if(boolCrossing && string!=lastCall && (lastCall=="1" || lastCall=="2"))
- {
- //room.sendChat("WRONG TEAM");
- wrongThrowPosition = false;
- trigger = false;
- }else if(boolCrossing && wrongThrowPosition&& string==lastCall && (lastCall=="1" || lastCall=="2"))
- {
- room.sendChat("WRONG PLACE");
- wrongThrowPosition = false;
- trigger = false;
- }else if(boolCrossing)
- {
- checkPlayersLine();
- }
- }
- function isBallCrossingTheLine()
- {
- previousBallPos = lineBallPosition;
- lineBallPosition = room.getBallPosition().y;
- crossed = (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
- return (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
- }
- var previousBallPosForGoingUp;
- var currentBallPosForGoingUp;
- function hasBallLeftTheLine()
- {
- var ballPosition = room.getBallPosition();
- if(ballPosition.y<outLineY && isBallKickedOutside)
- {
- }else if (ballPosition.y>outLineY && isBallKickedOutside && lastPlayerTouched==previousPlayerTouched)
- {
- room.sendChat("BAD THROW-IN");
- }
- }
- room.onStadiumChange = function(newStadiumName, byPlayer) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement