Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Ball_601 = '{"name":"Ball","level":6,"model":1,"size":2.4,"zoom":0.5,"specs":{"shield":{"capacity":[10000,10000],"reload":[1000,1000]},"generator":{"capacity":[1,1],"reload":[1,1]},"ship":{"mass":200,"speed":[80,80],"rotation":[30,30],"acceleration":[60,60]}},"bodies":{"side1":{"section_segments":6,"angle":0,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side2":{"section_segments":6,"angle":60,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side3":{"section_segments":6,"angle":120,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side4":{"section_segments":6,"angle":180,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side5":{"section_segments":6,"angle":240,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side6":{"section_segments":6,"angle":300,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side7":{"section_segments":6,"angle":30,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side8":{"section_segments":6,"angle":90,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side9":{"section_segments":6,"angle":150,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side10":{"section_segments":6,"angle":210,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side11":{"section_segments":6,"angle":270,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"side12":{"section_segments":6,"angle":330,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-30,0],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,20,30,10,25,25],"height":[0,10,12,8,22,22],"texture":[16.8,63,0.9,10,17]},"t1":{"section_segments":12,"angle":30,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-10,-10,0,10,10,0,-10],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[60,75,77,75,60,50,60],"height":[60,75,77,75,60,50,60],"texture":[3.8,63,63,3.8]},"t2":{"section_segments":12,"angle":90,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-10,-10,0,10,10,0,-10],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[60,75,77,75,60,50,60],"height":[60,75,77,75,60,50,60],"texture":[3.8,63,63,3.8]},"t3":{"section_segments":12,"angle":150,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-10,-10,0,10,10,0,-10],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[60,75,77,75,60,50,60],"height":[60,75,77,75,60,50,60],"texture":[3.8,63,63,3.8]}},'+
- '"typespec":{"name":"Ball","level":6,"model":1,"code":601,"specs":{"shield":{"capacity":[10000,10000],"reload":[1000,1000]},"generator":{"capacity":[1,1],"reload":[1,1]},"ship":{"mass":200,"speed":[80,80],"rotation":[30,30],"acceleration":[60,60]}},"shape":[3.84,3.778,3.705,3.762,3.84,3.796,3.713,3.746,3.84,3.817,3.722,3.733,3.838,3.84,3.733,3.722,3.817,3.84,3.746,3.713,3.796,3.84,3.762,3.705,3.778,3.84,3.778,3.705,3.762,3.84,3.796,3.713,3.746,3.84,3.817,3.722,3.733,3.838,3.84,3.733,3.722,3.817,3.84,3.746,3.713,3.796,3.84,3.762,3.705,3.778],"lasers":[],"radius":3.84}}';
- var Barracuda_602 = '{"name":"Barracuda","level":6,"model":2,"size":2.4,"zoom":0.7,"specs":{"shield":{"capacity":[400,400],"reload":[12,12]},"generator":{"capacity":[150,150],"reload":[14,14]},"ship":{"mass":675,"speed":[90,90],"rotation":[45,45],"acceleration":[150,150],"dash":{"rate":2,"burst_speed":[200,200],"speed":[150,150],"acceleration":[70,70],"initial_energy":[75,75],"energy":[30,30]}}},"bodies":{"body":{"section_segments":12,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-90,-100,-60,-10,0,20,50,80,100,90],"z":[0,0,0,0,0,0,0,0,0,0,0]},"width":[0,5,20,25,35,40,40,35,30,0],"height":[0,5,40,45,40,60,70,60,30,0],"texture":[10,2,10,2,3,13,13,63,12],"propeller":true},"front":{"section_segments":8,"offset":{"x":0,"y":-20,"z":0},"position":{"x":[0,0,0,0,0],"y":[-90,-85,-70,-60,-20],"z":[0,0,0,0,0]},"width":[0,40,45,10,12],"height":[0,15,18,8,12],"texture":[8,63,4,4,4],"propeller":true},"propeller":{"section_segments":10,"offset":{"x":40,"y":40,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-20,-15,0,10,20,25,30,40,70,60],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,10,15,15,15,10,10,20,15,0],"height":[0,10,15,15,15,10,10,18,8,0],"texture":[4,4,10,3,3,63,4,63,12],"propeller":true},"sides":{"section_segments":6,"angle":90,"offset":{"x":0,"y":0,"z":0},"position":{"x":[0,0,0,0,0,0,0,0,0,0],"y":[-80,-75,-60,-50,-10,10,50,60,75,80],"z":[0,0,0,0,0,0,0,0,0,0]},"width":[0,30,35,10,12,12,10,35,30,0],"height":[0,10,12,8,12,12,8,12,10,0],"texture":[4,63,4,4,4,4,4,63,4]},"cockpit":{"section_segments":12,"offset":{"x":0,"y":-20,"z":30},"position":{"x":[0,0,0,0,0,0,0,0],"y":[-50,-20,0,10,30,50],"z":[0,0,0,0,0,0]},"width":[0,12,18,20,15,0],"height":[0,20,22,24,20,0],"texture":[9]}},"wings":{"top":{"doubleside":true,"offset":{"x":0,"y":20,"z":15},"length":[70],"width":[70,30],"angle":[90],"position":[0,30],"texture":[63],"bump":{"position":10,"size":30}},"top2":{"doubleside":true,"offset":{"x":0,"y":51,"z":5},"length":[70],"width":[50,20],"angle":[90],"position":[0,60],"texture":[63],"bump":{"position":10,"size":30}}},'+
- '"typespec":{"name":"Barracuda","level":6,"model":2,"code":602,"specs":{"shield":{"capacity":[400,400],"reload":[12,12]},"generator":{"capacity":[150,150],"reload":[14,14]},"ship":{"mass":675,"speed":[90,90],"rotation":[45,45],"acceleration":[150,150],"dash":{"rate":2,"burst_speed":[200,200],"speed":[150,150],"acceleration":[70,70],"initial_energy":[75,75],"energy":[30,30]}}},"shape":[5.28,5.25,5.332,5.393,4.944,1.997,1.745,1.556,1.435,3.587,3.81,3.779,3.838,3.84,3.779,3.81,3.587,3.205,3.571,3.9,5.132,5.888,5.835,5.551,4.886,5.808,4.886,5.551,5.835,5.888,5.132,3.9,3.571,3.205,3.587,3.81,3.779,3.838,3.84,3.779,3.81,3.587,1.435,1.556,1.745,1.997,4.944,5.393,5.332,5.25],"lasers":[],"radius":5.888}}';
- ships=[Ball_601, Barracuda_602]
- var vocabulary = [
- { text: "You", icon:"\u004e", key:"O" },
- { text: "Me", icon:"\u004f", key:"E" },
- { text: "Yes", icon:"\u004c", key:"Y" },
- { text: "No", icon:"\u004d", key:"N" },
- { text: "Attack", icon:"(", key:"A" },
- { text: "Follow", icon:"\u0050", key:"F" },
- { text: "Nice", icon:"\u{1F525}", key:"M" },
- { text: "Defend", icon:"\u0025", key:"D" },
- { text: "Wait", icon:"\u0048", key:"T" },
- { text: "Ball", icon:"\u26BD", key:"B" },
- { text: "Hmm", icon:"\u004b", key:"Q" },
- { text: "Shot", icon:"`", key:"W" },
- { text: "Flank", icon:"i", key:"U" },
- { text: "Goal", icon:"\u{1F945}", key:"G" },
- { text: "No Prob", icon:"\u0047", key:"P" },
- { text: "Thanks", icon:"\u0041", key:"X" },
- { text: "Sorry", icon:"\u00a1", key:"S" }
- ] ;
- mapsize = 50;
- fieldSizeX = 0.7;
- fieldSizeY = 0.4;
- ms = mapsize/2
- map = "";
- for(y=-ms-1;y<ms;y++){
- for(x=-ms;x<ms;x++){
- if(Math.abs(x)>fieldSizeX*ms||Math.abs(y)>fieldSizeY*ms)
- map = map+"9"
- else map = map+" ";
- }
- map = map+"\n";
- }
- this.options = {
- // see documentation for options reference
- //root_mode: "survival",
- weapons_store:false,
- friendly_colors:10,
- invulnerable_ships: true,
- ships:ships,
- map_size: mapsize,
- custom_map: map,
- vocabulary: vocabulary,
- asteroids_strength: 100000,
- radar_zoom: 1.5,
- max_players:13
- };
- map_size = this.options.map_size*5;
- betweenmatchesdelay = 60;
- matchlength = 60*10;
- goalDelay = 10;
- goalSize = 15;
- goalTriggerSize = 20;
- playersNeeded = 2;
- matchinprogress = false;
- matchTimer = 60;
- goalTimer = 0;
- teamneedsplayers = 1;
- teams = [];
- teams.push({name:"Red",goal:[-map_size/2,0],hue:0,color:"#FF0000",playerAmount:0})
- teams.push({name:"Blue",goal:[map_size/2,0],hue:180,color:"#0000FF",playerAmount:0})
- score = [0,0]
- log = function(s){
- game.modding.terminal.echo(s);
- }
- distance = function(x, y){
- return Math.sqrt(x*x+y*y);
- };
- shortestPath = function(x1, y1, x2, y2){
- shortestDist = 10000;
- coords = [];
- xx = x2-x1;
- yy = y2-y1;
- coords.push(xx, yy);
- shortest = [xx, yy];
- xx = x2+map_size*2-x1;
- yy = y2-y1;
- coords.push(xx, yy);
- xx = x2-map_size*2-x1;
- yy = y2-y1;
- coords.push(xx, yy);
- xx = x2-x1;
- yy = y2+map_size*2-y1;
- coords.push(xx, yy);
- xx = x2-x1;
- yy = y2-map_size*2-y1;
- coords.push(xx, yy);
- xx = x2+map_size*2-x1;
- yy = y2+map_size*2-y1;
- coords.push(xx, yy);
- xx = x2+map_size*2-x1;
- yy = y2-map_size*2-y1;
- coords.push(xx, yy);
- xx = x2-map_size*2-x1;
- yy = y2+map_size*2-y1;
- coords.push(xx, yy);
- xx = x2-map_size*2-x1;
- yy = y2-map_size*2-y1;
- coords.push(xx, yy);
- for(var i = 0; i<9; i++){
- dist = distance(coords[i*2], coords[i*2+1]);
- if(dist<shortestDist){
- shortestDist = dist;
- shortest = [coords[i*2], coords[i*2+1]];
- }
- }
- return shortest;
- };
- goal1 = {
- id: "goal1",
- obj: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/starblast-1531720874914.obj",
- emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/images/textures/ship_emissive_texture.png",
- // specular: "https://starblast.data.neuronality.com/models/aliens/10/lambert.jpg",
- diffuse: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/images/textures/ship_lambert_texture.png",
- shininess: 100,
- emissiveColor: 0xFF5555,
- specularColor: 0xFF0000,
- bump: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/images/textures/ship_lambert_texture.png"
- } ;
- goal2 = {
- id: "goal2",
- obj: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/starblast-1531720874914.obj",
- emissive: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/images/textures/ship_emissive_texture.png",
- // specular: "https://starblast.data.neuronality.com/models/aliens/10/lambert.jpg",
- diffuse: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/images/textures/ship_lambert_texture.png",
- shininess: 100,
- emissiveColor: 0x5555FF,
- specularColor: 0x0000FF,
- bump: "https://raw.githubusercontent.com/rvan-der/Starblast.io-modding/master/images/textures/ship_lambert_texture.png"
- } ;
- game.setObject({
- id: "g1",
- type: goal1,
- position: {x:teams[0].goal[0]+5,y:teams[0].goal[1],z:-10},
- rotation: {x:0,y:Math.PI/2,z:0},
- scale: {x:12,y:12,z:12}
- }) ;
- game.setObject({
- id: "g2",
- type: goal2,
- position: {x:teams[1].goal[0]+5,y:teams[1].goal[1],z:-10},
- rotation: {x:0,y:Math.PI/2,z:0},
- scale: {x:12,y:12,z:12}
- }) ;
- matchTick = function(){
- ball = game.ships[0];
- ball.set({type:601,idle:false,team:0});
- if(game.ships.length-1<playersNeeded)matchTimer = -1;
- returnBall = false;
- xx = ball.x;
- yy = ball.y;
- if(ball.x>map_size*fieldSizeX+10){xx = map_size*fieldSizeX+5; returnBall = true;}
- if(ball.x<-map_size*fieldSizeX){xx = -map_size*fieldSizeX+5; returnBall = true;}
- if(ball.y>map_size*fieldSizeY){yy = map_size*fieldSizeY-5; returnBall = true;}
- if(ball.y<-map_size*fieldSizeY-10){yy = -map_size*fieldSizeY-5; returnBall = true;}
- if(returnBall)ball.set({x:xx,y:yy});
- scoreComps = [];
- highestScore = 0;
- highestScoreTeams = [];
- for(t=0;t<teams.length;t++){
- if(matchTimer<0&&score[t]>highestScore){
- highestScoreTeams = [t];
- highestScore = score[t];
- }else if(matchTimer<0&&score[t]==highestScore){
- highestScoreTeams.push(t);
- }
- pos = (100/teams.length)*(t)
- scoreComps.push({ type: "text",position:[pos,0,100/teams.length,100],value:score[t],color:teams[t].color})
- if(t<teams.length-1)
- scoreComps.push({ type: "text",position:[(100/(teams.length))*(t+1)-10/teams.length,0,20/teams.length,100],value:":",color:"#CDE"})
- }
- if(matchTimer<0){
- if(highestScoreTeams.length>1){
- text = "Draw between "
- for(t=0;t<highestScoreTeams.length;t++){
- if(t==highestScoreTeams.length-1)
- text = text + teams[highestScoreTeams[t]].name
- else
- if(t==highestScoreTeams.length-2)
- text = text + teams[highestScoreTeams[t]].name + " and "
- else
- text = text + teams[highestScoreTeams[t]].name +", "
- }
- }else text = teams[highestScoreTeams[0]].name+" won!"
- for(i=1;i<game.ships.length;i++){
- ship = game.ships[i];
- ship.setUIComponent({
- id:"timeLeft",
- position:[30,30,40,5],
- clickable: false,
- visible: true,
- components: [
- { type: "text",position:[10,10,80,30],value:text,color:"#CDE"}
- ]
- });
- }
- log("Game ends: "+text);
- matchinprogress = false;
- matchTimer = betweenmatchesdelay;
- return;
- }
- for(i=1;i<game.ships.length;i++){
- ship = game.ships[i];
- if(!ship.custom.init){
- ship.custom.init = true;
- ship.custom.team = teamneedsplayers;
- ship.set({type:602,team:1,hue:teams[teamneedsplayers].hue});
- log(ship.name+" joined, assigned to "+teams[teamneedsplayers].name);
- }
- teams[ship.custom.team].playerAmount++;
- //show directions to stuff
- sp = shortestPath(ship.x, ship.y, ball.x, ball.y);
- dist = distance(sp[0],sp[1]);
- x = sp[0]/dist;
- y = sp[1]/dist;
- ship.setUIComponent({
- id:"ballIndicator",
- position:[45+x*30,45-y*30,10,10],
- clickable: false,
- visible: true,
- components: [
- { type:"box",position:[45,45,10,10],fill:"#AA0000",stroke:"#CDE",width:2},
- { type: "text",position:[10,10,80,30],value:"ball",color:"#CDE"}
- ]
- });
- scsize = teams.length*10
- ship.setUIComponent({
- id:"score",
- position:[50-scsize/2,10,scsize,20],
- clickable: false,
- visible: true,
- components: scoreComps
- });
- ship.setUIComponent({
- id:"timeLeft",
- position:[30,30,40,5],
- clickable: false,
- visible: true,
- components: [
- { type: "text",position:[10,10,80,30],value:Math.floor(matchTimer/60)+"m "+matchTimer%60+"s left",color:"#CDE"}
- ]
- });
- if(goalTimer>0)
- b = true
- else
- b = false
- if(goalTimer>=0)
- ship.setUIComponent({
- id:"goalText",
- position:[30,40,40,40],
- clickable: false,
- visible: b,
- components: [
- { type: "text",position:[0,0,100,100],value:"GOAL",color:"#CDE"}
- ]
- });
- if(goalTimer==0){
- x=teams[ship.custom.team].goal[0]+Math.random()*goalTriggerSize-goalTriggerSize/2;
- y=teams[ship.custom.team].goal[1]+Math.random()*goalTriggerSize-goalTriggerSize/2;
- ship.set({type:602,team:1,hue:teams[ship.custom.team].hue,x:x,y:y});
- }
- for(t=0;t<teams.length;t++){
- ourT = (t == ship.custom.team);
- sp = shortestPath(ship.x, ship.y, teams[t].goal[0], teams[t].goal[1]);
- dist = distance(sp[0],sp[1]);
- x = sp[0]/dist;
- y = sp[1]/dist;
- text = "their goal"
- if(ourT)
- text = "our goal"
- ship.setUIComponent({
- id:"tmarker"+t,
- position:[45+x*30,45-y*30,10,10],
- clickable: false,
- visible: true,
- components: [
- { type:"box",position:[45,45,10,10],fill:teams[t].color,stroke:"#CDE",width:2},
- { type: "text",position:[10,10,80,30],value:text,color:"#CDE"}
- ]
- });
- }
- }
- if(goalTimer>=0){
- goalTimer--;
- if(goalTimer<goalDelay/2)
- ball.set({x:0,y:0,vx:0,vy:0,idle:true})
- }else matchTimer--;
- lowestPlayers = game.ships.length
- lowestPlTeam = 0;
- for(t=0;t<teams.length;t++){
- if(teams[t].playerAmount<lowestPlayers){
- lowestPlayers = teams[t].playerAmount;
- lowestPlTeam = t;
- }
- teams[t].playerAmount = 0;
- }
- teamneedsplayers = lowestPlTeam;
- }
- checkGoals = function(){
- if(goalTimer>0)return;
- ball = game.ships[0];
- for(t=0;t<teams.length;t++){
- sp = shortestPath(ball.x, ball.y, teams[t].goal[0], teams[t].goal[1]);
- dist = distance(sp[0],sp[1]);
- if(dist<goalTriggerSize){
- log("GOAL! Into "+teams[t].name+"'s goal")
- for(tt=0;tt<teams.length;tt++){
- if(tt!=t)
- score[tt]++;
- }
- goalTimer = goalDelay;
- break;
- }
- }
- }
- startMatch = function(){
- log("Game starts NOW.");
- matchinprogress = true;
- t = 0;
- randomizeTeams = [];
- for(i=1;i<game.ships.length;i++){
- randomizeTeams.push(i);
- }
- for (i = randomizeTeams.length - 1; i > 0; i--) {
- j = Math.floor(Math.random() * (i + 1));
- x = randomizeTeams[i];
- randomizeTeams[i] = randomizeTeams[j];
- randomizeTeams[j] = x;
- }
- for(i=0;i<randomizeTeams.length;i++){
- ship = game.ships[randomizeTeams[i]];
- ship.custom.team = t;
- x=teams[t].goal[0]+Math.random()*goalTriggerSize-goalTriggerSize/2;
- y=teams[t].goal[1]+Math.random()*goalTriggerSize-goalTriggerSize/2;
- ship.set({type:602,team:1,hue:teams[t].hue,x:x,y:y});
- ship.setUIComponent({
- id:"awaiting",
- position:[30,20,40,20],
- clickable: false,
- visible: false,
- });
- log("Player "+ship.name+" on team "+teams[t].name)
- t++;
- if(t>=teams.length)t=0;
- }
- game.ships[0].set({x:0,y:0});
- score = [];
- log("Game started");
- for(t=0;t<teams.length;t++){
- score.push(0);
- }
- matchTimer = matchlength;
- }
- awaitingNextMatch = function(){
- ball = game.ships[0];
- ball.set({type:601, team:0,idle:false});
- for(i=1;i<game.ships.length;i++){
- ship = game.ships[i];
- if(!ship.custom.init){
- ship.custom.init = true;
- ship.set({type:602, team:1});
- log(ship.name+" joined");
- }
- if(game.ships.length-1<playersNeeded){
- ship.setUIComponent({
- id:"awaiting",
- position:[30,40,40,20],
- clickable: false,
- visible: true,
- components: [
- { type: "text",position:[0,0,100,100],value:"Not enough players - "+playersNeeded +" needed",color:"#CDE"}
- ]
- });
- }else{
- ship.setUIComponent({
- id:"awaiting",
- position:[30,40,40,20],
- clickable: false,
- visible: true,
- components: [
- { type: "text",position:[0,0,100,100],value:"Starting in "+matchTimer +" seconds",color:"#CDE"}
- ]
- });
- }
- }
- if(game.ships.length-1<playersNeeded)matchTimer = betweenmatchesdelay;
- matchTimer--;
- if(matchTimer<0)
- startMatch();
- }
- this.tick = function(game) {
- if(game.ships.length<1)return;
- // do mod stuff here ; see documentation
- if(matchinprogress){
- if(game.step%60==0){
- matchTick();
- }
- if(goalTimer<0)
- checkGoals();
- }else{
- if(game.step%60==0)
- awaitingNextMatch();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement