0% found this document useful (0 votes)
11 views27 pages

Real Soccer Game Configuration Variables

The document defines various variables and configurations for a real soccer game, including timeout settings, player movement distances, and stadium parameters. It specifies the physics properties for players and the ball, as well as the layout of the soccer field. The stadium is named 'Sân Tập Của Utano' and includes detailed coordinates and traits for various segments and barriers on the field.

Uploaded by

anhtuan03082011
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views27 pages

Real Soccer Game Configuration Variables

The document defines various variables and configurations for a real soccer game, including timeout settings, player movement distances, and stadium parameters. It specifies the physics properties for players and the ball, as well as the layout of the soccer field. The stadium is named 'Sân Tập Của Utano' and includes detailed coordinates and traits for various segments and barriers on the field.

Uploaded by

anhtuan03082011
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

//Real Soccer Variables

var throwTimeOut = 420; // 7 seconds (var is in game ticks)


var gkTimeOut = 600; // 10 seconds (var is in game ticks)
var ckTimeOut = 600; // 10 seconds (var is in game ticks)
var throwinDistance = 270; // distance players can move the ball during throw in
var mapBGColor = "86A578"; // default 718C5A
var superAdminCode = "lulii"; // !admin lulii
var allowPublicAdmin = true; // if true then !admin command is enabled
var powerShotMode = true;
var goldenGoal = true;

/*-------------------------------- STADIUMS ---------------------------------*/


function getRealSoccerMap() {
var realSoccerMap = `{"name":"Sân Tập Của
Utano","width":1300,"height":670,"spawnDistance":560,"bg":
{"type":"grass","width":1150,"height":600,"kickOffRadius":180,"cornerRadius":0,"col
or":"`+mapBGColor+`"},"playerPhysics":
{"bCoef":0.3,"invMass":0.5,"damping":0.96,"acceleration":0.12,"kickingAcceleration"
:0.07,"kickingDamping":0.96,"kickStrength":5.65},"ballPhysics":
{"radius":9,"bCoef":0.5,"invMass":1.05,"damping":0.99,"color":"FFFFFF","cMask":
["all"],"cGroup":["ball"]},"vertexes":[{"x":0,"y":675,"trait":"kickOffBarrier"},
{"x":0,"y":180,"trait":"kickOffBarrier"},{"x":0,"y":-180,"trait":"kickOffBarrier"},
{"x":0,"y":-675,"trait":"kickOffBarrier"},{"x":1150,"y":320,"trait":"line"},
{"x":840,"y":320,"trait":"line"},{"x":1150,"y":-320,"trait":"line"},{"x":840,"y":-
320,"trait":"line"},{"x":1150,"y":180,"trait":"line"},
{"x":1030,"y":180,"trait":"line"},{"x":1150,"y":-180,"trait":"line"},
{"x":1030,"y":-180,"trait":"line"},{"x":840,"y":-130,"trait":"line","curve":-130},
{"x":840,"y":130,"trait":"line","curve":-130},{"x":-1150,"y":-320,"trait":"line"},
{"x":-840,"y":-320,"trait":"line"},{"x":-1150,"y":320,"trait":"line"},{"x":-
840,"y":320,"trait":"line"},{"x":-1150,"y":-175,"trait":"line"},{"x":-1030,"y":-
175,"trait":"line"},{"x":-1150,"y":175,"trait":"line"},{"x":-
1030,"y":175,"trait":"line"},{"x":-840,"y":130,"trait":"line","curve":-130},{"x":-
840,"y":-130,"trait":"line","curve":-130},{"x":935,"y":3,"trait":"line"},
{"x":935,"y":-3,"trait":"line"},{"x":-935,"y":3,"trait":"line"},{"x":-935,"y":-
3,"trait":"line"},{"x":-1150,"y":570,"bCoef":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"x":-1120,"y":600,"bCoef":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"x":-1120,"y":-600,"bCoef":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"x":-1150,"y":-570,"bCoef":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"x":1120,"y":600,"bCoef":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"x":1150,"y":570,"bCoef":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"x":1150,"y":-570,"bCoef":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"x":1120,"y":-600,"bCoef":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"x":0,"y":180,"bCoef":0.1,"cMask":["red","blue"],"cGroup":
["blueKO"],"trait":"kickOffBarrier","curve":-180},{"x":0,"y":-
180,"bCoef":0.1,"cMask":["red","blue"],"cGroup":
["redKO"],"trait":"kickOffBarrier","curve":180},{"x":0,"y":180,"bCoef":0.1,"cMask":
["red","blue"],"cGroup":["redKO"],"trait":"kickOffBarrier","curve":180},{"x":-
1030,"y":-40,"bCoef":-5.7,"cMask":["ball"],"cGroup":
["c0"],"trait":"line","curve":70,"color":"576C46","vis":false},{"x":-
1030,"y":40,"bCoef":-5.7,"cMask":["ball"],"cGroup":
["c0"],"trait":"line","curve":70,"color":"576C46","vis":false},{"x":1030,"y":-
40,"bCoef":-5.7,"cMask":["ball"],"cGroup":["c0"],"trait":"line","curve":-
70,"color":"576C46","vis":false},{"x":1030,"y":40,"bCoef":-5.7,"cMask":
["ball"],"cGroup":["c0"],"trait":"line","curve":-70,"color":"576C46","vis":false},
{"x":1030,"y":-40,"trait":"line","color":"576C46"},
{"x":1030,"y":40,"trait":"line","color":"576C46"},{"x":-1030,"y":-
40,"trait":"line","color":"576C46"},{"x":-
1030,"y":40,"trait":"line","color":"576C46"},{"x":0,"y":3,"trait":"line"},
{"x":0,"y":-3,"trait":"line"},{"x":-1300,"y":-460,"bCoef":0,"cMask":
["c1"],"cGroup":["red","blue"],"color":"ec644b","vis":false},{"x":1300,"y":-
460,"bCoef":0,"cMask":["c1"],"cGroup":["red","blue"],"color":"ec644b","vis":false},
{"x":-1300,"y":460,"bCoef":0,"cMask":["c1"],"cGroup":
["red","blue"],"color":"ec644b","vis":false},{"x":1300,"y":460,"bCoef":0,"cMask":
["c1"],"cGroup":["red","blue"],"color":"ec644b","vis":false},{"x":-1295,"y":-
320,"cMask":["c0"],"cGroup":["red","blue"]},{"x":-840,"y":-320,"cMask":
["c0"],"cGroup":["red","blue"]},{"x":-840,"y":320,"cMask":["c0"],"cGroup":
["red","blue"]},{"x":-1295,"y":320,"cMask":["c0"],"cGroup":["red","blue"]},
{"x":1295,"y":-320,"cMask":["c0"],"cGroup":["red","blue"]},{"x":840,"y":-
320,"cMask":["c0"],"cGroup":["red","blue"]},{"x":840,"y":320,"cMask":
["c0"],"cGroup":["red","blue"]},{"x":1295,"y":320,"cMask":["c0"],"cGroup":
["red","blue"]},{"x":-1150,"y":-124,"bCoef":0.1,"cMask":["ball","red","blue"]},
{"x":-1210,"y":-124,"bCoef":0.1,"cMask":["red","blue"],"bias":0,"curve":5},{"x":-
1150,"y":124,"bCoef":0.1,"cMask":["ball","red","blue"]},{"x":-
1210,"y":124,"bCoef":0.1,"cMask":["red","blue"],"bias":0,"curve":5},{"x":-
1250,"y":-158,"bCoef":0,"cMask":["ball"]},{"x":-1250,"y":158,"bCoef":0,"cMask":
["ball"]},{"x":1150,"y":124,"bCoef":0.1,"cMask":["ball","red","blue"]},
{"x":1210,"y":124,"bCoef":0.1,"cMask":["red","blue"],"curve":-5},{"x":1150,"y":-
124,"bCoef":0.1,"cMask":["ball","red","blue"]},{"x":1210,"y":-
124,"bCoef":0.1,"cMask":["red","blue"],"curve":-5},{"x":1250,"y":-
158,"bCoef":0,"cMask":["ball"]},{"x":1250,"y":158,"bCoef":0,"cMask":
["ball"]}],"segments":[{"v0":0,"v1":1,"trait":"kickOffBarrier"},
{"v0":2,"v1":3,"trait":"kickOffBarrier"},{"v0":4,"v1":5,"trait":"line","y":320},
{"v0":5,"v1":7,"trait":"line","x":840},{"v0":6,"v1":7,"trait":"line","y":-320},
{"v0":8,"v1":9,"trait":"line","y":180},{"v0":9,"v1":11,"trait":"line","x":1030},
{"v0":10,"v1":11,"trait":"line","y":-180},{"v0":12,"v1":13,"curve":-
130,"trait":"line","x":840},{"v0":14,"v1":15,"trait":"line","y":-320},
{"v0":15,"v1":17,"trait":"line","x":-840},{"v0":16,"v1":17,"trait":"line","y":320},
{"v0":18,"v1":19,"trait":"line","y":-175},{"v0":19,"v1":21,"trait":"line","x":-
1030},{"v0":20,"v1":21,"trait":"line","y":175},{"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":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"v0":30,"v1":31,"curve":90,"bCoef":-2.9,"cMask":
["ball"],"cGroup":["c0"],"trait":"line"},{"v0":32,"v1":33,"curve":90,"bCoef":-
2.9,"cMask":["ball"],"cGroup":["c0"],"trait":"line"},
{"v0":34,"v1":35,"curve":90,"bCoef":-2.9,"cMask":["ball"],"cGroup":
["c0"],"trait":"line"},{"v0":37,"v1":36,"curve":-
180,"vis":false,"bCoef":0.1,"cGroup":["blueKO"],"trait":"kickOffBarrier"},
{"v0":39,"v1":40,"curve":70,"vis":false,"color":"576C46","bCoef":-5.7,"cMask":
["ball"],"cGroup":["c0"],"trait":"line","x":-1030},{"v0":41,"v1":42,"curve":-
70,"vis":false,"color":"576C46","bCoef":-5.7,"cMask":["ball"],"cGroup":
["c0"],"trait":"line","x":1030},
{"v0":37,"v1":38,"curve":180,"vis":false,"bCoef":0.1,"cMask":
["red","blue"],"cGroup":["redKO"],"trait":"kickOffBarrier"},
{"v0":43,"v1":44,"vis":true,"color":"576C46","trait":"line","x":1030},
{"v0":45,"v1":46,"vis":true,"color":"576C46","trait":"line","x":-1030},
{"v0":47,"v1":48,"curve":-180,"trait":"line","x":-935},
{"v0":47,"v1":48,"curve":180,"trait":"line","x":-935},
{"v0":47,"v1":48,"curve":90,"trait":"line","x":-935},{"v0":47,"v1":48,"curve":-
90,"trait":"line","x":-935},{"v0":47,"v1":48,"trait":"line","x":-935},
{"v0":49,"v1":50,"vis":false,"color":"ec644b","bCoef":0,"cMask":["c1"],"cGroup":
["red","blue"],"y":-460},
{"v0":51,"v1":52,"vis":false,"color":"ec644b","bCoef":0,"cMask":["c1"],"cGroup":
["red","blue"],"y":460},{"v0":53,"v1":54,"vis":false,"color":"ec644b","cMask":
["c0"],"cGroup":["red","blue"]},
{"v0":54,"v1":55,"vis":false,"color":"ec644b","cMask":["c0"],"cGroup":
["red","blue"]},{"v0":55,"v1":56,"vis":false,"color":"ec644b","cMask":
["c0"],"cGroup":["red","blue"]},{"v0":57,"v1":58,"vis":false,"cMask":
["c0"],"cGroup":["red","blue"]},{"v0":58,"v1":59,"vis":false,"cMask":
["c0"],"cGroup":["red","blue"]},{"v0":59,"v1":60,"vis":false,"cMask":
["c0"],"cGroup":["red","blue"]},
{"v0":61,"v1":62,"color":"FFFFFF","bCoef":0.1,"cMask":["ball","red","blue"],"y":-
124},{"v0":63,"v1":64,"color":"FFFFFF","bCoef":0.1,"cMask":
["ball","red","blue"],"y":124},
{"v0":64,"v1":62,"curve":5,"color":"FFFFFF","bCoef":0.1,"cMask":
["ball","red","blue"],"bias":0},
{"v0":62,"v1":65,"color":"FFFFFF","bCoef":0,"cMask":["ball"]},
{"v0":64,"v1":66,"color":"FFFFFF","bCoef":0,"cMask":["ball"]},
{"v0":67,"v1":68,"color":"FFFFFF","bCoef":0.1,"cMask":
["ball","red","blue"],"y":124},
{"v0":69,"v1":70,"color":"FFFFFF","bCoef":0.1,"cMask":["ball","red","blue"],"y":-
124},{"v0":68,"v1":70,"curve":-5,"color":"FFFFFF","bCoef":0.1,"cMask":
["ball","red","blue"]},{"v0":70,"v1":71,"color":"FFFFFF","bCoef":0,"cMask":
["ball"]},{"v0":68,"v1":72,"color":"FFFFFF","bCoef":0,"cMask":["ball"]}],"goals":
[{"p0":[-1161.45,124],"p1":[-1161.45,-124],"team":"red"},{"p0":[1161.45,124],"p1":
[1161.45,-124],"team":"blue","radius":0,"invMass":1}],"discs":
[{"radius":0,"invMass":0,"pos":[-1311,-19],"color":"ffffffff","bCoef":0,"cMask":
["red"],"cGroup":["ball"]},{"radius":0,"invMass":0,"pos":[-
1310,29],"color":"ffffffff","bCoef":0,"cMask":["blue"],"cGroup":["ball"]},
{"radius":0,"invMass":0,"pos":[-1308,62],"color":"ffffffff","bCoef":0,"cMask":
["red","blue"],"cGroup":["ball"]},{"radius":2.7,"pos":[-1150,600],"cGroup":
["ball"],"trait":"cornerflag"},{"radius":2.7,"pos":[1150,-600],"cGroup":
["ball"],"trait":"cornerflag"},{"radius":2.7,"pos":[1150,600],"cGroup":
["ball"],"trait":"cornerflag","_data":{"mirror":{}}},{"radius":5,"invMass":0,"pos":
[-1150,-124],"bCoef":0.5,"trait":"goalPost"},{"radius":5,"invMass":0,"pos":[-
1150,124],"bCoef":0.5,"trait":"goalPost"},{"radius":2,"invMass":0,"pos":[-1250,-
158],"color":"000000","bCoef":1,"trait":"goalPost"},{"radius":2,"invMass":0,"pos":
[-1250,158],"color":"000000","bCoef":1,"trait":"goalPost"},
{"radius":5,"invMass":0,"pos":[1150,-124],"bCoef":0.5,"trait":"goalPost"},
{"radius":5,"invMass":0,"pos":[1150,124],"bCoef":0.5,"trait":"goalPost"},
{"radius":2,"invMass":0,"pos":[1250,-
158],"color":"000000","bCoef":1,"trait":"goalPost"},{"radius":2
,"invMass":0,"pos":[1250,158],"color":"000000","bCoef":1,"trait":"goalPost"},
{"radius":2.7,"pos":[-1150,-600],"cGroup":["ball"],"trait":"cornerflag"},
{"radius":0,"pos":[-1149,-460],"cMask":["none"]},{"radius":0,"pos":[1149,-
460],"cMask":["none"]},{"radius":0,"pos":[-1149,-460],"cMask":["none"]},
{"radius":0,"pos":[1149,-460],"cMask":["none"]},{"radius":0,"pos":[-
1149,460],"cMask":["none"]},{"radius":0,"pos":[1149,460],"cMask":["none"]},
{"radius":0,"pos":[-1149,460],"cMask":["none"]},{"radius":0,"pos":
[1149,460],"cMask":["none"]}],"planes":[{"normal":[0,1],"dist":-
627,"bCoef":0,"cGroup":["ball"],"trait":"ballArea","_data":{"extremes":{"normal":
[0,1],"dist":-627,"canvas_rect":[-1311,-675,1300,675],"a":[-1311,-627],"b":[1300,-
627]}}},{"normal":[0,-1],"dist":-627,"bCoef":0,"cGroup":
["ball"],"trait":"ballArea","_data":{"extremes":{"normal":[0,-1],"dist":-
627,"canvas_rect":[-1311,-675,1300,675],"a":[-1311,627],"b":[1300,627]}}},
{"normal":[0,1],"dist":-670,"bCoef":0,"_data":{"extremes":{"normal":[0,1],"dist":-
670,"canvas_rect":[-1311,-675,1300,675],"a":[-1311,-670],"b":[1300,-670]}}},
{"normal":[0,-1],"dist":-670,"bCoef":0,"_data":{"extremes":{"normal":[0,-
1],"dist":-670,"canvas_rect":[-1311,-675,1300,675],"a":[-1311,670],"b":
[1300,670]}}},{"normal":[1,0],"dist":-1300,"bCoef":0,"_data":{"extremes":{"normal":
[1,0],"dist":-1300,"canvas_rect":[-1311,-675,1300,675],"a":[-1300,-675],"b":[-
1300,675]}}},{"normal":[-1,0],"dist":-1300,"bCoef":0.1,"_data":{"extremes":
{"normal":[-1,0],"dist":-1300,"canvas_rect":[-1311,-675,1300,675],"a":[1300,-
675],"b":[1300,675]}}},{"normal":[1,0],"dist":-1230,"bCoef":0,"cMask":
["ball"],"cGroup":["ball"],"_data":{"extremes":{"normal":[1,0],"dist":-
1230,"canvas_rect":[-1311,-675,1300,675],"a":[-1230,-675],"b":[-1230,675]}}},
{"normal":[-1,0],"dist":-1230,"bCoef":0,"cMask":["ball"],"cGroup":["ball"],"_data":
{"extremes":{"normal":[-1,0],"dist":-1230,"canvas_rect":[-1311,-675,1300,675],"a":
[1230,-675],"b":[1230,675]}}}],"traits":{"ballArea":{"vis":false,"bCoef":0,"cMask":
["ball"],"cGroup":["ball"]},"goalPost":{"radius":5,"invMass":0,"bCoef":1,"cGroup":
["ball"]},"rightNet":{"radius":0,"invMass":1,"bCoef":0,"cGroup":
["ball","c3"]},"leftNet":{"radius":0,"invMass":1,"bCoef":0,"cGroup":
["ball","c2"]},"stanchion":{"radius":3,"invMass":0,"bCoef":3,"cMask":
["none"]},"cornerflag":
{"radius":3,"invMass":0,"bCoef":0.2,"color":"FFFF00","cMask":
["ball"]},"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"}},"joints":
[{"d0":16,"d1":17,"strength":"rigid","color":"ec7458","length":null},
{"d0":18,"d1":19,"strength":"rigid","color":"48bef9","length":null},
{"d0":20,"d1":21,"strength":"rigid","color":"ec7458","length":null},
{"d0":22,"d1":23,"strength":"rigid","color":"48bef9","length":null}],"redSpawnPoint
s":[],"blueSpawnPoints":[],"canBeStored":false}`;

return realSoccerMap;
}

/*------------------------------ END OF STADIUMS ----------------------------*/

// ------------------------------------------------
// Global Variables
// ------------------------------------------------
var roomName = "️🏆Sân Tập Của Utano🏆";
var roomPassword = null;
var maxPlayers = 30;
var roomPublic = true;
var token = "";
var roomLink = "";
var gameTime = 10; //default game time if 0 is selected
var map = "RSR";
var superAdmins = [];

var room = HBInit({


roomName: roomName,
password: roomPassword,
maxPlayers: maxPlayers,
public: roomPublic,
geo: {"code": "VN", "lat": 16.8, "lon": 107.0},
noPlayer: true,
token: token
});

// -------------------------------------------------
// Classes
// -------------------------------------------------
class Game {
constructor() {
[Link] = 0;
[Link] = false;
[Link];
[Link] = 0;
[Link] = true;
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = 1000;
[Link];
[Link];
[Link];
[Link];
[Link] = "";
[Link] = 0;
[Link] = false;
[Link] = false;
[Link] = 0;
[Link];
[Link] = false;
[Link] = false;
[Link];
[Link] = false;
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = false;
}

updateLastKicker(id, name, team) {


[Link] = [Link];
[Link] = [Link];
[Link] = [Link];

[Link] = id;
[Link] = name;
[Link] = team;
}
}

[Link](getRealSoccerMap());
[Link](0);
[Link](10);

[Link] = function(url) {
roomLink = url;
[Link](roomLink);
}
[Link] = function(newStadiumName, byPlayer) {
if (byPlayer != null) {
map = "custom";
}
else {
map = "RSR";
}
}

[Link] = function(player) {
[Link]([Link] + " joined the room");
whisper("⚽ chào mừng đến với sân tập của Utano ⚽", [Link],
0x61ddff, "bold", 0);
whisper("⚽ ghi !help để biết thêm ⚽", [Link], 0x61e7ff, "bold",
0);
displayAdminMessage();
}

[Link] = function(player) {
displayAdminMessage();
[Link]([Link] + " left the room");

let index = [Link]([Link]);


if (index > -1) {
sleep(100).then(() => {
[Link](index, 1);
});
}
}

[Link] = function(changedPlayer, byPlayer) {


if (byPlayer != null) {
if ([Link] != [Link]) {
if ([Link]([Link]) > -1) {
[Link]([Link], "You cannot remove a Super
Admin", false);
[Link]([Link], true);
}
}
else {
if ([Link] == false) {
let index = [Link]([Link]);
if (index > -1) {
[Link](index, 1);
}
}
}
}
}

[Link] = function(byPlayer) {
if (map == "RSR") {
[Link](0, {invMass: 1.05});
if (byPlayer == null) {
game = new Game();
announce("Game length set to " + gameTime + " minutes");
}
else {
if ([Link]().timeLimit != 0) {
gameTime = [Link]().timeLimit / 60;
}
else {
gameTime = 10;
}
[Link]();
[Link](0);
[Link]();
}
}
}

[Link] = function(byPlayer) {
if (map == "RSR") {
if (byPlayer != null) {
[Link](gameTime);
}
}
}

[Link] = function(player) {
if (map == "RSR") {
[Link] = [Link];
[Link]([Link], [Link], [Link]);

//=========== POWERSHOT CODE ===========


if (powerShotMode == true) {
if ([Link] > 100) {
[Link](0, {xgravity: -
[Link]([Link]).yspeed/30, ygravity: -
[Link]([Link]).yspeed/30});
[Link] = 450;
[Link]("POWERSHOT APPLIED!", [Link],
0x33dddd, "bold", 1);
}
[Link] = 0;
[Link] = 0;
[Link] = false;
if (parseFloat([Link](0).[Link](2)) !=
1.05) {
[Link](0, {invMass: 1.05});
}
}
//=========== POWERSHOT CODE ===========

if ([Link] == true) {
var players = [Link]().filter((player) => [Link]
!= 0);
[Link](function(player) {
if
([Link]([Link]).[Link](1) != 0.3) {
[Link]([Link], {invMass:
0.3});
}
});
}

if ([Link] == false && [Link] == true && ([Link] ==


true || [Link] == true)) { // make game active on kick from CK/GK
[Link] = true;

[Link] = true;
[Link] = false;
[Link](1, {x: 2000, y: 2000 });
[Link](2, {x: 2000, y: 2000 });
[Link](0, {color: "0xffffff"});
[Link] = 1000000;
[Link]++;

// set gravity for real soccer corners/goalkicks


if ([Link] == true) {
[Link](0, {xgravity:
[Link]([Link]).xspeed/16*-1, ygravity:
[Link]([Link]).yspeed/16*-1});
}
if ([Link] == true) {
[Link](0, {xgravity: 0, ygravity:
[Link]([Link]).yspeed/20*-1});
}

[Link] = false;
[Link] = false;
[Link] = "";
}

if ([Link] == false && ([Link] == "redThrow" ||


[Link] == "blueThrow")) {
[Link] = "";
[Link] = true;
[Link] = false;
[Link](0, {color: "0xffffff"});
[Link] = 1000000;
[Link]++;
}
}
}

[Link] = function(kickedPlayer, reason, ban, byPlayer) {


if ([Link]([Link]) > -1 && byPlayer != null) {
[Link]([Link], "You cannot kick/ban a Super Admin",
false);
[Link]();
}
}

[Link] = function(player, message) {


[Link]([Link] + ": " + message);
if ([Link]("!")) {
message = [Link](1);
let args = [Link](" ");

if (args[0] == "admin" && [Link] == 1 && allowPublicAdmin == true)


{
if (isAdminPresent() == false) {
[Link]([Link], true);
}
else {
whisper("Admin is already present or !admin command is not
allowed", [Link]);
}
}
else if (args[0] == "admin" && [Link] == 2) {
if (args[1] == superAdminCode) {
[Link]([Link], true);
if ([Link]([Link]) === -1) {
[Link]([Link]);
}
announce([Link] + " has gained Super Admin");
}
}
else if (args[0] == "clearbans") {
if ([Link]) {
[Link]();
announce("Bans have been cleared by " + [Link]);
}
else {
whisper("Admin only command", [Link]);
}
}
else if (args[0] == "court" && [Link] == 1) {
whisper("Current background color is " + mapBGColor);
}
else if (args[0] == "court" && [Link] == 2 && [Link]) {
if ([Link]() == null) {
if (args[1] == "reset") {
mapBGColor = "86A578";
announce("Map background color reset by " +
[Link]);
}
else {
mapBGColor = args[1];
announce("Map background color set to " + args[1] + "
by " + [Link]);
}
[Link](getRealSoccerMap());
}
else {
whisper("Cannot change map background color while game in
progress", [Link]);
}
}
else if (args[0] == "swap") {
if ([Link]) {
if ([Link] == 1) {
var players = [Link]().filter((player) =>
[Link] != 0 );
if ( [Link] == 0 ) return false;
[Link](function(player) {
if ([Link] == 1) {
[Link]([Link], 2);
}
if ([Link] == 2) {
[Link]([Link], 1);
}
});
announce("🔄 Teams have been swapped");
}
}
else {
whisper("Admin only command", [Link]);
}
}
else if (args[0] == "setpassword" && [Link]) {
if ([Link]([Link]) > -1) {
[Link](args[1]);
roomPassword = args[1];
announce("Password has been changed by " + [Link]);
}
else {
whisper("Only Super Admins can change password",
[Link]);
}
}
else if (args[0] == "clearpassword" && [Link]) {
if ([Link]([Link]) > -1) {
[Link](null);
roomPassword = null;
announce("Password has been cleared by " + [Link]);
}
else {
whisper("Only Super Admins can clear password", [Link]);
}
}
else if (args[0] == "rs" && [Link]) {
if ([Link]() == null) {
[Link](getRealSoccerMap());
}
else {
whisper("Cannot change map while game in progress",
[Link]);
}
}
else if (args[0] == "rr" && [Link]) {
[Link]();
[Link]();
}
else if (args[0] == "bb") {
[Link]([Link], "Bye", false);
}
else if ((args[0] == "powershot" || args[0] == "ps") && [Link]) {
if (powerShotMode == false) {
powerShotMode = true;
announce("POWERSHOT MODE ACTIVATED BY " + [Link],
null, 0x00FF00);
}
else {
powerShotMode = false;
announce("POWERSHOT MODE DEACTIVATED BY " + [Link],
null, 0xFF0000);
}
}
else if (args[0] == "help") {
displayHelp([Link], args[1]);
}
else if (args[0] == "super") {
let superMsg = "Super Admins: ";
[Link](function(id) {
if ([Link](id) != null || [Link](id) !=
undefined) {
superMsg = superMsg + [Link](id).name + ", ";
}
});
if ([Link] > 0) {
superMsg = [Link](0, -2);
}
else {
superMsg = "There are no super admins present";
}
whisper(superMsg, [Link]);
}
return false;
}
if ([Link]("t ")) {
teamMsg = [Link](1).trim();
if ([Link] == 1) {
var players = [Link]().filter((player) => [Link]
== 1);
[Link](function(teamPlayer) {
[Link]("[Team] " + [Link] + ": " +
teamMsg, [Link], 0xED6A5A, "normal", 1);
});
}
if ([Link] == 2) {
var players = [Link]().filter((player) => [Link]
== 2);
[Link](function(teamPlayer) {
[Link]("[Team] " + [Link] + ": " +
teamMsg, [Link], 0x5995ED, "normal", 1);
});
}
if ([Link] == 0) {
var players = [Link]().filter((player) => [Link]
== 0);
[Link](function(teamPlayer) {
[Link]("[Spec] " + [Link] + ": " +
teamMsg, [Link], 0xdee7fa, "normal", 1);
});
}
return false;
}
if ([Link]("@@")) {
message = [Link](2).trim();
if ([Link](' ') !== -1) {
let args = [Link](/^(\S+)\s(.*)/).slice(1);

if ([Link] > 1) {
var pmMsg = args[1];
var players = [Link]();
var pmSent = false;
[Link](function(pmPlayer) {
if ([Link] === args[0] || [Link] ===
args[0].replace(/_/g, ' ')) {
whisper("[PM > " + [Link] + "] " +
[Link] + ": " + pmMsg, [Link], 0xff20ff, "normal", 1);
whisper("[PM] " + [Link] + ": " + pmMsg,
[Link], 0xff20ff, "normal", 1);
pmSent = true;
}
});
if (pmSent == false) {
whisper("Cannot find user '" + args[0] + "'",
[Link], 0xff20ff, "normal", 1);
}
return false;
}
}
}
}

function displayHelp(id, selection) {


if (selection == null) {
whisper("Commands: !rs, !rr, !bb, !powershot, !ps, !admin, !
setpassword, !clearpassword, !super, !clearbans, !swap, t [team chat msg], !
court, !court [hexcolor], !court reset", id, null, "small");
}
}

[Link] = function(changedPlayer, byPlayer) {


if (map == "RSR") {
if ([Link]() != null) {
if ([Link] == false) {
[Link]().forEach(function(player) {
if (player != undefined) {
if ([Link] == true || [Link] ==
true) {
[Link]([Link],
{invMass: 9999999});
}
}
});
}
}
}
}

[Link] = function(team) {
if (map == "RSR") {
[Link] = false;

let goalTime = secondsToMinutes([Link]([Link]().time));


let scorer;
let assister = "";
let goalType;
if (team == 1) {
if ([Link] == 1) { //if goal type is goal
goalType = "GOAL!";
scorer = "⚽" + [Link];
avatarCelebration([Link], "⚽");
if ([Link] == 1 && [Link] !=
[Link]) { // if assist is from teammate
assister = " (Assist: " + [Link] +
")";
avatarCelebration([Link], "");
}
}
if ([Link] == 2) { //if goal type is owngoal
goalType = "OWN GOAL!";
scorer = "🐸" + [Link];
avatarCelebration([Link], "🐸");
if ([Link] == 1) { // if owngoal was
assisted
assister = " (Assist: " + [Link] +
")";
avatarCelebration([Link], "");
}
}
[Link]++;
}
if (team == 2) {
if ([Link] == 2) { //if goal type is goal
goalType = "GOAL!";
scorer = "⚽" + [Link];
avatarCelebration([Link], "⚽");
if ([Link] == 2 && [Link] !=
[Link]) { // if assist is from teammate
assister = " (Assist: " + [Link] +
")";
avatarCelebration([Link], "");
}
}
if ([Link] == 1) { //if goal type is owngoal
goalType = "OWN GOAL!";
scorer = "🐸" + [Link];
avatarCelebration([Link], "🐸");
if ([Link] == 2) { // if owngoal was
assisted
assister = " (Assist: " + [Link] +
")";
avatarCelebration([Link], "");
}
}
[Link]++;
}
announce(goalType + " 🟥 " + [Link] + " - " + [Link] +
" 🟦 🕒" + goalTime + " " + scorer + assister);
[Link] = undefined;
[Link] = undefined;
[Link] = undefined;
[Link] = undefined;
}
}

[Link] = function() {
if (map == "RSR") {
if ([Link] == true) {
[Link](true);
[Link] = false;
announce("END");
}
}
}

[Link] = function() {
if (map == "RSR") {
updateGameStatus();
handleBallTouch();
realSoccerRef();
}
}

function realSoccerRef() {
blockThrowIn();
blockGoalKick();
removeBlock();
if ([Link] == gameTime * 60 && [Link] == false) {
extraTime();
[Link] = true;
}

if ([Link] == [Link] && [Link] == false) {


announce("Last play", null, null, null, 1);
[Link] = true;
}

if ([Link] == true || [Link] == true) { //add extra time


[Link]++;
}

if ([Link] < 99999 && [Link] == false && [Link] == false &&
[Link] == true) {
[Link]++;
}

if ([Link] < 150 && [Link] == false && [Link] ==


false) {
[Link]++;
if ([Link] > 5) {
[Link](0, {xgravity:
[Link](0).xgravity * 0.97, ygravity:
[Link](0).ygravity * 0.97});
}
if ([Link] == 150) {
[Link](0, {xgravity: 0, ygravity: 0});
}
}

if ([Link] == true) {
[Link]++;
}

if ([Link] > 30) {


[Link] = false;
[Link] = 0;
[Link](0, {cMask: 63});
}

if ([Link]().x == 0 && [Link]().y == 0) {


[Link] = true;
[Link] = "";
}
if ([Link] == false && [Link] == true) { //expire barrier time
if ([Link] == "redThrow") {
if ([Link] == throwTimeOut - 120) { // warning indicator
ballWarning("0xff3f34", ++[Link]);
}
if ([Link] == throwTimeOut && [Link] == false)
{ // switch to blue throw
[Link] = "blueThrow";
[Link] = 0;
[Link](3, {x: 0, y: 2000, radius: 0});
sleep(100).then(() => {
[Link](0, {color: "0x0fbcf9", xspeed:
0, yspeed: 0, x: [Link], y: [Link]});
});
}
}
else if ([Link] == "blueThrow") {
if ([Link] == throwTimeOut - 120) { // warning indicator
ballWarning("0x0fbcf9", ++[Link]);
}
if ([Link] == throwTimeOut && [Link] == false)
{ // switch to red throw
[Link] = "redThrow";
[Link] = 0;
[Link](3, {x: 0, y: 2000, radius: 0});
sleep(100).then(() => {
[Link](0, {color: "0xff3f34", xspeed:
0, yspeed: 0, x: [Link], y: [Link]});
});
}
}
else if ([Link] == "blueGK" || [Link] == "redGK") {
if ([Link] == gkTimeOut - 120) { // warning indicator
if ([Link] == "blueGK") {
ballWarning("0x0fbcf9", ++[Link]);
}
if ([Link] == "redGK") {
ballWarning("0xff3f34", ++[Link]);
}
}
if ([Link] == gkTimeOut) {
[Link] = "";
[Link](0, {color: "0xffffff"});
[Link] = 1000000;
}
}
else if ([Link] == "blueCK" || [Link] == "redCK") {
if ([Link] == ckTimeOut - 120) {
if ([Link] == "blueCK") {
ballWarning("0x0fbcf9", ++[Link]);
}
if ([Link] == "redCK") {
ballWarning("0xff3f34", ++[Link]);
}
}
if ([Link] == ckTimeOut) {
[Link] = "";
[Link](1, {x: 0, y: 2000, radius: 0});
[Link](2, {x: 0, y: 2000, radius: 0});
[Link](0, {color: "0xffffff"});
[Link] = 1000000;
}
}
}

if ([Link] == true) {
if (([Link]().y > 611.45 || [Link]().y < -
611.45)) {
[Link] = false;
if ([Link] == true) {
[Link](true);
[Link] = false;
announce("END");
}

[Link](0, {xgravity: 0, ygravity: 0});

[Link] = [Link]([Link]().x * 10)


/ 10;
if ([Link]().y > 611.45) {
[Link] = 400485;
[Link] = 610;
}
if ([Link]().y < -611.45) {
[Link] = -400485;
[Link] = -610;
}
if ([Link]().x > 1130) {
[Link] = 1130;
}
if ([Link]().x < -1130) {
[Link] = -1130;
}

if ([Link] == 1) {
[Link](3, {x: [Link], y:
[Link], radius: 18 });
sleep(100).then(() => {
[Link] = "blueThrow";
[Link] = false;
[Link] = 0;
[Link] = true;
[Link](0, {xspeed: 0, yspeed: 0, x:
[Link], y: [Link], xgravity: 0, ygravity: 0});
//announce(" Throw In: 🔵 Blue");
[Link](0, {color: "0x0fbcf9"});

});
sleep(100).then(() => {
[Link](3, {x: 0, y: 2000, radius:
0});
});
}
else {
[Link](3, {x: [Link], y:
[Link], radius: 18 });
sleep(100).then(() => {
[Link] = "redThrow";
[Link] = false;
[Link] = 0;
[Link] = true;
[Link](0, {xspeed: 0, yspeed: 0, x:
[Link], y: [Link], xgravity: 0, ygravity: 0});
//announce(" Throw In: 🔴 Red");
[Link](0, {color: "0xff3f34"});

});
sleep(100).then(() => {
[Link](3, {x: 0, y: 2000, radius:
0});
});
}
}

if ([Link]().x > 1161.45 && ([Link]().y >


124 || [Link]().y < -124)) {
[Link] = false;
if ([Link] == true) {
[Link](true);
[Link] = false;
announce("END");
}
[Link](0, {xgravity: 0, ygravity: 0});
[Link]().forEach(function(player) {
[Link]([Link], {invMass: 100000});
});

if ([Link] == 1) {
[Link](3, {x: 1060, y: 0, radius: 18 });
sleep(100).then(() => {
[Link] = "blueGK";
[Link] = 0;
[Link] = true;
//announce("🥅 Goal Kick: 🔵 Blue");
[Link] = true;
[Link] = 0;
[Link] = 0;
[Link] = false;
[Link](0, {xspeed: 0, yspeed: 0, x:
1060, y: 0, color: "0x0fbcf9", cMask: 268435519, xgravity: 0, ygravity: 0});
});
sleep(3000).then(() => {
[Link](3, {x: 0, y: 2000, radius:
0});
});
}
else {
//announce("🚩 Corner Kick: 🔴 Red");

[Link] = 0;
if ([Link]().y < -124) {
[Link](3, {x: 1140, y: -590, radius:
18 });
sleep(100).then(() => {
[Link] = true;
[Link] = "redCK";
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = false;
[Link](0, {x: 1140, y: -590,
xspeed: 0, yspeed: 0, color: "0xff3f34", cMask: 268435519, xgravity: 0, ygravity:
0});
[Link](2, {x: 1150, y: -670,
radius: 420 });
[Link](3, {x: 0, y: 2000,
radius: 0});
});
}
if ([Link]().y > 124) {
[Link](3, {x: 1140, y: 590, radius:
18 });
sleep(100).then(() => {
[Link] = true;
[Link] = "redCK";
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = false;
[Link](0, {x: 1140, y: 590,
xspeed: 0, yspeed: 0, color: "0xff3f34", cMask: 268435519, xgravity: 0, ygravity:
0});
[Link](2, {x: 1150, y: 670,
radius: 420 });
[Link](3, {x: 0, y: 2000,
radius: 0});
});
}
}
}
if ([Link]().x < -1161.45 && ([Link]().y >
124 || [Link]().y < -124)) {
[Link] = false;
if ([Link] == true) {
[Link](true);
[Link] = false;
announce("END");
}
[Link](0, {xgravity: 0, ygravity: 0});
[Link]().forEach(function(player) {
[Link]([Link], {invMass: 100000});
});

if ([Link] == 1) {
//announce("🚩 Corner Kick: 🔵 Blue");
[Link] = 0;
if ([Link]().y < -124) {
[Link](3, {x: -1140, y: -590, radius:
18 });
sleep(100).then(() => {
[Link] = true;
[Link] = "blueCK";
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = false;
[Link](0, {x: -1140, y: -590,
xspeed: 0, yspeed: 0, color: "0x0fbcf9", cMask: 268435519, xgravity: 0, ygravity:
0});
[Link](1, {x: -1150, y: -670,
radius: 420 });
[Link](3, {x: 0, y: 2000,
radius: 0});
});
}
if ([Link]().y > 124) {
[Link](3, {x: -1140, y: 590, radius:
18 });
sleep(100).then(() => {
[Link] = true;
[Link] = "blueCK";
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = false;
[Link](0, {x: -1140, y: 590,
xspeed: 0, yspeed: 0, color: "0x0fbcf9", cMask: 268435519, xgravity: 0, ygravity:
0});
[Link](1, {x: -1150, y: 670,
radius: 420 });
[Link](3, {x: 0, y: 2000,
radius: 0});
});
}
}
else {
[Link](3, {x: -1060, y: 0, radius: 18 });
sleep(100).then(() => {
[Link] = "redGK";
[Link] = 0;
[Link] = true;
//announce("🥅 Goal Kick: 🔴 Red");
[Link] = true;
[Link] = 0;
[Link] = 0;
[Link] = false;
[Link](0, {xspeed: 0, yspeed: 0, x: -
1060, y: 0, color: "0xff3f34", cMask: 268435519, xgravity: 0, ygravity: 0});
});
sleep(3000).then(() => {
[Link](3, {x: 0, y: 2000, radius:
0});
});
}
}
}
}

function handleBallTouch() {
var players = [Link]();
var ballPosition = [Link]();
var ballRadius = [Link];
var playerRadius = 15;
var triggerDistance = ballRadius + playerRadius + 0.01;

for (var i = 0; i < [Link]; i++) { // Iterate over all the players
var player = players[i];
if ( [Link] == null ) continue;
var distanceToBall = pointDistance([Link], ballPosition);
if ( distanceToBall < triggerDistance ) {
[Link] = [Link];
[Link] = false;

//=========== POWERSHOT CODE ===========


if ([Link] == false && [Link] == false &&
[Link] != "blueThrow" && [Link] != "redThrow" && powerShotMode ==
true) {
if ([Link] != [Link]) {
[Link] = [Link];
[Link] = false;
[Link] = 0;
} else {
[Link]++;
//[Link]("Powershot counter: " +
[Link], null, 0x333333, "small-bold", 0);
if ([Link] > 100 &&
[Link] == false && [Link]([Link](0).invMass) !=
2) {
[Link](0, {invMass: 2});
[Link]("POWERSHOT ACTIVATED!",
[Link], 0x33dd33, "bold", 1);
[Link] = true;
}
}
}
//=========== POWERSHOT CODE ===========

if ([Link] == false &&


[Link](0).xgravity != 0) {
[Link](0, {xgravity: 0, ygravity:0});
[Link] = 10000;
}
}
//=========== POWERSHOT CODE ===========
if ( distanceToBall > triggerDistance +3 && [Link] ==
[Link] && [Link] == true && powerShotMode == true) {
[Link] = false;
[Link] = 0;
[Link] = 0;
if (parseFloat([Link](0).[Link](2)) !=
1.05) {
[Link](0, {invMass: 1.05});
[Link]("POWERSHOT CANCELLED!",
[Link], 0xdd3333, "bold", 2);
}
}
//=========== POWERSHOT CODE ===========
}
}

function updateGameStatus() {
[Link] = [Link]([Link]().time);
[Link] = [Link](0).radius;
}

function announce(msg, targetId, color, style, sound) {


if (color == null) {
color = 0xFFFD82;
}
if (style == null) {
style = "bold";
}
if (sound == null) {
sound = 0;
}
[Link](msg, targetId, color, style, sound);
[Link]("Announce: " + msg);
}

function whisper(msg, targetId, color, style, sound) {


if (color == null) {
color = 0x66C7FF;
}
if (style == null) {
style = "normal";
}
if (sound == null) {
sound = 0;
}
[Link](msg, targetId, color, style, sound);
if ([Link](targetId) != null) {
[Link]("Whisper -> " + [Link](targetId).name + ": " +
msg);
}
}

function isAdminPresent() {
var players = [Link]();
if ([Link]((player) => [Link]) != null) {
return true;
}
else {
return false;
}
}

function displayAdminMessage() {
if (isAdminPresent() == false && allowPublicAdmin == true) {
announce("No admin present: Type !admin to take control");
}
}

function pointDistance(p1, p2) {


var d1 = p1.x - p2.x;
var d2 = p1.y - p2.y;
return [Link](d1 * d1 + d2 * d2);
}

function sleep (time) {


return new Promise((resolve) => setTimeout(resolve, time));
}

function ballWarning(origColour, warningCount) {


sleep(200).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: "0xffffff"});
}
});
sleep(400).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: origColour});
}
});
sleep(600).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: "0xffffff"});
}
});
sleep(800).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: origColour});
}
});
sleep(1000).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: "0xffffff"});
}
});
sleep(1200).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: origColour});
}
});
sleep(1400).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: "0xffffff"});
}
});
sleep(1600).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: origColour});
}
});
sleep(1675).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: "0xffffff"});
}
});
sleep(1750).then(() => {
if ([Link] == warningCount) {
[Link](0, {color: origColour});
}
});
}

function extraTime() {
var extraSeconds = [Link]([Link] / 60);
[Link] = (gameTime * 60) + extraSeconds;
announce("Extra time: " + extraSeconds + " Seconds", null, null, null, 1);
}

function avatarCelebration(playerId, avatar) {


[Link](playerId, avatar);
sleep(250).then(() => {
[Link](playerId, null);
});
sleep(500).then(() => {
[Link](playerId, avatar);
});
sleep(750).then(() => {
[Link](playerId, null);
});
sleep(1000).then(() => {
[Link](playerId, avatar);
});
sleep(1250).then(() => {
[Link](playerId, null);
});
sleep(1500).then(() => {
[Link](playerId, avatar);
});
sleep(1750).then(() => {
[Link](playerId, null);
});
sleep(2000).then(() => {
[Link](playerId, avatar);
});
sleep(2250).then(() => {
[Link](playerId, null);
});
sleep(2500).then(() => {
[Link](playerId, avatar);
});
sleep(2750).then(() => {
[Link](playerId, null);
});
sleep(3000).then(() => {
[Link](playerId, avatar);
});
sleep(3250).then(() => {
[Link](playerId, null);
});
}

function secondsToMinutes(time) {
// Hours, minutes and seconds
var hrs = ~~(time / 3600);
var mins = ~~((time % 3600) / 60);
var secs = ~~time % 60;

// Output like "1:01" or "4:03:59" or "123:03:59"


var ret = "";
if (hrs > 0) {
ret += "" + hrs + ":" + (mins < 10 ? "0" : "");
}
ret += "" + mins + ":" + (secs < 10 ? "0" : "");
ret += "" + secs;
return ret;
}

function blockThrowIn() {
var players = [Link]().filter((player) => [Link] != 0);
if ([Link]().y < 0) { // top throw line
if ([Link] == "redThrow") {
[Link](function(player) {
if ([Link]([Link]).invMass !=
9999999) {
[Link]([Link], {invMass:
9999999});
}
if ([Link] == 2 &&
[Link]([Link]).y < 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y < -460) {
[Link]([Link], {y: -
445});
}
}
if ([Link] == 1 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link](17).x != 1149) { // show top red
line
[Link](17, {x: 1149});
}
if ([Link](19).x != -1149) { // hide top
blue line
[Link](19, {x: -1149});
}
});
}
if ([Link] == "blueThrow") {
[Link](function(player) {
if ([Link]([Link]).invMass !=
9999999) {
[Link]([Link], {invMass:
9999999});
}
if ([Link] == 1 &&
[Link]([Link]).y < 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y < -460) {
[Link]([Link], {y: -
445});
}
}
if ([Link] == 2 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link](19).x != 1149) { // show top
blue line
[Link](19, {x: 1149});
}
if ([Link](17).x != -1149) { // hide top
red line
[Link](17, {x: -1149});
}
});
}
}
if ([Link]().y > 0) { // bottom throw line
if ([Link] == "redThrow") {
[Link](function(player) {
if ([Link]([Link]).invMass !=
9999999) {
[Link]([Link], {invMass:
9999999});
}
if ([Link] == 2 &&
[Link]([Link]).y > 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y > 460) {
[Link]([Link], {y:
445});
}
}
if ([Link] == 1 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link](21).x != 1149) { // show bottom
red line
[Link](21, {x: 1149});
}
if ([Link](23).x != -1149) { // hide bottom
blue line
[Link](23, {x: -1149});
}
});
}
if ([Link] == "blueThrow") {
[Link](function(player) {
if ([Link]([Link]).invMass !=
9999999) {
[Link]([Link], {invMass:
9999999});
}
if ([Link] == 1 &&
[Link]([Link]).y > 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y > 460) {
[Link]([Link], {y:
445});
}
}
if ([Link] == 2 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link](23).x != 1149) { // show bottom
blue line
[Link](23, {x: 1149});
}
if ([Link](21).x != -1149) { // hide bottom
red line
[Link](21, {x: -1149});
}
});
}
}
}

function blockGoalKick() {
var players = [Link]().filter((player) => [Link] != 0);
if ([Link]().x < 0) { // left side red goal kick
if ([Link] == "redGK") {
[Link](function(player) {
if ([Link] == 2 &&
[Link]([Link]).x < 0) {
if ([Link]([Link]).cGroup !=
268435462) {
[Link]([Link],
{cGroup: 268435462});
}
if ([Link].x < -840 && [Link].y > -
320 && [Link].y < 320) {
[Link]([Link], {x: -
825});
}
}
if ([Link] == 1 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
});
}
}
if ([Link]().x > 0) { // right side blue goal kick
if ([Link] == "blueGK") {
[Link](function(player) {
if ([Link] == 1 &&
[Link]([Link]).x > 0) {
if ([Link]([Link]).cGroup !=
268435462) {
[Link]([Link],
{cGroup: 268435462});
}
if ([Link].x > 840 && [Link].y > -
320 && [Link].y < 320) {
[Link]([Link], {x:
825});
}
}
if ([Link] == 2 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
});
}
}
}

function removeBlock() {
var players = [Link]().filter((player) => [Link] != 0);
if ([Link] == "") {
[Link](function(player) {
if ([Link] == 1 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link] == 2 &&
[Link]([Link]).cGroup != 4) {
[Link]([Link], {cGroup: 4});
}
});
if ([Link](17).x != -1149) { // hide top red line
[Link](17, {x: -1149});
}
if ([Link](19).x != -1149) { // hide top blue line
[Link](19, {x: -1149});
}
if ([Link](21).x != -1149) { // hide bottom red line
[Link](21, {x: -1149});
}
if ([Link](23).x != -1149) { // hide bottom blue line
[Link](23, {x: -1149});
}
}
}

You might also like