Path |
Scripts/vector.js |
"use strict";
this.name = "vector";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Mission. Funny things in 'Richman's World'";
this.version = "1.7.1";
this.startUp = function()
{
delete this.startUp;
if(worldScripts.vector_pad.startUp) worldScripts.vector_pad.startUp();
this.logging = false;
this.audio = true;
this.extraA = false;
this.extraB = true;
this.excludedScreens = ['GUI_SCREEN_OPTIONS','GUI_SCREEN_SAVE','GUI_SCREEN_LOAD','GUI_SCREEN_INTRO1','GUI_SCREEN_INTRO2','GUI_SCREEN_MISSION','GUI_SCREEN_REPORT'];
this.mySound = new SoundSource;
this.mySound.loop = true;
this.hasShown = false;
this.slaunch = false;
if(!this.andale) this.andale = false;
this.ISSOrNova = false;
this.allowS = false;
this.allowI = false;
this.tempRisk = 0;
this.addChance = 1;
this.red = 0;
this.dataRW(1);
}
this.dataRW = function(mode)
{
if(mode){
if(!worldScripts.vector_pad.deactivated) this.inf = worldScripts.vector_pad.padInfos.generic;
else this.inf ={cpod:[],cpods:0,epod:[],epods:0,expFactor:1,passengerState:0,superman:0}
if(missionVariables.vector_cpod){
this.inf.cpod = missionVariables.vector_cpod.split('|');
this.inf.cpods = this.inf.cpod.length;
}
if(missionVariables.vector_epod){
this.inf.epod = missionVariables.vector_epod.split('|');
this.inf.epods = this.inf.epod.length;
}
if(player.score>249) missionVariables.vector_limiter = null;
missionVariables.vector_passengerState = null;
missionVariables.vector_cpod = null;
missionVariables.vector_cpods = null;
missionVariables.vector_epod = null;
missionVariables.vector_epods = null;
} else {
this.inf.passengerState = 0;
this.inf.cpod = [];
this.inf.cpods = 0;
this.inf.epod = [];
this.inf.epods = 0;
this.inf.pasState = 0;
if(!worldScripts.vector_pad.deactivated){
this.inf.superman = worldScripts.vector_pad.padInfos.generic.superman;
worldScripts.vector_pad.padInfos.generic = this.inf;
}
}
return;
}
this.shipWillDockWithStation = function(station)
{
if(!player.ship.docked) return;
this.dataRW(1);
if(this.ISSOrNova){
this.allowS = false;
this.allowI = false;
this.tempRisk = 0;
} else this.setStationFlags(station);
}
this.setStationFlags = function(curstat)
{ /* Station, Risk, Screen, GalCop */
var sList = ["Astromine Penal Colony",1.3,true,true,"Augeaian Orbital Repair Facility",0.8,true,true,"Black Monk Monastery",0.8,true,false,
"CoachWhip hOopy Casino",1.8,true,true,"Collective SLAPU Imperial AstroFactory",1.3,true,true,"Collective ZGF",0.7,true,false,
"Deep Space Hoopy Hotel : Hades Branch",1.1,true,true,"Deep Space Hoopy Hotel : Lernean Branch",1.1,true,true,
"Free Trade Zone",0.8,true,false,"Griff Research Ltd Orbital Base",1.2,true,true,"GRS Buoy Factory",1.5,true,true,"Hacker Outpost",0.8,true,false,
"Hesperides Wiseguy Way-Station",1.1,true,true,"Imperial AstroFactory",1.7,true,true,"Liberty Station",1.8,true,true,"Navy SecCom Station",1.8,true,true,
"Pirate Base",1.8,true,false,"Pirate Rock",1.7,true,false,"Rebel Outpost",1.8,true,false,"Renegade Phoenix",1.8,true,true,"Renegade Station",1.6,true,true,
"Rock Hermit",1.2,true,true,"Royal Court",1.7,false,false,"Royal Hunting Lodge",1.7,false,false,"Salvage Gang",1.2,true,false,"Sentinel Station",1.4,true,true,
"Special Branch Orbital Headquaters",1.8,true,true,"Special Interstellar Repairs and Shipyard Facility",1.6,true,true,"Sun Research Station Alpha",1.5,true,true,
"Sun Research Station Beta",1.5,true,true,"Sun Research Station Delta",1.5,true,true,"Sun Research Station Omega",1.5,true,true,"Super Hub",1.4,true,true,
"Taranis Corporation HQ",1.8,true,true,"The Link Base",1.9,true,false,"TransHab Station",1.4,true,true];
let e = sList.indexOf(curstat.name);
if(e!==-1){
if(!curstat.bounty){this.allowS = sList[e+2]; this.allowI = sList[e+3]; this.tempRisk = sList[e+1];}
else {this.allowS = sList[e+2]; this.allowI = false; this.tempRisk = sList[e+1];}
} else {
if(curstat.isMainStation && !curstat.bounty){this.allowS = true; this.allowI = true; this.tempRisk = 1.5;}
else {
if(curstat.AI==="randomhitsbarAI.plist"){this.allowS = true; this.allowI = true; this.tempRisk = 1.3;}
else if(curstat.primaryRole==="constore"){this.allowS = true; this.allowI = true; this.tempRisk = 1.6;}
else {this.allowS = false; this.allowI = false; this.tempRisk = 0;}
}
}
if(this.logging) log(this.name,this.name+': Stationkey: ISS:'+this.ISSOrNova+' S:'+this.allowS+' I:'+this.allowI+' R:'+this.tempRisk);
return;
}
this.shipDockedWithStation = function()
{
this.mySound.stop();
this.hasShown = false;
if(!player.ship.docked || this.ISSOrNova || !this.allowS) return;
if(!this.inf.cpods && !this.inf.epods && this.excludedScreens.indexOf(guiScreen)===-1){
if(this.inf.expFactor>20 && Math.random()<(0.01*Math.log(this.inf.expFactor))){
this.showScreen(2,null,null,null);
this.revenge = Math.ceil(Math.log(this.inf.expFactor*500)*0.25);
} else if(this.andale && system.government>5 && !(clock.days&3) && Math.random()>0.8){this.dataRW(1); this.showScreen(6,null,null,5);}
this.hasShown = true;
return;
}
}
this.missionScreenOpportunity = function()
{
if(this.ISSOrNova || !player.ship.docked || !this.allowS || this.hasShown || (!this.inf.cpods && !this.inf.epods)) return;
if(!this.mc){
this.dataRW(1);
this.mc = new Object({screen:0,react:0,sumToOffer:0,sumCargo:0,sumPods:0,sTotal:0,loop:0,advice:'',EName:'',ETyp:'',CName:'',CTyp:''});
this.mc.expLog = Math.log(this.inf.expFactor*5);
this.mc.rp = this.mc.expLog*0.1;
this.mc.hint = Math.floor(Math.log((1+system.government)*this.mc.expLog)*1.7);
if(this.inf.cpod.length) ++this.mc.screen;
if(this.inf.epod.length) ++this.mc.screen;
}
this.missionOffers();
}
this.missionOffers = function()
{
if(this.inf.epod.length) this.mc.loop = 1;
else if(this.inf.cpod.length) this.mc.loop = 2;
switch(this.mc.loop){
case 1: this.showEPods(); this.mc.loop = 4; break;
case 2: this.showCPods(); this.mc.loop = 4; break;
default: this.hasShown = true;}
return;
}
this.showEPods = function()
{
var lineAdd = 8-this.inf.epod.length;
if(this.inf.epod.length===1){
if(this.inf.expFactor<40) this.showScreen(1,'VECTOR_OFFERA',null,null);
else this.showScreen(1,'VECTOR_OFFERC',null,null);
} else {
if(this.inf.expFactor<40) this.showScreen(1,'VECTOR_OFFERB',null,null);
else this.showScreen(1,'VECTOR_OFFERD',null,null);
}
var i = this.inf.epod.length;
while(i--){
this.calculateSum(this.inf.epod[i],1);
mission.addMessageText("Esc-Pod:\r\r"+this.mc.EName+" "+this.mc.ETyp+".");
}
mission.addMessageTextKey("VECTOR_LINE");
this.mc.sumPods = Math.ceil(this.mc.sumToOffer);
if(this.mc.sumPods<400) this.mc.sumPods = 400;
if(this.inf.expFactor>=40){
lineAdd--;
mission.addMessageText("\r\r\r\r\r\r\r\rPossible ransom: "+this.mc.sumPods+" Credits.");
}
i = lineAdd;
while(i--) mission.addMessageText("");
let friends = ["low","acceptable","average","medium","high","dangerous","extreme"];
if(this.inf.expFactor>20) mission.addMessageText("Friends gave you a hint that the risk for transactions is currently "+friends[this.mc.hint]+".");
mission.addMessageTextKey("VECTOR_QUESTION");
this.mc.sumToOffer = 0;
return;
}
this.showCPods = function()
{
var lineAdd = 8-this.inf.cpod.length;
if(this.inf.expFactor<30) this.showScreen(1,'VECTOR_OFFERE',null,null);
else this.showScreen(1,'VECTOR_OFFERF',null,null);
var i = this.inf.cpod.length;
while(i--){
this.calculateSum(this.inf.cpod[i],2);
mission.addMessageText("Cargo:\r\r"+this.mc.CName+" "+this.mc.CTyp+".");
}
mission.addMessageTextKey("VECTOR_LINE");
this.mc.sumCargo = Math.ceil(this.mc.sumToOffer);
if(this.mc.sumCargo<300) this.mc.sumCargo = 300;
if(this.inf.expFactor>=30){
lineAdd--;
mission.addMessageText("\r\r\r\r\r\r\r\rPossible deal: "+this.mc.sumCargo+" Credits.");
}
i = lineAdd;
while(i--) mission.addMessageText("");
let friends = ["low","acceptable","average","medium","high","dangerous","extreme"];
if(this.inf.expFactor>10) mission.addMessageText("Friends gave you a hint that the risk for transactions is currently "+friends[this.mc.hint]+".");
mission.addMessageTextKey("VECTOR_QUESTION");
this.mc.sumToOffer = 0;
return;
}
this.calculateSum = function(nam,typ)
{
var factorPod = 1,currentName = nam.split(' ');
if(!currentName[2]) currentName[2] = '(unknown)';
if(typ===1){
switch(currentName[2]){
case '(Frood)': factorPod += 1.3; break;
case '(Geek)': factorPod += 1.6; break;
case '(Millionaire)': factorPod += 2; break;
default: factorPod = 1.0;
}
this.mc.EName = currentName[0]+' '+currentName[1];
this.mc.ETyp = currentName[2];
} else {
switch(currentName[2]){
case '(Collection)': factorPod += 1.1; break;
case '(Precious)': factorPod += 0.7; break;
case '(Heirloom)': factorPod += 0.3; break;
default: factorPod += 0.2;
}
this.mc.CName = currentName[0]+' '+currentName[1];
this.mc.CTyp = currentName[2];
}
var singleSum = Math.log(system.productivity*this.inf.expFactor*(factorPod*((1+system.government)*0.5)))*(5*this.inf.expFactor)*(1+Math.random());
if(this.red>2) singleSum /= Math.log(this.red);
this.mc.sumToOffer += singleSum;
return;
}
this.choiceEvaluation = function(choice)
{
switch(choice){
case "VECTOR_FREE": this.mc.loop = 2; this.inf.epod = []; this.mc.react += 1; this.mc.sumPods = this.mc.sumPods*0.1667;
if(this.inf.expFactor>1) this.inf.expFactor -= 1; this.mc.screen--; if(this.inf.cpod.length) this.showCPods(); break;
case"VECTOR_SLAVE": this.mc.loop = 2; this.inf.epod = []; this.mc.react += 2; this.mc.sumPods = this.mc.sumPods*0.25;
if(this.inf.expFactor<100) this.inf.expFactor += 1; this.mc.screen--; if(this.inf.cpod.length) this.showCPods(); break;
case "VECTOR_ZRANSOM": this.mc.loop = 2; this.inf.epod = []; this.mc.react += 4;
if(this.inf.expFactor<97) this.inf.expFactor += 3; this.mc.screen--; if(this.inf.cpod.length) this.showCPods(); break;
case "VECTOR_LEAVE": this.mc.loop = 4; this.inf.cpod = []; this.mc.react += 8; this.mc.sumCargo = this.mc.sumCargo*0.1667;
if(this.inf.expFactor>1) this.inf.expFactor -= 1; this.mc.screen--; break;
case "VECTOR_SELL": this.mc.loop = 4; this.inf.cpod = []; this.mc.react += 16; this.mc.sumCargo = this.mc.sumCargo*0.25;
if(this.inf.expFactor<100) this.inf.expFactor += 1; this.mc.screen--; break;
case "VECTOR_ZDEAL": this.mc.loop = 4; this.inf.cpod = []; this.mc.react += 32;
if(this.inf.expFactor<98) this.inf.expFactor += 2; this.mc.screen--; break;
default:
}
if(!this.inf.epod.length && !this.inf.cpod.length && !this.mc.screen && this.mc.react) this.createReaction();
return;
}
this.createReaction = function()
{
this.slaunch = false;
this.mc.sumPods = Math.ceil(this.mc.sumPods);
this.mc.sumCargo = Math.ceil(this.mc.sumCargo);
this.mc.sTotal = this.mc.sumPods+this.mc.sumCargo;
this.calculateRisk();
var chance = Math.random();
if((this.mc.react&1)) this.freeHim(chance);
if((this.mc.react&2)) this.sellAsSlave(chance);
if((this.mc.react&4)){this.mc.risk += 1.5; this.ransomNow(chance);}
if((this.mc.react&8)) this.giveBack(chance);
if((this.mc.react&16)) this.blackMarket(chance);
if((this.mc.react&32)){this.mc.risk += 1.3; this.makeDeal(chance);}
this.finishedAndExit();
return;
}
this.calculateRisk = function(simple)
{
this.mc.risk = this.tempRisk;
if(!simple) this.mc.risk *=(Math.log((this.mc.sumPods+this.mc.sumCargo)/32)*(1+system.government)*Math.random())*(this.inf.expFactor*0.01);
else this.mc.risk = Math.ceil(this.mc.risk/(1+(system.government*Math.random())));
return;
}
this.calculateRed = function(mode){
switch(mode){
case 1: this.mc.sumPods = Math.ceil(this.mc.sumPods/Math.log(this.red)); break;
case 3: this.mc.sTotal = Math.ceil(this.mc.sTotal*Math.log(this.red)); break;
case 5: this.mc.sumCargo = Math.ceil(this.mc.sumCargo/Math.log(this.red)); break;
}
return;
}
this.freeHim = function(chance)
{
if(this.allowI) chance *= 0.7;
if(chance>(0.25-this.mc.rp*0.5)){
this.mc.react &= 56;
this.mc.sumPods = 0;
return;
}
this.mc.advice = expandDescription("[vector_free]")+"\nWith this words "+this.mc.EName+" presents you\n"+this.mc.sumPods+".0 Credits for his safe return.";
player.credits += this.mc.sumPods;
this.showScreen(3,null,1,5);
return;
}
this.sellAsSlave = function(chance)
{
if(this.allowI){
if(this.mc.risk>25 && chance>(0.90-this.mc.rp)){
if(this.red>3) this.calculateRed(3);
this.mc.advice = "GalCop Police fined you with "+(Math.ceil(this.mc.sTotal*2.5))+".0 Credits\nfor slavery and added an entry to your ID.";
this.calculatePenalty(this.mc.sTotal*2.5);
this.mc.react = 64;
player.ship.bounty += 3;
this.showScreen(5,null,1,7);
return;
}
if(chance>0.45 && chance<(0.50+this.mc.rp*0.5) && this.mc.risk > 4){
if(this.red>3) this.calculateRed(3);
this.mc.advice = "GalCop Police fined you with "+(Math.ceil(this.mc.sTotal*2))+".0 Credits\nfor intentional slavery.";
this.calculatePenalty(this.mc.sTotal*2);
this.mc.react = 64;
this.showScreen(5,null,1,7);
return;
}
if(chance>0.25 && chance<0.40 && this.mc.risk>1){
this.mc.react &= 56;
this.mc.advice = "GalCop Police has confiscated your Pods.";
this.mc.sumPods = 0;
return;
}
} else chance -= Math.random();
if(chance<0.15){
this.mc.react &= 56;
this.mc.sumPods = 0;
this.mc.advice = "The slaver tricked you and you lost your money.";
return;
}
this.mc.advice = "The slaver paid "+this.mc.sumPods+".0 Credits for your special cargo.";
return;
}
this.ransomNow = function(chance)
{
if(this.allowI){
if(this.mc.risk>20 && chance>(0.90-this.mc.rp)){
if(this.red>3) this.calculateRed(3);
this.mc.advice = "GalCop Police fined you with "+(Math.ceil(this.mc.sTotal*4))+".0 Credits\nfor intentional hijacking of "+this.mc.EName+"\nand added an entry to your ID.";
this.calculatePenalty(this.mc.sTotal*4);
this.mc.react = 64;
player.ship.bounty += 3;
this.showScreen(5,null,1,6);
return;
}
if(chance>0.25 && chance<0.40 && this.mc.risk>1){
this.mc.react &= 56;
this.mc.advice = "GalCop Police has confiscated your Pods.";
this.mc.sumPods = 0;
return;
}
if(chance>0.45 && chance<(0.50+this.mc.rp*0.7) && this.mc.risk>3){
if(this.red>3) this.calculateRed(3);
this.mc.advice = "GalCop Police fined you with "+(Math.ceil(this.mc.sTotal*3.2))+".0 Credits\nfor kidnapping "+this.mc.EName+".";
this.calculatePenalty(this.mc.sTotal*3.2);
this.mc.react = 64;
this.showScreen(5,null,1,7);
return;
}
} else chance -= Math.random();
if(chance<0.15){
this.mc.react &= 56;
this.mc.sumPods = 0;
this.mc.advice = "The family tricked you and you lost your money.";
return;
}
this.mc.advice = "The family paid to you: "+this.mc.sumPods+".0 Credits.";
return;
}
this.giveBack = function(chance)
{
if(this.allowI) chance *= 1.1;
if(chance<(0.55+this.mc.rp*0.5)){
this.mc.react &= 7;
this.mc.sumCargo = 0;
return;
}
this.mc.advice = "For returning the "+this.mc.CName+"\nwe'll award you "+this.mc.sumCargo+".0 Credits.\n\nIt takes a few moments to transfer it\nto your account.";
player.credits += this.mc.sumCargo;
if(this.allowI) this.showScreen(4,null,1,4);
else this.showScreen(7,null,1,4);
return;
}
this.blackMarket = function(chance)
{
if(this.allowI){
if(this.mc.risk>25 && chance<(0.10+this.mc.rp)){
if(this.red>3) this.calculateRed(3);
this.mc.advice = "GalCop Police fined you with "+(Math.ceil(this.mc.sTotal*2.5))+".0 Credits\nfor intentional dealing with stolen goods\nand added an entry to your ID.";
this.calculatePenalty(this.mc.sTotal*2.5);
this.mc.react = 64;
player.ship.bounty += 3;
this.showScreen(5,null,1,6);
return;
}
if(chance>0.15 && chance<(0.20+this.mc.rp*0.5) && this.mc.risk>1){
this.mc.react &= 7;
this.mc.advice += "\nGalCop Police has confiscated your stolen goods.";
this.mc.sumCargo = 0;
return;
}
if(chance>0.45 && chance<(0.60+this.mc.rp*0.8) && this.mc.risk>4){
if(this.red>3) this.calculateRed(3);
this.mc.advice = "GalCop Police fined you with "+(Math.ceil(this.mc.sTotal*2))+".0 Credits\nfor dealing with stolen goods.";
this.calculatePenalty(this.mc.sTotal*2);
this.mc.react = 64;
this.showScreen(5,null,1,7);
return;
}
} else chance += Math.random();
if(chance>0.75){
this.mc.react &= 7;
this.mc.sumCargo = 0;
this.mc.advice += "\nThe dealer tricked you and you lost your money.";
return;
}
this.mc.advice += "\nOn the blackmarket you've got: "+this.mc.sumCargo+".0 Credits.";
return;
}
this.makeDeal = function(chance)
{
if(this.allowI){
if(this.mc.risk>20 && chance<(0.10+this.mc.rp)){
if(this.red>3) this.calculateRed(3);
this.mc.advice = "GalCop Police fined you with "+(Math.ceil(this.mc.sTotal*4.5))+".0 Credits\nfor attempted extortion and added an entry\nto your ID.";
this.calculatePenalty(this.mc.sTotal*4.5);
this.mc.react = 64;
player.ship.bounty += 3;
this.showScreen(5,null,1,6);
return;
}
if(chance>0.15 && chance<(0.20+this.mc.rp*0.5) && this.mc.risk>1){
this.mc.react &= 7;
this.mc.advice += "\nGalCop Police has confiscated your stolen goods.";
this.mc.sumCargo = 0;
return;
}
if(chance>0.45 && chance<(0.50+this.mc.rp*0.8) && this.mc.risk>5){
if(this.red>3) this.calculateRed(3);
this.mc.advice = "GalCop Police fined you with "+(Math.ceil(this.mc.sTotal*3))+".0 Credits\nfor attempted extortion.";
this.calculatePenalty(this.mc.sTotal*3);
this.mc.react = 64;
this.showScreen(5,null,1,7);
return;
}
} else chance -= Math.random();
if(chance<0.15){
this.mc.react &= 7;
this.mc.sumCargo = 0;
this.mc.advice = "The assurance tricked you and you lost your money.";
return;
}
this.mc.advice += "\nThe assurance paid: "+this.mc.sumCargo+".0 Credits.";
return;
}
this.calculatePenalty = function(penalty)
{
let p = Math.ceil(penalty);
player.credits = Math.max(player.credits-p,30);
if(this.mc){
this.mc.sumPods = 0;
this.mc.sumCargo = 0;
}
worldScripts.vector_pad.addToLogbook("BAD $"+p);
return;
}
this.finishedAndExit = function()
{
if(!(this.mc.react&64)){
var a = this.mc.sumPods+this.mc.sumCargo;
player.credits += a;
if(a) worldScripts.vector_pad.addToLogbook("BAC $"+(this.mc.sumPods+this.mc.sumCargo));
else worldScripts.vector_pad.addToLogbook("BAE "+system.name);
}
if(this.mc.advice){
if(!this.adviceTimer) this.adviceTimer = new Timer(this,this.doAdviceTimer,0,3);
else this.adviceTimer.start();
}
this.hasShown = true;
this.dataRW();
if(this.logging){
for(let prop in this.mc) log(this.name,this.name+':'+prop+': '+this.mc[prop]);
log(this.name,this.name+": hasShown:"+this.hasShown+" addChance:"+this.addChance+" pasState:"+this.inf.pasState+" expFactor:"+this.inf.expFactor);
log(this.name,this.name+" mV.cpods:"+this.inf.cpods+" mV.epods:"+this.inf.epods);
}
return;
}
this.doAdviceTimer = function()
{
if(this.mc && this.mc.advice!=='' && this.excludedScreens.indexOf(guiScreen)===-1){
player.commsMessage(this.mc.advice,8);
this.mc.advice = '';
this.cleanAdvice();
} else if(!player.ship.isValid) this.cleanAdvice();
}
this.shipWillLaunchFromStation = function()
{
if(!this.myColor){
this.myColor = [[0.4,1,0.4,1],null];
if(worldScripts.OXPConfig) this.myColor = worldScripts.OXPConfig.genericUserColors[4];
else if(missionVariables.genericUserColors) this.myColor = JSON.parse(missionVariables.genericUserColors)[4];
}
this.checkSun();
this.cleanAdvice();
this.red = 0;
if(worldScripts.Cabal_Common_OXPStrength){
var c = worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkPower(player.ship);
if(c>320) this.red = Math.ceil(Math.log(c-320));
else this.red = 0;
} else if(player.score>512) this.red = 6;
if(this.ISSOrNova) return;
++this.addChance;
this.addChance &= 7;
}
this.shipLaunchedFromStation = function(station)
{
if(this.ISSOrNova) return;
if(this.mc){
if(this.mc.screen){
player.commsMessage("You've decided to reload your special cargo.");
if(Math.random()>(0.4/this.tempRisk) && !this.revenge && this.slaunch && this.allowI) worldScripts.vector_insp.startInspection(station);
}
if(parseInt(this.inf.epods)>0){
if(this.inf.passengerState==1){
this.setSound(1);
player.commsMessage("Your passenger is still totally drunken.");
} else if(this.inf.passengerState==2){
this.setSound(2);
player.commsMessage("Your passenger is still a little bit renitent.");
}
}
if(this.hasShown && this.mc.advice && this.mc.advice!=='') player.commsMessage(this.mc.advice,8);
delete this.mc;
this.slaunch = false;
}
if(this.revenge){
system.addShips('vector_revenge1',this.revenge,player.ship.position,15000);
delete this.revenge;
}
}
this.isEnemy = function(entity){return(entity.isShip && entity.isValid && (entity.isPirate || entity.isPolice || entity.isTrader) && entity.target && entity.target==player.ship && entity.missiles.length);}
this.alertConditionChanged = function(to)
{
if(to===3 && this.red>2){
var a = system.filteredEntities(this,this.isEnemy,player.ship,25600);
if(!a || !a.length) return;
var b = a[Math.floor(a.length*Math.random())];
if(Math.random()>0.8-(Math.log(this.red)*0.1)){
b.fireMissile();
b.awardEquipment('EQ_VECTOR_FUNA_MISSILE');
}
}
}
this.setSound = function(newSound)
{
if(!this.audio) return;
switch(newSound){
case 1: this.mySound.sound = 'vector_passenger1.ogg'; break;
case 2: this.mySound.sound = 'vector_passenger2.ogg'; break;
}
this.mySound.play();
this.inf.passengerState = newSound;
return;
}
this.showScreen = function(mtyp,moffer,advice,status)
{
var ov = "message";
if(mtyp===1){
var Title = "Dark corner of "+player.ship.dockedStation.displayName,Message = 'VECTOR_WELCOME',Pic = 'vector_cargobay'+Math.floor(Math.random()*2)+'.png',ov = "tiled",Music = 'vector_opener.ogg';
this.slaunch = true;
} else {
var Title = player.ship.dockedStation.displayName,Message = 'VECTOR_MESSAGE';
switch(mtyp){
case 2: var Pic = 'vector_message'+Math.floor(Math.random()*2)+'.png',Music = 'vector_message.ogg',Message = 'VECTOR_REVENGE'; break;
case 3: var Pic = 'vector_thanks'+Math.floor(Math.random()*2)+'.png',Music = 'vector_gift.ogg'; break;
case 4: var Pic = 'vector_official'+Math.floor(Math.random()*2)+'.png',Music = 'vector_gift.ogg'; break;
case 5: var Pic = 'vector_official'+Math.floor(Math.random()*2)+'.png',ov="caught",Music = 'vector_caught.ogg'; break;
case 6: var Pic = 'vector_thanks'+Math.floor(Math.random()*2)+'.png',Music = 'vector_gift.ogg',Message = 'VECTOR_PRESENT'; break;
case 7: var Pic = 'vector_inofficial'+Math.floor(Math.random()*2)+'.png',Music = 'vector_gift.ogg'; break;}
moffer = null;}
if(!this.audio) Music = null;
Message = expandMissionText(Message);
if(mtyp==1){
if(this.inf.expFactor>1) Message += " \f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\fexp: "+this.inf.expFactor+"\n";
else Message += " \n------------------------------------------------------------\n";
}
ov = "vector_ov"+ov+".png";
if(moffer) mission.runScreen({title:Title,message:Message,background:Pic,overlay:ov,choicesKey:moffer,music:Music},this.choiceEvaluation);
else mission.runScreen({title:Title,message:Message,background:Pic,overlay:ov,music:Music});
if(advice){
mission.addMessageText(this.mc.advice);
this.mc.advice = '';
}
if(status){
var i = status;
while(i--){mission.addMessageText("");}
mission.addMessageText("Name: \r\r\r\r\r"+expandDescription("[commander_name]")+"\r\r\r\r\rGC-ID: #"+player.ship.entityPersonality);
mission.addMessageText("Account:\r\r\r\r"+player.credits.toFixed(1)+"\nStatus:\r\r\r\r\r"+player.legalStatus+"\nClassification: \r"+player.rank+"\nRating:\r\r\r\r\r"+player.score);
if(this.inf.expFactor<=1) b = "none";
else {
var a = Math.floor(this.inf.expFactor*0.33),b = '';
while(a--){b += '\b';}
}
mission.addMessageText("\nExperience: "+b);
}
return;
}
this.shipWillEnterWitchspace = function()
{
this.cleanAdvice();
}
this.shipWillExitWitchspace = function()
{
this.checkSun();
this.checkPodsTime();
this.allowS = false;
this.allowI = false;
if(this.ISSOrNova) return;
++this.addChance;
this.addChance &= 7;
if((clock.days&31)===this.addChance && missionVariables.vector_arn && missionVariables.vector_arn==='UNLIMITED') system.addShipsToRoute('vector_arn',1,0.1,'wp');
if(!this.extraA || this.red>6) return;
if(this.logging) log(this.name,this.name+": Exp:"+this.inf.expFactor+" Ships:"+system.countShipsWithRole('vector')+" Gov:"+system.government);
if((system.ID&this.addChance)===this.addChance && system.government>3 && player.score>200) system.addShipsToRoute('vector_richman',1,(this.inf.expFactor*0.01),'wp');
}
this.equipmentDamaged = function(equipmentKey)
{
if(equipmentKey==='EQ_VECTOR_SCOOPS') player.ship.removeEquipment('EQ_VECTOR_SCOOPS');
}
this.checkSun = function()
{
if(system.isInterstellarSpace || system.sun.isGoingNova || system.sun.hasGoneNova) this.ISSOrNova = true;
else this.ISSOrNova = false;
return;
}
this.checkPodsTime = function()
{
if(player.score>249) return;
if((clock.days&7)===7 && this.extraA) missionVariables.vector_limiter = Math.max(1,this.red);
else missionVariables.vector_limiter = 0;
if(this.logging) log(this.name,this.name+': Pods:'+missionVariables.vector_limiter+' Day:'+(clock.days&7));
return;
}
this.shipDied = function()
{
this.cleanAdvice();
this.mySound.stop();
}
this.cleanAdvice = function()
{
if(this.adviceTimer){
this.adviceTimer.stop();
delete this.adviceTimer;
}
return;
}
/* Notification from OXPConfig2.x -> change subscripts */
this.oxpcNotifyOnChange = function()
{
if(worldScripts.vector_missionArn.init) worldScripts.vector_missionArn.init = true;
return;
}
/* OXPConfig audio = sound and music, extraA = adding additional vector, extraB = advanced status display */
this.oxpcSettings = {
Info: {Name:"vector",Display:"Vector",InfoB:"Climb to the top of the 'business' or be the good guy."},
Bool0: {Name:"logging",Def:false,Desc:"Logging functions."},
Bool1: {Name:"audio",Def:true,Desc:"Sound and music."},
Bool2: {Name:"extraA",Def:false,Desc:"Additional Vectors."},
Bool3: {Name:"extraB",Def:true,Desc:"Advanced Status Display."}
};
|
Scripts/vector_areidis.js |
"use strict";
this.name = "vector_areidis";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Areidis-Station handling";
this.version = "1.7.2";
this.startUp = function()
{
delete this.startUp;
if(!worldScripts.Cabal_Common_Functions || typeof(worldScripts.Cabal_Common_Functions.Cabal_Common)==='undefined'){this.killSelf(" -> Cabal_Common_Library is missing."); return;}
this.helper = new worldScripts.Cabal_Common_Functions.Cabal_Common();
if(this.helper.internalVersion<14){this.killSelf(" -> Cabal_Common_Functions is too old."); return;}
delete this.killSelf;
if(worldScripts.vector_pad.startUp) worldScripts.vector_pad.startUp();
this.infos = worldScripts.vector_pad.padInfos.areidis;
}
this.killSelf = function(desc)
{
if(desc!==1){player.consoleMessage(this.name+" - Check your Latest.log.",10); log(this.name,this.name+" - Shutting down."+desc);}
for(prop in this){if(prop!=='name' && prop!=='version' && prop!=='oolite_manifest_identifier') delete this[prop];}
this.deactivated = true;
return;
}
this.missionScreenOpportunity = function()
{
// Codes 1 = codecard, 2 who, 4 where, 8 password, 16 message, 32 decrypted, 64 visited, 128 disabled, 256 destroyed, 512 actor found, 1024 actor done
if(!player.ship.docked) return;
var st = player.ship.dockedStation;
if(!st.hasRole('areidis')) return;
this.infos = worldScripts.vector_pad.padInfos.areidis;
if(this.walkDone){
if(this.ar && this.ar.cubeDone) this.cubesCB(true);
else this.cubesCB(false);
} else {
this.ar = new Object({s:null,blocked:true,cubeDone:false});
this.ar.swSound = new SoundSource;
this.ar.swSound.loop = false;
if(oolite.gameSettings.shaderEffectsLevel=='SHADERS_OFF' || oolite.gameSettings.shaderEffectsLevel=='SHADERS_NOT_SUPPORTED') this.ar.sLevel = false;
else this.ar.sLevel = true;
// Change blocked...
this.ar.blocked = st.script.autoDefense;
// Set current #
this.ar.areidis = this.infos.locations.indexOf(system.ID);
var obj = {
role:"vector_areidiswalk_corridor",
absolutePos:[0.1,0.1,250],
ori:[1,0,0,0],
briefing:[
[1,"repos",[0,2,[0,0,218]]],
[2,"repos",[0,3,[0,0,218]]],
[3,"prop",[0,-1,"fuel",0.1,4,0,4]],
[4,"prop",[0,2,"fuel",0.1,4,0,4]],
[16,"walk",[0,-1,6,10,0.15,2,0,0],"Spooky. Looks like a major malfunction... or sabotage.","vector_stationwalk.ogg",3],
[40,null,null,null,"vector_stationdoors1.ogg"],
[41,"prop",[0,-1,"lightsActive",true,0,0,0]],
[42,"continue",["checkpoints",1]],
[45,"stopVelo",[0,-1]],
[46,null,null,null,"vector_stationdoors2.ogg"],
[47,"mVelo",[0,0,12,0,-5.7,0,0,2,4]],
[48,"mVelo",[0,1,12,0,5.7,0,0,2,4]],
[90,"prop",[0,-1,"lightsActive",false,0,0,0]],
[97,"walk",[0,-1,16,26.7,0.15,0.75,0,0],"Hmm. Nobody's here.","vector_stationwalk.ogg",8],
[121,null,null,"What happened? There must have been a explosion."],
[159,"prop",[0,2,"fuel",-0.05,4,4,4]],
[160,"stopSound"],
[161,"bind",[0,2,8,3,0]],
[162,"rot",[0,3,2.5,0,0.015,0,0,1,1]],
[163,"rot",[0,2,2.5,0,0.018,0,0,1,1]],
[164,"zoom",[0,3,1.5,0.995,0,1,0.5]],
[165,null,null,"I just got here. This terminal seems to be active...","vector_walkdone.ogg"],
[196,"zoom",[0,3,1,0.975,0,1,0]],
[200,"kill","VECTOR_AREIDIS_SKIP"],
[201,0]
],
title:player.ship.dockedStation.displayName,
background:"vector_areidiswalk.png",
music:"vector_areidis.ogg",
callback:this.name,
callbackf:"choiceEval"
};
if(this.ar.blocked || !missionVariables.vector_arn || missionVariables.vector_arn!=='UNLIMITED') obj.callbackc = 'VECTOR_AREIDIS';
else obj.callbackc = 'VECTOR_AREIDISB';
// Set visited
worldScripts.vector_pad.padInfos.areidis.codes[this.currentAreidis] |= 64;
// Set where
if(worldScripts.vector_pad.padInfos.areidis.display.where[this.currentAreidis]==="Unknown") worldScripts.vector_pad.addToLogbook("DAA "+system.name,"DAB");
worldScripts.vector_pad.padInfos.areidis.display.where[this.currentAreidis] = system.name;
worldScripts.Cabal_Common_Briefing.startBriefing(obj);
}
return;
}
this.checkpoints = function(n)
{
if(!missionVariables.vector_arn || missionVariables.vector_arn!=='UNLIMITED') return(false);
if(n===1){
if(!this.ar.blocked) return(true);
else mission.addMessageText("Hmm. The doors seem to be blocked. I should return later.");
}
return(false);
}
this.callCubes = function()
{
if((worldScripts.vector_pad.padInfos.areidis.codes[this.currentAreidis]&1)){
var hint = worldScripts.vector_pad.decrypt(this.infos.code,this.infos.hints[this.currentAreidis].hint,this.infos.hints[this.currentAreidis].fib);
var obj = new Object({who:this.name,code:this.infos.cubic[this.currentAreidis],ovl:this.infos.materials[this.currentAreidis],noovl:hint,image:'vector_areidiswalk.png'});
} else var obj = new Object({who:this.name,code:this.infos.cubic[this.currentAreidis],ovl:0,noovl:0,image:'vector_areidiswalk.png'});
worldScripts.vector_cubes.startCubes(obj);
return;
}
this.choiceEval = function(choice){worldScripts.vector_areidis.delayChoice(choice); return;}
this.delayChoice = function(choice)
{
switch(choice){
case 'VECTOR_AREIDIS_EXIT':
this.ar.swSound.stop();
player.ship.launch();
break;
case 'VECTOR_AREIDIS_SKIP':
this.ar.swSound.stop();
this.callCubes();
break;
case 'VECTOR_AREIDIS_TERMINAL':
this.callCubes();
break;
case 'VECTOR_AREIDIS_PAD':
worldScripts.vector_pad.startPAD("codes");
break;
}
return;
}
// Callback
this.cubesCB = function(state)
{
if(state){
mission.runScreen({title:player.ship.dockedStation.displayName,choicesKey:'VECTOR_AREIDISD',background:'vector_areidiswalk.png',music:'vector_areidis.ogg'},this.choiceEval);
var a = worldScripts.vector_pad.padInfos.areidis.messages[this.currentAreidis];
var b = this.helper.strScreenSubString(expandMissionText(a),70);
mission.addMessageText("Messages to 'contacts':\n");
mission.addMessageText(b);
this.showSound(0,'vector_areidismessage.ogg');
this.ar.cubeDone = true;
this.walkDone = true;
worldScripts.vector_pad.padInfos.areidis.codes[this.currentAreidis] |= 16;
} else mission.runScreen({title:player.ship.dockedStation.displayName,choicesKey:'VECTOR_AREIDISC',background:'vector_areidiswalk.png',music:'vector_areidis.ogg'},this.choiceEval);
return;
}
this.showSound = function(loop,sound)
{
if(loop) this.ar.swSound.loop = true;
else this.ar.swSound.loop = false;
this.ar.swSound.sound = sound;
this.ar.swSound.play();
return;
}
this.shipWillLaunchFromStation = function()
{
this.walkDone = false;
if(this.ar) delete this.ar;
}
|
Scripts/vector_areidisStation.js |
"use strict";
this.name = "vector_areidisStation";
this.author = "Svengali";
this.copyright = "CC-by-nd-sa-3.0";
this.description = "Areidis station";
this.version = "1.7.1";
this.shipSpawned = function()
{
let c = ['Alpha','Beta','Gamma','Delta','Epsilon'];
this.areidisIndex = c.indexOf(this.ship.name.substr(8,30));
this.ship.subEntities[2].fuel = this.areidisIndex/10;
this.prop = -0.35;
this.autoDefense = true;
this.emp = true;
this.channel = false;
this.ship.suppressArrivalReports = true;
if(this.areidisIndex>2) this.areidisComm = {display:"Areidis",who:this.ship,ent:true,pID:this.ship.entityPersonality,callback:"commCall",react:[{display:"Send code"},{display:"Back"}]};
var buoy = 0;
if(player.ship.equipmentStatus('EQ_VECTOR_AREIDIS_SCANNER')==='EQUIPMENT_OK') buoy=2;
else if(!this.areidisIndex) buoy=1;
if(!buoy) return;
if(!system.countShipsWithRole('vector_areidisBuoy')){
if(buoy===1) system.addShips('vector_areidisBuoyA',1,this.ship.position.add([5000,5000,5000]));
else system.addShips('vector_areidisBuoyB',1,this.ship.position.add([5000,5000,5000]));
}
if(buoy===2) player.commsMessage("Areidis station detetcted.");
else player.commsMessage("Unknown architecture detetcted.");
}
this.shipTakingDamage = function(amount,whom,type)
{
if(!player.ship.isValid) return;
if(whom){
if(whom.isPlayer){
if(this.ship.subEntities.length<(this.ship.subEntityCapacity-this.areidisIndex)){
this.autoDefense = false;
this.ship.lightsActive = false;
if(!this.ship.subEntities[3].fuel && !this.animTimer){
this.prop *= -1.0;
this.animTimer = new Timer(this,this.doAnimTimer,0,0.25);
}
if(this.ship.target) this.ship.target = null;
return;
}
}
}
this.autoDefense = true;
this.ship.lightsActive = true;
if(this.ship.subEntities[3].fuel===7 && !this.animTimer){
this.prop *= -1.0;
this.animTimer = new Timer(this,this.doAnimTimer,0,0.25);
}
}
this.shipBeingAttackedByCloaked = function()
{
if(!player.ship.isValid) return;
if((this.areidisIndex&1) && this.emp){
this.ship.spawnOne("EQ_VECTOR_EMP_MINE");
this.emp = false;
}
}
this.alertConditionChanged = this.getTarget = function(nC)
{
if(!player.ship.isValid) return;
if(player.ship.docked && player.ship.dockedStation==this.ship){
if(nC===3){
var aSound = new SoundSource;
aSound.sound = 'vector_stationalert.ogg';
aSound.play();
this.autoDefense = true;
this.ship.lightsActive = true;
if(!this.ship.subEntities[3].fuel && !this.animTimer){
this.prop *= -1.0;
this.animTimer = new Timer(this,this.doAnimTimer,0,0.25);
}
return;
}
}
var entList = this.findTheBadOnes();
if(entList.length>0){
var enemy = entList[0];
if(enemy.position.distanceTo(this.ship.position)>22000) enemy = entList[Math.floor(Math.random()*entList.length)];
if(enemy.isPlayer){
if(!this.autoDefense) return;
if(!this.channel){
worldScripts.Cabal_Common_Comms.addToComm(this.myComm);
this.channel = true;
}
}
if(enemy.position.distanceTo(this.ship.position)<22000){
if(this.autoDefense){
this.ship.target = enemy;
this.ship.reactToAIMessage('TARGET_FOUND');
this.ship.lightsActive = true;
if(this.ship.subEntities[3].fuel===7 && !this.animTimer){
this.prop *= -1.0;
this.animTimer = new Timer(this,this.doAnimTimer,0,0.25);
}
return;
}
}
}
if(this.ship.alertCondition>2) this.ship.reactToAIMessage('COOL_DOWN');
return;
}
this.isBad = function(entity)
{
return(entity.isShip && !entity.isBeacon && !entity.isCargo && (!entity.isWeapon || (entity.owner && !entity.owner.hasRole('areidis'))) && entity.status=='STATUS_IN_FLIGHT' && !entity.isCloaked);
}
this.findTheBadOnes = function()
{
return system.filteredEntities(this,this.isBad,this.ship,25600);
}
this.shipDied = function()
{
if(!player.ship.isValid) return;
if(this.animTimer) this.animTimer.stop();
if(worldScripts.vector_areidis.swSound) worldScripts.vector_areidis.swSound.stop();
if(system.countShipsWithRole('vector_areidisBuoy')) system.shipsWithRole('vector_areidisBuoy')[0].explode();
}
this.doAnimTimer = function()
{
this.ship.subEntities[3].fuel += this.prop;
this.ship.fuel -= this.prop*1.3;
if(!this.ship.subEntities[3].fuel || this.ship.subEntities[3].fuel===7){
this.animTimer.stop();
delete this.animTimer;
}
}
this.commCall = function(action)
{
switch(action){
case 0:
if(!this.ship.subEntities[3].fuel && !this.animTimer){
this.autoDefense = false;
this.ship.lightsActive = false;
this.prop *= -1.0;
this.animTimer = new Timer(this,this.doAnimTimer,0,0.25);
if(this.ship.target) this.ship.target = null;
this.ship.commsMessage("Disabling selfdefense mode.");
}
if(this.ship.subEntities[3].fuel===7 && !this.animTimer){
this.autoDefense = true;
this.ship.lightsActive = true;
this.prop *= -1.0;
this.animTimer = new Timer(this,this.doAnimTimer,0,0.25);
this.ship.commsMessage("Enabling selfdefense mode.");
}
break;
}
return;
}
|
Scripts/vector_arn.js |
"use strict";
this.name = "vector_arn";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Richmans World";
this.version = "1.7.1";
this.shipSpawned = this.shipExitedWormhole = function()
{
if(system.sun.isGoingNova || system.sun.isGoneNova || system.mainStation.position.distanceTo(this.ship)<35000) this.ship.switchAI('exitingTraderAI.plist');
else if(this.ship.AI!=='vector_arnAI.plist') this.ship.switchAI('vector_arnAI.plist');
if(this.ship.escorts && this.ship.escorts.length) this.passE = this.ship.escorts;
this.counter = 0;
this.enableP = true;
if(missionVariables.vector_arn && missionVariables.vector_arn==='UNLIMITED'){
this.doArn = false;
this.meetAgain = true;
if(worldScripts.vector.logging) log(this.name,this.name+': Arn entered system.');
} else {
if(missionVariables.vector_arnmeet<5) missionVariables.vector_arnmeet++;
this.actArn = Math.floor(Math.random()*6)+2;
this.doArn = true;
if(worldScripts.vector.logging) log(this.name,this.name+': Arn entered system. act:'+this.actArn+' do:'+this.doArn);
}
}
this.shipLaunchedEscapePod = function(escapepod)
{
if(this.ship.isValid) this.ship.displayName = "Abandoned";
if(escapepod) escapepod.script.breakoff = this.passE;
}
this.chattyPilot = function()
{
if(!player.ship.isValid) return;
var distance = Math.round(player.ship.position.distanceTo(this.ship));
if(distance<25000){
if(this.meetAgain){
this.ship.reactToAIMessage('CHATBOXC');
return;
}
if(this.doArn && this.counter===this.actArn){
system.addShips('vector_arnForce',3,this.ship.position,12000);
this.ship.fuel = 0;
this.ship.AIState = 'PLAYER_DIE';
} else {
if(this.ship.escorts && this.ship.escorts.length) this.passE = this.ship.escorts;
if(this.doArn && (this.counter&1)) this.ship.reactToAIMessage('CHATBOXB');
else this.ship.reactToAIMessage('CHATBOX');
if(this.enableP){worldScripts.vector_pad.seenArn = true; delete this.enableP;}
}
++this.counter;
}
return;
}
|
Scripts/vector_benus.js |
"use strict";
this.name = "vector_benus";
this.author = "Svengali";
this.copyright = "CC-by-nd-sa-3.0";
this.description = "Benus Triadon";
this.version = "1.7.2";
this.shipSpawned = function()
{
if(worldScripts.vector.logging) log(this.name,this.name+': Benus entered system. Uh, trouble.');
if(this.ship.primaryRole==="trader"){this.ship.setScript("oolite-default-ship-script.js"); this.ship.switchAI("route1traderAI.plist"); return;}
this.commChannel = {display:"Benus Triadon",who:this.ship,ent:true,pID:this.ship.entityPersonality,callback:"commCall",
react:[{display:"Hail"},{display:"Direction"},{display:"Safety"},{display:"Back"}]};
this.pflag = false;
this.aflag = false;
this.sflag = false;
this.chatter = 1;
this.ship.primaryRole==='trader';
this.ov = new worldScripts.vector_news.VectorOV();
this.ov.addCharacterOVOff('14');
if(Math.random()>0.5){
system.addShips('thargoid',2,this.ship.position,25000.0);
player.commsMessage("Mayday! Thargoids are attacking. Position marked (X). Send help!");
this.mark = system.addShips('vector_mark',1,this.ship.position.add([0,0,300]),100)[0];
}
this.bla = ["Oh boy - good work. Please stay close.",
"Good work! Please stay close, we need some support.",
"Please escort us. I can smell that there are still some of them.",
"Rock on! Please stay close."];
return;
}
this.shipBeingAttacked = function(whom)
{
if(!player.ship.isValid) return;
if(whom && whom.isPlayer){
if(!this.pflag && this.chatter>0) worldScripts.Cabal_Common_Comms.removeFromComm(this.commChannel);
this.chatter = 0;
this.pflag = true;
if(this.mark && this.mark.isValid) this.mark.explode();
} else {
this.aflag = true;
if(this.chatter==1 && this.ship.position.distanceTo(player.ship.position)<23000){
this.ship.displayName = "Benus Triadon";
this.ov.addOv(1,'07',null,null,1);
worldScripts.Cabal_Common_Comms.addToComm(this.commChannel);
this.chatbox(1);
this.chatter = 2;
var cols = worldScripts.vector.myColor;
this.ship.scannerDisplayColor1 = cols[0];
this.ship.scannerDisplayColor2 = cols[1];
if(this.mark && this.mark.isValid) this.mark.explode();
}
}
return;
}
this.shipEnergyBecameFull = this.shipTargetDestroyed = this.shipTargetLost = function()
{
if(!this.ship.isPiloted || this.ship.isDerelict || !player.ship.isValid) return;
var enemy = this.getArea();
if(enemy.length){
for(let i=0;i<enemy.length;i++){
if(enemy[i].isValid){
this.aflag = true;
this.ship.target = enemy[i];
this.ship.reactToAIMessage("TARGET_FOUND");
break;
}
}
} else {
this.aflag = false;
this.placeNewSet();
if(this.ship.position.distanceTo(player.ship.position)<23000 && this.chatter==2) this.chatter = 3;
}
return;
}
this.isOuch = function(entity)
{
return(entity.isShip && !entity.isPlayer && !entity.hasSuspendedAI && !entity.isCargo && !entity.isRock && !entity.isDerelict && (entity.bounty>0 || entity.primaryRole==='pirate' || (entity.target==this.ship && entity.group!=this.ship.group)));
}
this.getArea = function()
{
return system.filteredEntities(this,this.isOuch,this.ship,25600);
}
this.shipEnteredStationAegis = this.shipEnteredPlanetaryVicinity = function()
{
if(!player.ship.isValid) return;
if(this.ship.position.distanceTo(player.ship.position)<23000){
if(this.chatter>1){
if(this.chatter!=2) this.chatbox(4);
this.placeNewSet();
this.ship.reactToAIMessage("SPEED_UP_MORE");
}
}
return;
}
this.shipWillDockWithStation = function()
{
if(!player.ship.isValid) return;
if(this.mark && this.mark.isValid) this.mark.explode();
worldScripts.Cabal_Common_Comms.removeFromComm(this.commChannel);
if(this.ship.position.distanceTo(player.ship.position)<23000){
if(!player.ship.docked){
if(this.chatter>1){
this.chatbox(3);
worldScripts.vector_pad.addToLogbook("AAB "+system.name,"AAC");
worldScripts.vector_pad.showBenus = true;
}
} else player.commsMessage("Benus here. You should have waited for me. Next time then...");
}
return;
}
this.shipDied = this.shipLaunchedEscapePod = function()
{
if(!player.ship.isValid) return;
player.commsMessage("Aaargh..");
if(this.mark && this.mark.isValid) this.mark.explode();
worldScripts.Cabal_Common_Comms.removeFromComm(this.commChannel);
return;
}
this.chatbox = function(m)
{
if(!player.ship.isValid || this.pflag) return;
if(typeof(m)==='object' && (this.ship.position.distanceTo(player.ship.position)>23000 || this.chatter<2)) return;
if(m){
var speak,sound;
if(typeof(m)==='object'){
if(this.chatter>1) speak = "Uff. Station reached. Requesting slot now. Wait until I'm docked, ok?";
} else {
switch(m){
case 1: speak = "Over here, Commander. Please help!"; sound = '[vector_benusA]'; break;
case 3: this.ov.addOv(null,'14',1,null,"Will meet you in a minute on the bar."); break;
case 4: speak = "Yeeha. Only a quick hop now. We should have some drinks together."; break;
}
}
} else {
if(this.ship.position.distanceTo(player.ship.position)>23000 || this.chatter<2 || this.aflag) return;
if(this.bla.length){speak = this.bla[0]; this.bla.shift();}
}
if(speak){
if(sound) this.ov.addOv(null,'14',1,null,{ent:this.ship,message:speak},sound);
else this.ov.addOv(null,'14',1,null,{ent:this.ship,message:speak},'[vector_benusB]');
}
return;
}
this.placeNewSet = function()
{
if(this.mark && this.mark.isValid) this.mark.explode();
if(!this.sflag && !this.pflag){
this.sflag = true;
var newSet = [{display:"Hail"},{display:"Direction"},{display:"Safety"},{display:"Help"},{display:"Speed up"},{display:"Back"}];
worldScripts.Cabal_Common_Comms.changeChoicesComm(this.commChannel.pID,newSet);
this.commChannel.react = newSet;
}
return;
}
this.commCall = function(action)
{
if(this.pflag || this.ship.position.distanceTo(player.ship.position)>25000) return;
var m=null;
switch(action){
case 0: if(this.aflag) m = '[vector_commhailB]'; else m = '[vector_commhailA]'; break;
case 1: if(this.aflag) m = '[vector_commdirectionB]'; else m = '[vector_commdirectionA]'; break;
case 2: if(this.aflag) m = '[vector_commsafetyB]'; else m = '[vector_commsafetyA]'; break;
case 3:
if(this.aflag) m = '[vector_commhelpC]';
else {
if(player.ship.hasHostileTarget || player.alertCondition===3){
if(player.ship.target && player.ship.target!=this.ship && player.ship.target.bounty){
this.ship.target = player.ship.target;
this.ship.reactToAIMessage("ATTACKED");
}
m = '[vector_commhelpB]';
} else m = '[vector_commhelpD]';
}
break;
case 4:
if(player.ship.maxSpeed>340 && !this.aflag){
if(this.ship.position.distanceTo(system.mainStation.position)>25000){
m = '[vector_commbenusspeedA]';
if(!this.ship.fuel) this.ship.fuel+=1;
this.ship.reactToAIMessage("SPEED_UP_MORE");
break;
}
}
m = '[vector_commbenusspeedB]';
break;
}
if(m) this.ship.commsMessage(expandDescription(m));
return;
}
|
Scripts/vector_cpodD.js |
"use strict";
this.name = "vector_cpodD";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Special Pod D";
this.version = "1.7.1";
this.shipSpawned = function()
{
this.cargoSwitch = (this.ship.entityPersonality*this.ship.spawnTime)&15;
var podname = ["Black Pearls (Collection)","Jade Elephant (Collection)","Diamond Collection (Collection)","Unknown Goods (Stolen)",
"Black Pearls (Precious)","Jade Elephant (Precious)","Diamond Collection (Precious)","Unknown Goods (Stolen)",
"Black Pearls (Heirloom)","Jade Elephant (Heirloom)","Diamond Collection (Heirloom)","Unknown Goods (Stolen)",
"Black Pearls (Unknown)","Jade Elephant (Unknown)","Diamond Collection (Unknown)","Unknown Goods (Unknown)"];
this.ship.name = podname[this.cargoSwitch];
this.ship.displayName = podname[this.cargoSwitch];
if(player.score<250) missionVariables.vector_limiter = 0;
this.ov = new worldScripts.vector_news.VectorOV();
delete this.shipSpawned;
}
this.shipWasScooped = function(scooper)
{
if(scooper.isPlayer){
var limit = 1;
if(player.ship.equipmentStatus('EQ_VECTOR_SCOOPS')==='EQUIPMENT_OK') limit = 5;
if(worldScripts.vector_pad.padInfos.generic.cpods<limit){
var makeTrap = (this.ship.spawnTime*3)&15;
if(this.cargoSwitch===makeTrap){
player.commsMessage("TRAP: Fuel throwing off.");
player.ship.fuelLeakRate = 0.2;
return;
}
worldScripts.vector_pad.padInfos.generic.cpods++;
player.commsMessage("Scooped: "+this.ship.displayName);
if(limit===5) this.ov.addOv(1,'02',1,null,null);
worldScripts.vector_pad.padInfos.generic.cpod.push(this.ship.name);
} else player.commsMessage("Your special cargo bay is full: "+this.ship.displayName+" crashed.");
}
}
|
Scripts/vector_cubes.js |
"use strict";
this.name = "vector_cubes";
this.author = "Svengali";
this.copyright = "CC-by-nd-sa-3.0";
this.description = "Cubes hehe";
this.version = "1.7.1";
/* The passed object must have who, code, ovl, noovl and image!
worldScripts.vector_cubes.startCubes({who:null,code:22,ovl:null,noovl:null,image:'vector_areidiswalk.png'})
*/
this.startCubes = function(obj)
{
if(!player.ship.docked || !obj) return(false);
this.cube = new Object({
cb:obj.who,
code:obj.code,
ovl:obj.ovl,
noovl:obj.noovl,
image:obj.image,
init:true,
rotate:0,
rotloop:0,
done:false,
snd:new SoundSource,
oris:[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[1,0,0,1],[1,1,0,0],[1,0,1,0],[1,0,0,0]],
posA:[[0,0,0],[-28,-70,-290],[0,-70,-290],[28,-70,-290],[-28,-42,-290],[0,-42,-290],[28,-42,-290],[-28,-15,-290],[0,-15,-290],[28,-15,-290]]
});
if(!this.curCubes){
this.curCubes = new Object({
active:1,
1:this.cube.oris[Math.floor(Math.random()*this.cube.oris.length)],
2:this.cube.oris[Math.floor(Math.random()*this.cube.oris.length)],
3:this.cube.oris[Math.floor(Math.random()*this.cube.oris.length)],
4:this.cube.oris[Math.floor(Math.random()*this.cube.oris.length)],
5:this.cube.oris[Math.floor(Math.random()*this.cube.oris.length)],
6:this.cube.oris[Math.floor(Math.random()*this.cube.oris.length)],
7:this.cube.oris[Math.floor(Math.random()*this.cube.oris.length)],
8:this.cube.oris[Math.floor(Math.random()*this.cube.oris.length)],
9:this.cube.oris[Math.floor(Math.random()*this.cube.oris.length)]
});
}
this.cube.snd.sound = 'vector_entercode.ogg';
if(oolite.gameSettings.shaderEffectsLevel=='SHADERS_OFF' || oolite.gameSettings.shaderEffectsLevel=='SHADERS_NOT_SUPPORTED') this.cube.sLevel = false;
else this.cube.sLevel = true;
this.cubeRot = new Timer(this,this.doCubeRot,0,0.25);
this.cubeRot.stop();
this.showCubes();
return(true);
}
this.showCubes = function()
{
if(!player.ship.docked) return;
mission.runScreen({title:player.ship.dockedStation.displayName,choicesKey:'VECTOR_CUBESA',model:'vector_cubes',spinModel:false,background:this.cube.image,music:'vector_cubesm.ogg'},this.cubeEval);
mission.displayModel.orientation = [1,0,0,0];
mission.displayModel.position = [0,40,280];
for(let i=1;i<10;i++) mission.displayModel.subEntities[i].orientation = this.curCubes[i];
// Set flasher
mission.displayModel.subEntities[10].position = this.cube.posA[this.curCubes.active];
mission.displayModel.subEntities[10].lightsActive = true;
mission.displayModel.fuel = 7;
// Init
if(this.cube.init){
if(this.cube.ovl || this.cube.noovl) mission.addMessageText("Damn, I need a code.\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\fPAD connected.");
else mission.addMessageText("Damn, I need a code.");
this.cube.init = false;
} else {
mission.addMessageText("");
this.cube.snd.sound = 'vector_cubes.ogg';
}
this.cube.snd.play();
// Set overlay or texthint
if(this.cube.sLevel && this.cube.ovl) mission.displayModel.subEntities[0].setMaterials({"vector_modelview.png":{diffuse_map:"vector_cubeA.png"}},this.cube.ovl);
else if(this.cube.noovl){
mission.displayModel.subEntities[0].setMaterials({"vector_modelview.png":{diffuse_map:"vector_codes_ns.png"}});
mission.addMessageText("\n\n\n\n\n\n\n\n\n\n\n\n\n"+this.cube.noovl);
mission.displayModel.subEntities[0].position = [180,80,400];
mission.displayModel.subEntities[0].orientation = [1,0,0,0];
}
var l = this.getLock();
this.checkLock(l);
return;
}
this.cubeEval = function(choice){worldScripts.vector_cubes.delayChoice(choice); return;}
this.delayChoice = function(choice)
{
switch(choice){
case 'VECTOR_CUBENEXT':
if(this.cube.rotloop) this.abortRot();
this.cube.rotloop = 0;
this.cube.rotate = 0;
this.curCubes.active++;
if(this.curCubes.active>9) this.curCubes.active = 1;
this.showCubes();
break;
case 'VECTOR_CUBEPREVIOUS':
if(this.cube.rotloop) this.abortRot();
this.cube.rotloop = 0;
this.cube.rotate = 0;
this.curCubes.active--;
if(this.curCubes.active<1) this.curCubes.active = 9;
this.showCubes();
break;
case 'VECTOR_CUBEROTX':
if(this.cube.rotloop) this.abortRot();
this.cube.rotloop = 0;
this.cube.rotate = 1;
if(!this.cubeRot.isRunning) this.cubeRot.start();
this.showCubes();
break;
case 'VECTOR_CUBEROTY':
if(this.cube.rotloop) this.abortRot();
this.cube.rotloop = 0;
this.cube.rotate = 2;
if(!this.cubeRot.isRunning) this.cubeRot.start();
this.showCubes();
break;
case 'VECTOR_CUBEROTZ':
if(this.cube.rotloop) this.abortRot();
this.cube.rotloop = 0;
this.cube.rotate = 3;
if(!this.cubeRot.isRunning) this.cubeRot.start();
this.showCubes();
break;
case 'VECTOR_CZQUIT':
if(this.cube.cb){ // Leaves the option of missionScreenOpportunity if not used
if(this.cube.done) worldScripts[this.cube.cb].cubesCB(true);
else worldScripts[this.cube.cb].cubesCB(false);
}
break;
}
return;
}
this.abortRot = function()
{
mission.displayModel.subEntities[this.curCubes.active].orientation = this.rotEnd;
this.curCubes[this.curCubes.active] = this.rotEnd;
this.correctRot();
return;
}
this.getLock = function()
{
var lock = 0,pri = [3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61];
for(var i=1;i<10;i++){
let a = pri[i];
let b = mission.displayModel.subEntities[i].orientation.vectorUp();
if(b.x>0) lock += b.x*11*a;
if(b.y>0) lock += b.y*13*a;
if(b.z>0) lock += b.z*17*a;
b = mission.displayModel.subEntities[i].orientation.vectorRight();
if(b.x>0) lock += b.x*19*a;
if(b.y>0) lock += b.y*23*a;
if(b.z>0) lock += b.z*29*a;
b = mission.displayModel.subEntities[i].orientation.vectorForward();
if(b.x>0) lock += b.x*31*a;
if(b.y>0) lock += b.y*37*a;
if(b.z>0) lock += b.z*41*a;
}
lock = Math.floor(lock);
//log(this.name,this.name+": code:"+lock);
return(lock);
}
this.checkLock = function(lock)
{
if(lock===this.cube.code){
this.cube.done = true;
this.cube.rotloop = 0;
mission.displayModel.lightsActive = false;
mission.displayModel.velocity = [0,0,50];
mission.displayModel.fuel = 0;
this.cube.snd.sound = 'vector_verified.ogg';
this.cube.snd.play();
if(!this.cubeRot.isRunning) this.cubeRot.start();
}
return;
}
this.doCubeRot = function()
{
if(!player.ship.docked){this.cubeRot.stop(); return;}
if(this.cube.done){
if(this.cube.rotloop>=10){
this.cubeRot.stop();
if(this.cube.cb){ // Leaves the option of missionScreenOpportunity if not used
worldScripts[this.cube.cb].cubesCB(true);
}
}
this.cube.rotloop++;
return;
}
if(!this.cube.rotate){this.cubeRot.stop(); return;}
var a = new Quaternion(mission.displayModel.subEntities[this.curCubes.active].orientation);
// Get end point
if(!this.cube.rotloop){
var b = a;
for(var e=0;e<10;e++){
switch(this.cube.rotate){
case 1: b = b.rotateX(0.1566); break;
case 2: b = b.rotateY(0.1566); break;
case 3: b = b.rotateZ(0.1566); break;
}
}
this.rotEnd = new Quaternion(b);
}
// Do rotation
this.cube.rotloop++;
switch(this.cube.rotate){
case 1: a = a.rotateX(0.1566); break;
case 2: a = a.rotateY(0.1566); break;
case 3: a = a.rotateZ(0.1566); break;
}
mission.displayModel.subEntities[this.curCubes.active].orientation = a;
this.curCubes[this.curCubes.active] = this.rotEnd;
// End rotation
if(this.cube.rotloop==10){
this.cube.rotate = 0;
this.cube.rotloop = 0;
this.cubeRot.stop();
delete this.rotEnd;
this.correctRot();
var l = this.getLock();
this.checkLock(l);
}
return;
}
this.correctRot = function()
{
var a = mission.displayModel.subEntities[this.curCubes.active].orientation;
a.w = this.getCorrected(a.w);
a.x = this.getCorrected(a.x);
a.y = this.getCorrected(a.y);
a.z = this.getCorrected(a.z);
mission.displayModel.subEntities[this.curCubes.active].orientation = a;
this.curCubes[this.curCubes.active] = a;
return;
}
this.getCorrected = function(e)
{
if(e > 0.9) e = 1;
if(e > 0.6 && e < 0.8) e = 0.707107;
if(e > 0.4 && e < 0.6) e = 0.5;
if(e >-0.1 && e < 0.1) e = 0.0;
if(e >-0.6 && e <-0.4) e = -0.5;
if(e >-0.8 && e <-0.6) e = -0.707107;
if(e <-0.9) e = -1;
return(e);
}
|
Scripts/vector_empmine.js |
"use strict";
this.name = "vector_empmine";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Boooh";
this.version = "1.7.1";
this.goBoom = function()
{
this.ship.spawn("vector_effect_emp",1);
let targets = system.filteredEntities(this,this.badBoys,this.ship,25000);
if(targets){
for(let i=0;i<targets.length;i++){
if(targets[i].isPlayer){
var s = new SoundSource;
s.sound = "vector_empbang.ogg";
s.play();
}
if(targets[i].isCloaked && targets[i].equipmentStatus('EQ_CLOAKING_DEVICE')==='EQUIPMENT_OK'){
targets[i].setEquipmentStatus('EQ_CLOAKING_DEVICE','EQUIPMENT_DAMAGED');
if(targets[i].isPlayer){
player.commsMessage("Hit by EMP!");
}
}
}
}
}
this.badBoys = function(entity)
{
return(entity.isValid && entity.isShip);
}
|
Scripts/vector_epodA.js |
"use strict";
this.name = "vector_epodA";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Special Escapepod";
this.version = "1.7.1";
this.shipSpawned = function()
{
this.ship.switchAI('vector_epodAI.plist');
var podname = expandDescription('%N')+' '+randomName();
this.ship.name = podname;
this.ship.displayName = podname;
if(this.ship.owner && !this.ship.owner.isPlayer){
this.ship.displayName = podname+this.ship.owner.scriptInfo.vector_epodName;
this.ship.owner.switchAI('vector_wreckAI.plist');
}
if(player.score<250) missionVariables.vector_limiter = 0;
this.ov = new worldScripts.vector_news.VectorOV();
delete this.shipSpawned;
}
this.shipWasScooped = function(scooper)
{
if(scooper.isPlayer){
var limit = 1;
if(player.ship.equipmentStatus('EQ_VECTOR_SCOOPS')==='EQUIPMENT_OK') limit = 5;
if(worldScripts.vector_pad.padInfos.generic.epods<limit){
worldScripts.vector_pad.padInfos.generic.epods++;
if(limit===5) this.ov.addOv(1,'02',1,null,null);
worldScripts.vector_pad.padInfos.generic.epod.push(this.ship.displayName);
switch((this.ship.entityPersonality&7)){
case 1: worldScripts.vector.setSound(1); player.commsMessage('Your new passenger '+this.ship.name+' is totally drunken.'); break;
case 2: worldScripts.vector.setSound(2); player.commsMessage('Your new passenger '+this.ship.name+' is a little bit renitent.'); break;
}
} else player.commsMessage('Your special pod bay is full: '+this.ship.displayName+' crashed.');
}
}
|
Scripts/vector_epodHintA.js |
"use strict";
this.name = "vector_epodHintA";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Special Escapepod";
this.version = "1.7.1";
this.shipWasScooped = function(scooper)
{
var yep = 0;
if(scooper && scooper.isPlayer && galaxyNumber===5){
if(worldScripts.vector_news.secondaryInfos.specialist.state.stage===0){
yep = 1;
worldScripts.vector_news.secondaryInfos.specialist.state.stage = 1;
worldScripts.vector_pad.addToLogbook("EAA Qubiisis");
player.addMessageToArrivalReport("After unloading the escape pods one of the rescued pilots tells you about a strange station hidden behind the sun at Qubiisis. \'I haven't docked there, but it seems to be a colony. Who knows what kind of species lives there, but they must have some kind of heat shielding so close to the sun. They didn't made any attempt to communicate. Strange. I've only noticed them, because I was heading away from the sun for cooling the ship down and tried to avoid a group of pirates. I doubt that I could find this colony again, because it was so far off from any standard route. Must have been 2 sun radii or so at a strange angle.\'");
} else if(worldScripts.vector_pad.padInfos.areidis.codes[0]===1){
yep = 1;
player.addMessageToArrivalReport("One of the pilots tells you about a strange station. \'I was hired to gather infos about solar winds when we stumbled over this \'thing\'. A station on a rock somewhere between planet and sun, but off from the lanes at Tetied. We've had this on our scanner and visual contact was possible, but didn't close in to investigate. Probably a abandoned station, but who knows. I was surprised, but unfortunately there was no time anymore.\'");
}
if(yep) player.commsMessage("Woow. I really thought it's over. My oxygen level was low.");
else player.ship.manifest.slaves += 1;
}
}
|
Scripts/vector_funA.js |
"use strict";
this.name = "vector_funA";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "SpecialA";
this.version = "1.7.1";
this.shipSpawned = function()
{
var min = 0;
switch(this.ship.primaryRole){
case "EQ_VECTOR_FUNA_MISSILE": min = 3; this.ship.displayName = 'Marc X Rocketeer Missile'; break;
case "EQ_VECTOR_FUNB_MISSILE": min = 6; this.ship.displayName = 'Barkas Barrier Missile'; break;
case "EQ_VECTOR_FUNC_MISSILE": min = 0; this.ship.displayName = 'Sorrowbringer'; break;
}
if(min){
if(worldScripts.vector.red<min || !this.ship.owner || !this.ship.target || !this.ship.target.isPlayer) this.ship.explode();
if(player.ship.subEntities.length){
var plcheck = player.ship.subEntities;
var i = plcheck.length;
while(i--){
if(plcheck[i].status==='STATUS_ACTIVE'){
if(!this.die) this.die = [];
this.die.push(plcheck[i]);
}
}
}
}
this.t = this.ship.target;
}
this.confuseTarget = function()
{
if(this.die){
var a = this.die[Math.floor(Math.random()*this.die.length)];
if(a && a.isValid) a.explode();
}
this.ship.AIState = 'EXPLODE';
}
this.waitForDecloak = function()
{
if(this.t.isCloaked) return;
this.ship.target = this.t
this.ship.AIState = 'MAKE_CONFUSION';
}
|
Scripts/vector_insp.js |
"use strict";
this.name = "vector_insp";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Inspection";
this.version = "1.7.1";
this.startUp = function()
{
delete this.startUp;
this.ov = new worldScripts.vector_news.VectorOV();
}
this.shipWillDockWithStation = function()
{
if(this.inspectionTimer){this.inspectionTimer.stop(); delete this.inspectionTimer;}
if(this.insp){
if(this.insp.penalty) player.addMessageToArrivalReport("You're fined with "+this.insp.penalty+" Credits for trading in illegal goods.");
if(this.insp.ins && this.insp.ins.isValid) this.insp.ins.remove();
delete this.insp;
}
}
this.startInspection = function(station,other)
{
if(!player.ship.isValid || this.insp) return; // No double walk .-)
if(player.bounty>7){
let a = station;
a.launchPatrol();
player.commsMessage(station.name+": Give up, pirate! Over and out.");
return;
}
if(worldScripts.vector.audio) this.mySound = new SoundSource;
this.insp = new Object({wait:0,loop:0,warn:0,penalty:0,init:false,freight:0,station:station,time:clock.seconds,other:other});
this.inspectionTimer = new Timer(this,this.doInspectionTimer,0,10);
if(worldScripts["BGS-M"]) worldScripts["BGS-M"].bgsDisableChatter = true;
return;
}
this.calculatePenalty = function(penalty)
{
if(player.credits<=penalty) player.credits = Math.min(player.credits,30);
else player.credits -= penalty;
return;
}
this.doInspectionTimer = function()
{
if(!player.ship.isValid || !this.insp.station.isValid){
this.shipDied();
return;
}
if(clock.isAdjusting || player.ship.position.distanceTo(this.insp.station)>17000){
this.insp.time = clock.seconds;
return;
}
if(this.insp.init){
if(worldScripts["BGS-M"]) worldScripts["BGS-M"].bgsDisableChatter = true;
if(!this.insp.freight){
this.insp.wait = 0;
this.insp.warn = 0;
this.setSound(3);
if(worldScripts.vector.andale && Math.random()>0.3){
this.ov.addOv(null,'09',1,null,"Hmm, you're on my list. Sorry for the inconvenience, sir. Have a nice travel.","vector_insp_list.ogg");
worldScripts.vector_pad.addToLogbook("BAB "+system.name);
this.backFrom(3,1);
delete this.insp;
return;
}
++this.insp.freight;
this.ov.addOv(null,'09',1,null,"Your documents seem to be ok. Let's take a look in your cargo hold.","vector_insp_look.ogg");
return;
} else {
++this.insp.freight;
if(this.insp.freight===2){
if(manifest.slaves || manifest.narcotics || manifest.firearms){
this.insp.penalty += manifest.slaves*20+manifest.narcotics*50+manifest.firearms*70;
this.ov.addOv(null,'09',1,null,"Commander. Illegal goods found. Confiscated!","vector_insp_confiscated.ogg");
manifest.slaves = 0;
manifest.narcotics = 0;
manifest.firearms = 0;
} else if(this.insp.other){
this.insp.penalty += this.insp.other.length*40;
this.ov.addOv(null,'09',1,null,"Tss, tss. Special goods, eh? You know they are not legal here?","vector_insp_goods.ogg");
} else this.ov.addOv(null,'09',1,null,"No illegal goods in your usual cargo hold found.","vector_insp_noillegal.ogg");
} else if(this.insp.freight===3){
this.insp.penalty += (worldScripts.vector_pad.padInfos.generic.epods*400+worldScripts.vector_pad.padInfos.generic.cpods*300);
this.insp.penalty *= system.government+1;
var a = false;
if(worldScripts.vector_pad.padInfos.generic.epods) a = true;
if(worldScripts.vector_pad.padInfos.generic.cpods) a = true;
if(this.insp.penalty){
if(a) this.ov.addOv(null,'09',1,null,"We have confiscated illegal goods. You are fined with "+this.insp.penalty+" Credits.","vector_insp_confiscatedfined.ogg");
else this.ov.addOv(null,'09',1,null,"You are fined with "+this.insp.penalty+" Credits.","vector_insp_fined.ogg");
worldScripts.vector_pad.addToLogbook("BAF");
worldScripts.vector.calculatePenalty(this.insp.penalty);
worldScripts.vector.dataRW();
} else {
this.ov.addOv(null,'09',1,null,"Nothing unusual found on your ship.","vector_insp_nothing.ogg");
worldScripts.vector_pad.addToLogbook("BAA "+system.name);
}
return;
} else if(this.insp.freight===4){
this.ov.addOv(null,'09',1,null,"Inspection is over. Have a nice travel.","vector_insp_inspectionover.ogg");
} else if(this.insp.freight>=5){
this.backFrom(3,1);
delete this.insp;
return;
}
}
} else {
var timecheck = clock.seconds-this.insp.time;
if(timecheck>400){
this.backFrom(11,1);
player.commsMessage(this.insp.station.name+": A technical malfunction has occured - aborting inspection. Sorry for inconveniences and have a nice journey. Over and out.");
return;
}
if(this.insp.ins && !system.countShipsWithRole('vector_inspection')){
this.insp.station.launchShipWithRole('vector_inspection',true);
return;
}
if(system.countShipsWithRole('vector_inspection')) this.insp.ins = system.shipsWithRole('vector_inspection')[0];
let stationCorridor = new Vector3D(this.insp.station.position.subtract(system.mainPlanet.position)),corridorVector = new Vector3D(player.ship.position.subtract(this.insp.station.position));
let distToStation = corridorVector.magnitude();
let distToCorridor = distToStation*Math.sin(stationCorridor.angleTo(corridorVector));
let sdist = player.ship.position.distanceTo(this.insp.station.position);
if(distToCorridor<300 || sdist<4000){
if(!this.insp.wait){
if(distToCorridor<300){
this.setSound(12);
if(player.ship.targetSystem!==system.ID) player.commsMessage(this.insp.station.name+": Clear docking corridor and stop your engines and rudder. Do not try to jump. Over.");
else player.commsMessage(this.insp.station.name+": Clear docking corridor and stop your engines and rudder. Don't try to flee. Over.");
} else {
this.setSound(13);
if(player.ship.targetSystem!==system.ID) player.commsMessage(this.insp.station.name+": Clear danger zone and stop your engines and rudder. Do not try to jump. Over.");
else player.commsMessage(this.insp.station.name+": Clear danger zone and stop your engines and rudder. Don't try to flee. Over.");
}
} else {
if(this.insp.wait>5){
player.bounty += 70;
player.commsMessage(this.insp.station.name+": Hostile vessel. Face the consequences! Over and out.");
this.insp.station.launchPatrol();
this.insp.penalty += 1000;
this.backFrom(15,1);
}
}
++this.insp.wait;
return;
} else {
if(sdist>18000){
player.commsMessage(this.insp.station.name+": This time we don't have the time to inspect your ship. Good luck out there. Over and out.");
this.backFrom(17,1);
delete this.insp;
return;
}
if(player.ship.speed!==0){
if(this.insp.warn===0){
this.setSound(18);
this.insp.station.launchPatrol();
player.commsMessage(this.insp.station.name+": Stop your engines and rudder for ship inspection. Over.");
} else if(this.insp.warn===1){
this.insp.up = player.ship.vectorUp;
} else if(this.insp.warn===2){
this.insp.penalty += 100;
this.setSound(16);
this.insp.station.launchPatrol();
player.commsMessage(this.insp.station.name+": Stop your engines immediately or we will stop you! Over.");
} else if(this.insp.warn===3){
player.bounty += 60;
this.insp.penalty += 1000;
this.insp.station.launchPatrol();
player.commsMessage(this.insp.station.name+": Hostile vessel. Face the consequences! Over and out.");
this.backFrom(15,1);
}
++this.insp.warn;
return;
} else {
if(this.insp.loop===4 && (this.insp.vU.dot(player.ship.vectorUp)<0.999 || this.insp.pos!==player.ship.position.x)){
player.bounty += 50;
this.insp.penalty += 1000;
player.commsMessage(this.insp.station.name+": Hostile vessel. Face the consequences. Over and out.");
this.backFrom(15,1);
} else if(this.insp.loop===3){
this.insp.vU = player.ship.vectorUp;
this.insp.pos = player.ship.position.x;
} else if(this.insp.loop===2 && (this.insp.vU.dot(player.ship.vectorUp)<0.999 || this.insp.pos!==player.ship.position.x)){
this.insp.penalty += 100;
this.setSound(16);
player.commsMessage(this.insp.station.name+": This is our last warning. Stop! Over.");
this.insp.station.launchPatrol();
} else if(this.insp.loop===1){
this.insp.vU = player.ship.vectorUp;
this.insp.pos = player.ship.position.x;
this.insp.station.launchPatrol();
} else if(this.insp.loop===0){
this.setSound(18);
this.insp.station.launchShipWithRole('vector_inspection',true);
this.insp.station.launchPatrol();
player.commsMessage(this.insp.station.name+": Stop and await inspection team. Over.");
}
++this.insp.loop;
return;
}
}
}
return;
}
this.backFrom = function(sound,abort)
{
if(abort) if(this.inspectionTimer){this.inspectionTimer.stop(); delete this.inspectionTimer;}
this.setSound(sound);
if(this.insp.ins && this.insp.ins.isValid) this.insp.ins.AIState = 'RETURN_TO_SENDER';
if(worldScripts["BGS-M"]) worldScripts["BGS-M"].bgsDisableChatter = false;
return;
}
this.setSound = function(newSound)
{
if(!this.mySound) return;
switch(newSound){
case 3: this.mySound.sound = 'vector_inspection.ogg'; break;
case 4: this.mySound.sound = '[vector_peep]'; break;
case 11: this.mySound.sound = 'vector_insp_abort.ogg'; break;
case 12: this.mySound.sound = 'vector_insp_clearcorridor.ogg'; break;
case 13: this.mySound.sound = 'vector_insp_cleardangerzone.ogg'; break;
case 13: this.mySound.sound = 'vector_insp_cleardangerzone.ogg'; break;
case 14: this.mySound.sound = 'vector_insp_flee.ogg'; break;
case 15: this.mySound.sound = 'vector_insp_hostile.ogg'; break;
case 16: this.mySound.sound = 'vector_insp_lastwarning.ogg'; break;
case 17: this.mySound.sound = 'vector_insp_luck.ogg'; break;
case 18: this.mySound.sound = 'vector_insp_stop.ogg'; break;
}
this.mySound.play();
return;
}
this.shipWillEnterWitchspace = function()
{
if(this.inspectionTimer){this.inspectionTimer.stop(); delete this.inspectionTimer;}
if(this.insp) delete this.insp;
if(this.mySound){
this.mySound.stop();
delete this.mySound;
}
}
this.playerStartedJumpCountdown = function()
{
if(this.inspectionTimer && this.inspectionTimer.isRunning){
this.backFrom(14,1);
player.bounty += 50;
player.commsMessage(this.insp.station.name+": Fleeing vessel. Face the consequences!");
}
if(this.insp) delete this.insp;
}
this.shipDied = function()
{
if(this.inspectionTimer){this.inspectionTimer.stop(); delete this.inspectionTimer;}
if(this.mySound) this.mySound.stop();
}
|
Scripts/vector_inspection.js |
"use strict";
this.name = "vector_inspection";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Inspector - you are not cute and fluffy.";
this.version = "1.7.1";
this.getPos = function()
{
if(!player.ship.isValid) return;
if(!this.loop){
this.loop = 1;
this.mul = (185580/player.ship.mass)*player.ship.mass*1.5;
}
let a = player.ship.orientation.vectorForward().multiply(this.mul*(0.1/(this.loop*50.0)));
let b = player.ship.orientation.vectorUp().multiply(this.loop*20.0);
a = player.ship.position.add(a);
a = a.subtract(b);
++this.loop;
this.ship.savedCoordinates = a;
this.ship.reactToAIMessage('NEW_VECTOR');
return;
}
this.getOtherPos = function()
{
if(!player.ship.isValid) return;
if(this.loop) delete this.loop;
this.mul = (185580/player.ship.mass)*player.ship.mass;
let b = player.ship.vectorUp.multiply(200.0);
let a = player.ship.position.add(player.ship.vectorForward.multiply(this.mul*0.004)).subtract(b);
this.ship.savedCoordinates = a;
this.ship.reactToAIMessage('OTHER_VECTOR');
return;
}
this.initInspection = function()
{
if(!player.ship.isValid) return;
worldScripts.vector_insp.insp.init = true;
if(!worldScripts.vector_insp.inspectionTimer.isRunning) worldScripts.vector_insp.inspectionTimer.start();
++this.loop;
return;
}
this.shipCollided = function(other)
{
if(!player.ship.isValid) return;
if(this.loop && (this.loop===3 || this.loop===4) && other.isPlayer) this.ship.AIState = 'INSPECT_IT';
return;
}
|
Scripts/vector_missionArn.js |
"use strict";
this.name = "vector_missionArn";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Mission - Arn D'ercul";
this.version = "1.7.2";
this.startUp = function()
{
delete this.startUp;
if(!worldScripts.Cabal_Common_Functions || typeof(worldScripts.Cabal_Common_Functions.Cabal_Common)==='undefined'){this.killSelf(" -> Cabal_Common_Library is missing."); return;}
var helper = new worldScripts.Cabal_Common_Functions.Cabal_Common();
if(helper.internalVersion<14){this.killSelf(" -> Cabal_Common_Functions is too old."); return;}
var requires = ["snoopers","2.3.2"];
if(!helper.oxpVersionTest(this.name,requires)){this.killSelf(""); return;}
if(missionVariables.vector_arn && missionVariables.vector_arn==='UNLIMITED' && missionVariables.TL_FOR_EQ_VECTOR_SCOOPS){this.killSelf(1); return;}
delete this.killSelf;
this.ov = new worldScripts.vector_news.VectorOV();
this.logging = false;
this.audio = true;
this.extraB = true;
this.init = true;
this.allowS = false;
this.mySound = new SoundSource;
this.mySound.loop = true;
this.hasShown = false;
this.recalc = false;
this.visitors = 0;
this.compNews = 7;
this.excludedScreens = ['GUI_SCREEN_OPTIONS','GUI_SCREEN_SAVE','GUI_SCREEN_LOAD','GUI_SCREEN_INTRO1','GUI_SCREEN_INTRO2','GUI_SCREEN_MISSION','GUI_SCREEN_REPORT'];
if(!missionVariables.vector_arnmeet) missionVariables.vector_arnmeet = 0;
if(missionVariables.vector_nextvisit){
missionVariables.vector_arnnextvisit = missionVariables.vector_nextvisit;
missionVariables.vector_nextvisit = null;
mission.setInstructionsKey('VECTOR_ARNNEXTVISIT');
missionVariables.vector_arnvisits = missionVariables.vector_visits;
missionVariables.vector_visits = null;
}
}
this.killSelf = function(desc)
{
if(desc!==1){
player.consoleMessage(this.name+" - Check your Latest.log.",10);
log(this.name,this.name+" - Shutting down."+desc);
}
if(desc===1) missionVariables.vector_arnmeet = null; // CHECK
for(prop in this){if(prop!=='name' && prop!=='version' && prop!=='oolite_manifest_identifier') delete this[prop];}
this.deactivated = true;
return;
}
this.grabSettings = function()
{
if(missionVariables.vector_arnvisits) this.visitlist = missionVariables.vector_arnvisits.split(" ");
this.logging = worldScripts.vector.logging;
this.audio = worldScripts.vector.audio;
this.extraB = worldScripts.vector.extraB;
this.init = false;
return;
}
this.shipWillDockWithStation = function()
{
if(this.init) this.grabSettings();
if(this.redo){
player.addMessageToArrivalReport(this.redo);
delete this.redo;
}
this.mySound.loop = true;
}
this.shipDockedWithStation = function()
{
this.allowS = worldScripts.vector.allowS;
this.hasShown = false;
this.mySound.stop();
this.visitors = 0;
}
this.missionScreenOpportunity = function()
{
if(!player.ship.docked || this.hasShown || !this.allowS || (!missionVariables.vector_arn && missionVariables.vector_arnmeet<5)) return;
this.grabSettings();
this.missionOffers();
}
this.calculateVisits = function()
{
if(galaxyNumber === 3){missionVariables.vector_arnnextvisit = "in the next galaxy"; return;}
var myInfo = worldScripts.Cabal_Common_Functions.moreInfo,exSys = [6,23,55,70,128,133,162,178,194,229,247,251],setVisitlist = [],shortlist = [],checker = 0,i=256,t;
while(i--){
if(exSys.indexOf(i) !== -1) continue;
t = myInfo.galaxyStats.contains(i);
if(!t.sun || t.government !== 7) continue;
setVisitlist.push(i);
}
var l = setVisitlist.length;
if(l < 4){missionVariables.vector_arnnextvisit = "in the next galaxy"; player.commsMessage("Arn's friend was ordered to the next galaxy.",8); return;}
for(var s=0;s<4;s++){
checker = setVisitlist[Math.floor(Math.random()*l)];
if(shortlist.indexOf(checker) != -1 || checker == system.ID) s--;
else shortlist.push(checker);
}
shortlist.push(galaxyNumber);
missionVariables.vector_arnvisits = shortlist.join(" ");
mission.markSystem(shortlist[0]);
missionVariables.vector_arnnextvisit = 'Major Hurst at '+myInfo.galaxyStats.contains(shortlist[0]).name+', galaxy '+(shortlist[4]+1);
if(this.logging) log(this.name,'Calculated destinations:'+missionVariables.vector_arnvisits+" next name:"+myInfo.galaxyStats.contains(shortlist[0]).name);
return;
}
this.getNextVisit = function(clr,nextName)
{
mission.unmarkSystem(system.ID);
if(clr){
missionVariables.vector_arn = 'UNLIMITED';
missionVariables.vector_arnnextvisit = null;
missionVariables.vector_arnvisits = null;
missionVariables.vector_aldrin = null;
missionVariables.vector_arnrepeat = null;
missionVariables.vector_arnmeet = null;
mission.setInstructionsKey(null);
this.visitors = 0;
} else {
missionVariables.vector_arn = 'VISIT'+String(this.currentStage+1);
missionVariables.vector_arnnextvisit = nextName+' at '+System.systemNameForID(this.visitlist[this.currentStage])+', galaxy '+(parseInt(this.visitlist[4])+1);
mission.markSystem(this.visitlist[this.currentStage]);
mission.setInstructionsKey('VECTOR_ARNNEXTVISIT');
worldScripts.vector_pad.addToLogbook("CAI &"+nextName+" at "+System.systemNameForID(this.visitlist[this.currentStage]));
}
return;
}
this.loser = function()
{
this.showScreen('VISIT4NA',null,4,null);
this.mySound.loop = true;
this.mySound.sound = 'vector_stokitch.ogg';
this.mySound.play();
this.piLoop = 0;
worldScripts.vector_pad.addToLogbook("CAW");
if(!this.pickItemTimer) this.pickItemTimer = new Timer(this,this.pickItem,0,0.5);
else if(!this.pickItemTimer.isRunning) this.pickItemTimer.start();
missionVariables.vector_arn = 'RETRY4';
return;
}
this.pickItem = function()
{
if(guiScreen==='GUI_SCREEN_LOAD'){
this.mySound.stop();
this.piRestart = true;
} else if(this.piRestart){
this.mySound.play();
delete this.piRestart;
}
this.piLoop++;
if(this.piLoop<12) return;
var eqList = ['EQ_ADVANCED_COMPASS','EQ_ADVANCED_NAVIGATIONAL_ARRAY','EQ_CLOAKING_DEVICE','EQ_DOCK_COMP','EQ_ECM','EQ_FUEL_INJECTION','EQ_FUEL_SCOOPS','EQ_ENERGY_BOMB',
'EQ_ENERGY_UNIT','EQ_ESCAPE_POD','EQ_GAL_DRIVE','EQ_HEAT_SHIELD','EQ_MILITARY_JAMMER','EQ_MILITARY_SCANNER_FILTER','EQ_MULTI_TARGET','EQ_NAVAL_ENERGY_UNIT','EQ_NAVAL_SHIELD_BOOSTER',
'EQ_SCANNER_SHOW_MISSILE_TARGET','EQ_SHIELD_BOOSTER','EQ_TARGET_MEMORY','EQ_WORMHOLE_SCANNER'];
if(!player.ship.docked){
this.pickItemTimer.stop();
delete this.pickItemTimer;
return;
}
var a = Math.floor(Math.random()*eqList.length);
var b = eqList[a];
if(player.ship.equipmentStatus(b)==='EQUIPMENT_OK'){
player.ship.setEquipmentStatus(b,'EQUIPMENT_DAMAGED');
var z = EquipmentInfo.infoForKey(b).name;
if(guiScreen==='GUI_SCREEN_MISSION') mission.addMessageText("Uh, your "+z+" is gone.");
else player.commsMessage("Uh, your "+z+" is gone.");
worldScripts.vector_pad.addToLogbook("CAX &"+z);
}
this.piLoop = 0;
return;
}
this.playerBoughtEquipment = function(equipmentKey)
{
if(equipmentKey==='EQ_PASSENGER_BERTH'){
if(missionVariables.vector_arn==='RETRY3B'){
missionVariables.vector_arn = 'RETRY3';
this.missionOffers();
}
}
return;
}
this.missionOffers = function()
{
if(!player.ship.docked || this.hasShown || !player.ship.dockedStation.isMainStation) return;
if(!missionVariables.vector_arn){
if(missionVariables.vector_arnmeet==5 && (!missionVariables.vector_arnrepeat || parseInt(missionVariables.vector_arnrepeat)<=clock.days)){
if(player.ship.passengerCapacity && player.ship.passengerCapacity>player.ship.passengerCount){
missionVariables.vector_arnrepeat = clock.days+31;
var a = system.info.systemsInRange(7);
missionVariables.vector_arnnextvisit = a[0].name;
this.showScreen('ASKING','PASSAGE',7,1);
return;
}
} else if(missionVariables.vector_arnmeet==6 && system.name===missionVariables.vector_arnnextvisit){
player.ship.removeEquipment('EQ_VECTOR_ARNP');
mission.setInstructionsKey(null);
mission.unmarkSystem(system.ID);
missionVariables.vector_arnrepeat = null;
missionVariables.vector_arnmeet = null;
missionVariables.vector_arn = 'SCOOPED';
worldScripts.vector_pad.addToLogbook("CAH");
}
}
if(missionVariables.vector_arn==='SCOOPED'){
this.showScreen('SPECIAL','OFFERSPECIAL',6,1);
return;
}
if(missionVariables.vector_arn && missionVariables.vector_arn!=='RETRY4'){
if(missionVariables.vector_arnvisits){
this.visitlist = missionVariables.vector_arnvisits.split(" ");
if(this.visitlist[4]==galaxyNumber){
if(!system.sun.hasGoneNova && !system.sun.isGoingNova){
this.currentStage = parseInt(missionVariables.vector_arn[5]);
if(system.ID==this.visitlist[this.currentStage-1]){
switch(this.currentStage){
case 1: worldScripts.vector_pad.addToLogbook("CAK"); this.getNextVisit(null,'Linda Bevenger');
this.showScreen('VISIT1',null,1,1); this.visitors = 1; break;
case 2: worldScripts.vector_pad.addToLogbook("CAL"); this.getNextVisit(null,'Aldrin Escobar');
this.showScreen('VISIT2',null,2,1); this.visitors = 2; worldScripts.vector_pad.padInfos.areidis.codes[0] = '1'; break;
case 3: if(missionVariables.vector_arn==='RETRY3B') break;
missionVariables.vector_arnnextvisit = 'Pavel Stokitch at '+System.systemNameForID(this.visitlist[this.currentStage])+', galaxy '+(parseInt(this.visitlist[4])+1);
if(player.ship.passengerCapacity && player.ship.passengerCapacity>player.ship.passengerCount){
if(missionVariables.vector_arn==='RETRY3') this.showScreen('VISIT3A','OFFERPICKUP',3,1);
else this.showScreen('VISIT3','OFFERPICKUP',3,1);
break;
} else {
if(missionVariables.vector_arn==='RETRY3'){
this.showScreen('VISIT3C',null,3,1); worldScripts.vector_pad.addToLogbook("CAN");
} else {
this.showScreen('VISIT3B',null,3,1); worldScripts.vector_pad.addToLogbook("CAM");
}
missionVariables.vector_arn = 'RETRY3B'; break;}
case 4: if(player.ship.equipmentStatus('EQ_VECTOR_ALDRIN')==='EQUIPMENT_OK'){
this.showScreen('VISIT4','QUESTIONA',4,1); worldScripts.vector_pad.addToLogbook("CAV");}
else this.loser(); this.visitors = 3;
break;
}
} else {
if(missionVariables.vector_aldrin && system.ID==this.visitlist[3]){
if(this.logging) log(this.name,this.name+': Visit Pavel without Aldrin.');
this.loser();
}
}
}
}
}
}
return;
}
this.choiceEvaluation = function(choice)
{
if(!choice) return;
switch(choice.substr(10,40)){
case 'PASSAGEN': missionVariables.vector_arnnextvisit = null; missionVariables.vector_arnrepeat = clock.days+31; this.hasShown = true;
worldScripts.vector_pad.addToLogbook("CAD");
missionVariables.vector_arnmeet = 3;
break;
case 'PASSAGEY': mission.setInstructions("Bring Arn D'ercul to "+missionVariables.vector_arnnextvisit+".");
mission.markSystem(System.systemIDForName(missionVariables.vector_arnnextvisit));
missionVariables.vector_arnmeet = 6; player.ship.awardEquipment('EQ_VECTOR_ARNP'); this.visitors = 1; this.hasShown = true;
worldScripts.vector_pad.addToLogbook("CAG "+missionVariables.vector_arnnextvisit); break;
case 'HANDOVER': missionVariables.vector_arn = null; player.credits += 2000; this.showScreen('HANDED',null,6,1);
if(worldScripts.vector_pad.padInfos.generic.expFactor<98) worldScripts.vector_pad.padInfos.generic.expFactor += 2;
worldScripts.vector_pad.addToLogbook("CAE"); break;
case 'RESCUE': this.calculateVisits(); missionVariables.vector_arn = 'VISIT1'; mission.setInstructionsKey('VECTOR_ARNNEXTVISIT');
this.visitors = 1; this.showScreen('RESCUED',null,7,1); break;
case 'PICKUP': worldScripts.vector_pad.addToLogbook("CAQ"); this.visitors = 1;
this.getNextVisit(null,'Pavel Stokitch'); player.ship.awardEquipment('EQ_VECTOR_ALDRIN');
this.showScreen('VISIT3E',null,3,1); this.hasShown = true;
if(!missionVariables.vector_aldrin) missionVariables.vector_aldrin = 1;
if(player.ship.equipmentStatus('EQ_HEAT_SHIELD')==='EQUIPMENT_OK' && player.ship.equipmentStatus('EQ_FUEL_SCOOPS')==='EQUIPMENT_OK') mission.addMessageTextKey('VECTOR_ARNVISIT3F');
break;
case 'DENIED': this.showScreen('VISIT3D',null,3,1); this.hasShown = true; missionVariables.vector_arn = 'RETRY3';
worldScripts.vector_pad.addToLogbook("CAP"); this.visitors = 1; break;
case 'QSTART': this.showScreen('VISIT4A','QUESTIONB',4,1); this.visitors = 4; return;
case 'QDENIED': this.loser(); this.visitors = 4; break;
case 'QFA': this.loser(); this.visitors = 4; break;
case 'QFB': this.showScreen('VISIT4B','QUESTIONC',4,1); this.visitors = 4; return;
case 'QFC': this.loser(); this.visitors = 4; break;
case 'QFD': this.loser(); this.visitors = 4; break;
case 'QFE': this.showScreen('VISIT4C','QUESTIOND',4,1); this.visitors = 4; return;
case 'QFF': this.showScreen('VISIT4C','QUESTIOND',4,1); this.visitors = 4; return;
case 'QFG': this.showScreen('VISIT4C','QUESTIOND',4,1); this.visitors = 4; return;
case 'QFH': this.showScreen('VISIT4D',null,5,1); this.getNextVisit(1); player.ship.awardEquipment('EQ_VECTOR_SCOOPS');
player.ship.removeEquipment('EQ_VECTOR_ALDRIN');
if(worldScripts.vector_pad.padInfos.areidis.codes[0]) worldScripts.vector_pad.addToLogbook("CAY","CAZ");
else worldScripts.vector_pad.addToLogbook("CAZ");
return;
case 'QFI': this.loser(); this.visitors = 4; break;
default: this.hasShown = true;
}
return;
}
this.shipWillLaunchFromStation = function(station)
{
if(this.init) this.grabSettings();
this.mySound.stop();
if(this.pickItemTimer && this.pickItemTimer.isRunning) this.pickItemTimer.stop();
if(this.visitors){
system.addShips('vector_visitor',this.visitors,player.ship.position.add([0,0,9000]),2000);
worldScripts.vector_news.arnvisitor = true;
worldScripts.Cabal_Common_Music.changeStatus("vector_news",true);
this.visitors = 0;
return;
}
if(missionVariables.vector_arnmeet<5 && this.allowS && Math.random()<0.1 && system.government>4 && player.score>300 && worldScripts.vector_news.newsPointer[0]>2 && !system.countShipsWithRole('vector_arn')) station.launchShipWithRole('vector_arn');
}
this.shipLaunchedFromStation = function()
{
if(missionVariables.vector_arn==='RETRY3B') missionVariables.vector_arn = 'RETRY3';
else if(missionVariables.vector_arn==='RETRY4') missionVariables.vector_arn = 'VISIT4';
if(!player.ship.passengerCapacity || player.ship.passengerCapacity<=player.ship.passengerCount){
if(missionVariables.vector_arn==='VISIT4'){
this.visitlist = missionVariables.vector_arnvisits.split(" ");
if(this.visitlist[4]==galaxyNumber && player.ship.equipmentStatus('EQ_VECTOR_ALDRIN')==='EQUIPMENT_OK'){
worldScripts.vector_pad.addToLogbook("CAR");
this.currentStage = 2;
this.getNextVisit(null,'Aldrin Escobar');
player.ship.removeEquipment('EQ_VECTOR_ALDRIN');
missionVariables.vector_arn = 'RETRY3';
this.ov.addOv(1,'03',null,null,1);
player.commsMessage("Aldrin: Oh, man. What the heck are you trying? Believe me, if I'm not there Pavel will kill you! Or you won't find him. You can pick me up again at "+System.systemNameForID(this.visitlist[this.currentStage])+'.');
}
} else if(missionVariables.vector_arnmeet==='6'){
missionVariables.vector_arnmeet = 5;
missionVariables.vector_arnrepeat = clock.days+31;
if(player.ship.equipmentStatus('EQ_VECTOR_ARNP')==='EQUIPMENT_OK') player.ship.removeEquipment('EQ_VECTOR_ARNP');
this.ov.addOv(1,'03',null,null,1);
player.commsMessage("Arn: Hey man! That was not nice. And I really thought you'd help me.");
mission.unmarkSystem(System.systemIDForName(missionVariables.vector_arnnextvisit));
mission.setInstructionsKey(null);
}
}
if(missionVariables.vector_arn==='SCOOPED' || player.ship.equipmentStatus('EQ_VECTOR_ARNP')==='EQUIPMENT_OK'){
system.addShips('vector_visitor',1,player.ship.position.add([0,0,9000]),1000);
this.ov.addOv(null,'10',1,null,"Maybe we can sneak through.");
worldScripts.vector_news.arnvisitor = true;
worldScripts.Cabal_Common_Music.changeStatus("vector_news",true);
}
}
this.showScreen = function(text,offer,image,music)
{
var ov = "full";
if(!image) image = 0;
switch(image){
case 6: image = 'vector_arnmessage2.png'; music = 'vector_arnopener.ogg'; ov="fullmessage"; break;
case 7: image = 'vector_arnrescued.png'; music = 'vector_arnvisit.ogg'; break;
default: image = 'vector_arnvisit'+String(image)+'.png'; if(music) music = 'vector_arnvisit.ogg';
}
if(text) text = expandMissionText('VECTOR_ARN'+text);
if(!this.audio) music = null;
ov = "vector_ov"+ov+".png";
if(offer){
offer = 'VECTOR_ARN'+offer;
mission.runScreen({title:player.ship.dockedStation.displayName,message:text,background:image,overlay:ov,choicesKey:offer,music:music},this.choiceEvaluation);
} else mission.runScreen({title:player.ship.dockedStation.displayName,message:text,background:image,overlay:ov,music:music});
return;
}
this.shipWillExitWitchspace = function()
{
if(system.isInterstellarSpace) return;
if(!missionVariables.vector_arn){
if(missionVariables.vector_arnmeet==6 && player.ship.equipmentStatus('EQ_VECTOR_ARNP')==='EQUIPMENT_OK'){
system.addShips('vector_visitor',1,player.ship.position.add([0,0,5000]),2000);
worldScripts.vector_news.arnvisitor = true;
worldScripts.Cabal_Common_Music.changeStatus("vector_news",true);
} else if((clock.days&7)===this.compNews){
if(worldScripts.vector_news.startNews(0)) this.compNews ^= 3;
} else if(missionVariables.vector_arnmeet<5 && system.government>4 && player.score>300 && Math.random()<0.39 && worldScripts.vector_news.newsPointer[0]>2) system.addShipsToRoute('vector_arn',1,0.1,'wp');
} else {
if(this.recalc){
this.calculateVisits();
mission.setInstructionsKey('VECTOR_ARNNEXTVISIT');
player.commsMessage("Locating Arn D'erculs friend.",8);
this.recalc = false;
}
if(missionVariables.vector_arnvisits){
if(missionVariables.vector_aldrin) missionVariables.vector_aldrin++;
this.visitlist = missionVariables.vector_arnvisits.split(" ");
if(this.visitlist[4]==galaxyNumber){
this.currentStage = parseInt(missionVariables.vector_arn[5]);
if(system.ID==this.visitlist[this.currentStage-1]){
system.addShips('vector_visitor',this.currentStage,player.ship.position.add([0,0,5000]),2000);
worldScripts.vector_news.arnvisitor = true;
worldScripts.Cabal_Common_Music.changeStatus("vector_news",true);
if(this.currentStage>2) worldScripts.vector_pad.addToLogbook("CAO "+system.name);
if(system.sun.hasGoneNova || system.sun.isGoingNova){
this.calculateVisits();
mission.setInstructionsKey('VECTOR_ARNNEXTVISIT');
player.commsMessage("Malfunction. Recalculating location of Arn D'erculs friend.",8);
}
} else {
if(Math.random()<0.1){
system.addShips('vector_visitor',1,player.ship.position.add([0,0,8000]),2000);
worldScripts.vector_news.arnvisitor = true;
worldScripts.Cabal_Common_Music.changeStatus("vector_news",true);
} else if(player.ship.equipmentStatus('EQ_VECTOR_ALDRIN')==='EQUIPMENT_OK'){
this.ov.addOv(null,'11',1,null,"Aldrin: Ok, let's go sundiving...");
}
if((clock.days&2) && worldScripts.vector_news.startNews(1)) this.compNews ^= 3;
}
}
} else if((clock.days&7)===this.compNews){
if(worldScripts.vector_news.startNews(2)) this.compNews ^= 3;
}
}
if(this.logging) log(this.name,this.name+': N:'+worldScripts.vector_news.newsPointer+' C1:'+(clock.days&7)+' C3:'+(clock.days&7)+' C:'+this.compNews);
}
this.shipExitedWitchspace = function()
{
if(missionVariables.vector_arn==='SCOOPED' || player.ship.equipmentStatus('EQ_VECTOR_ARNP')==='EQUIPMENT_OK'){
this.ov.addOv(null,'10',1,null,"They have found us. Bring us to the station!",'vector_arn.ogg');
}
}
this.shipEnteredPlanetaryVicinity = function(planet)
{
if(!missionVariables.vector_aldrin) return;
if(this.logging) log(this.name,this.name+': Sun:'+(planet.isSun)+' aldrinCount:'+missionVariables.vector_aldrin);
if(planet.isSun && player.ship.equipmentStatus('EQ_VECTOR_ALDRIN')==='EQUIPMENT_OK'){
if(Math.random()<0.4-(parseInt(missionVariables.vector_aldrin)*0.05)){
if(this.audio){
this.mySound.loop = false;
this.mySound.sound = '[vector_peep]';
this.mySound.play();
}
if(player.ship.equipmentStatus('EQ_HEAT_SHIELD')==='EQUIPMENT_OK'){
player.commsMessage("WARNING! Heat shields malfunction. Radiation leaks in passenger berth.");
player.ship.setEquipmentStatus('EQ_HEAT_SHIELD','EQUIPMENT_DAMAGED');
} else player.commsMessage("WARNING! WARNING! Radiation leaks in passenger berth.");
player.ship.setEquipmentStatus('EQ_VECTOR_ALDRIN','EQUIPMENT_DAMAGED');
} else {
this.ov.addOv(null,'11',1,null,"Wow! What a nice corona. Refuel and bring us out of here.");
if(missionVariables.vector_aldrin<3) worldScripts.vector_pad.addToLogbook("CAU "+system.name);
}
}
}
this.playerEnteredNewGalaxy = function()
{
if(missionVariables.vector_arnnextvisit && missionVariables.vector_arnnextvisit==='in the next galaxy') this.recalc = true;
}
this.playerjumpFailed = this.playerCancelledJumpCountdown = function()
{
if(!system.isInterstellarSpace) this.recalc = false;
}
this.equipmentDamaged = this.equipmentDestroyed = function(equipmentKey)
{
if(equipmentKey==='EQ_VECTOR_ARNP'){
missionVariables.vector_arnmeet = 5;
missionVariables.vector_arnrepeat = clock.days+15;
if(player.ship.equipmentStatus('EQ_VECTOR_ARNP')==='EQUIPMENT_DAMAGED') player.ship.removeEquipment('EQ_VECTOR_ARNP');
player.commsMessage("Arn D'ercul has been injured.");
this.redo = "Arn D'ercul has been immediately transfered to hospital.";
mission.unmarkSystem(System.systemIDForName(missionVariables.vector_arnnextvisit));
mission.setInstructionsKey(null);
} else if(equipmentKey==='EQ_VECTOR_ALDRIN'){
this.ov.addOv(1,'03',null,null,1);
worldScripts.vector_pad.addToLogbook("CAT");
if(player.ship.equipmentStatus('EQ_VECTOR_ALDRIN')==='EQUIPMENT_DAMAGED') player.ship.removeEquipment('EQ_VECTOR_ALDRIN');
player.commsMessage("Aldrin Escobar has been injured, so better stay away from Pavel Stokitch.");
this.visitlist = missionVariables.vector_arnvisits.split(" ");
this.currentStage = 2;
if(this.visitlist[4]==galaxyNumber){
this.getNextVisit(null,'Aldrin Escobar');
missionVariables.vector_arn = 'RETRY3';
this.redo = "Aldrin Escobar has been immediately transfered to hospital. Pick him up again at "+System.systemNameForID(this.visitlist[this.currentStage])+".";
} else {
missionVariables.vector_arn = 'VISIT2';
this.redo = "Aldrin Escobar has been immediately transfered to hospital. Pick him up again in galaxy "+this.visitlist[4]+".";
}
}
return;
}
this.guiScreenChanged = function(to)
{
if(this.init && this.excludedScreens.indexOf(guiScreen)===-1) this.grabSettings();
if(to==='GUI_SCREEN_SYSTEM_DATA'){
if(missionVariables.vector_aldrin && this.visitlist[4]==galaxyNumber && player.ship.targetSystem==this.visitlist[3]){
mission.addMessageText("Residence of Pavel Stokitch.");
}
}
}
this.alertConditionChanged = function()
{
if(this.init) this.grabSettings();
delete this.alertConditionChanged;
}
this.shipDied = function()
{
this.mySound.stop();
}
|
Scripts/vector_news.js |
"use strict";
this.name = "vector_news";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Newsflashes -> Snoopers and Station stuff";
this.version = "1.7.1";
this.startUp = function()
{
delete this.startUp;
if(!worldScripts.Cabal_Common_Functions || typeof(worldScripts.Cabal_Common_Functions.Cabal_Common)==='undefined'){this.killSelf(" -> Cabal_Common_Library is missing."); return;}
this.helper = new worldScripts.Cabal_Common_Functions.Cabal_Common();
if(this.helper.internalVersion<14){this.killSelf(" -> Cabal_Common_Functions is too old."); return;}
var requires = ["snoopers","2.3.2"];
if(this.helper.oxpVersionTest(this.name,requires)){
this.showNews = true;
var a = this.helper.strGetCRC(player.name);
var hola = [482,493,612,711,825,914,920,1280,1349,1475];
if(hola.indexOf(a)!==-1) worldScripts.vector.andale = true;
} else {
this.showNews = false;
log(this.name,this.name+" - deactivating all specials");
}
this.objNews = [
[{Ag:1,m:"VECTOR_NEWS01",Pr:1},{m:"VECTOR_NEWS02",Pi:"snoopers_gcnewsA11.png",Mo:"vector_newsA",Po:[2.4,1.2,10],Pr:1},{Ag:2,m:"VECTOR_NEWS03",Pr:1}],
[{m:"VECTOR_NEWS11",Pi:"snoopers_gcnewsA11.png",Mo:"vector_newsA",Po:[2.4,1.2,10],Pr:1},{Ag:2,m:"VECTOR_NEWS12",Pr:1},{Ag:3,m:"VECTOR_NEWS13",Pr:1}],
[{m:"VECTOR_NEWS21",Pi:"snoopers_gcnewsA11.png",Mo:"vector_newsB",Po:[2.4,1.2,10],Pr:1},{m:"VECTOR_NEWS22",Pi:"snoopers_gcnewsA11.png",Mo:"vector_newsB",Po:[2.4,1.2,10],Pr:1},{m:"VECTOR_NEWS23",Pi:"snoopers_gcnewsA21.png",Mo:"vector_newsB",Po:[2.4,1.2,10],Pr:1}],
[{Ag:1,m:"VECTOR_NEWS41",Pr:1},{Ag:1,m:"VECTOR_NEWS42",Pr:1}]
];
if(!missionVariables.vector_newspointer) this.newsPointer = [0,0,0,0,0,0];
else this.newsPointer = missionVariables.vector_newspointer.split('|');
if((missionVariables.vector_arnvisits || missionVariables.vector_visits) && this.newsPointer[2]=="3" && this.newsPointer[1]==="0"){
this.newsPointer[2] = 0;
missionVariables.TL_FOR_EQ_VECTOR_SCOOPS = null;
if(player.ship.equipmentStatus('EQ_VECTOR_SCOOPS')==='EQUIPMENT_OK'){
player.ship.removeEquipment('EQ_VECTOR_SCOOPS');
player.credits += 1700;
}
}
if(this.newsPointer[1]==3 && missionVariables.vector_arn && missionVariables.vector_arn==='UNLIMITED' && !missionVariables.TL_FOR_EQ_VECTOR_SCOOPS) this.changeEQ(1);
this.secondaryInfos = {
specialist: {
goods:{
standard:[],
illegal:[
{item:"Dephrac Crystals",galaxy:[5],buyID:[180],sellID:[76],stationID:[["main"],["vector_specialist"]],cb:this.name,cbb:"specialCargo",avail:0,priceclass:60,offset:1.5,refresh:0.4,decrease:0.1,times:clock.days-10,oneShot:true,legal:false,desc:"Dephrac Crystals are prohibited in most systems, because of their structural instability. Logistic companies will need a special license to transport them."}
],
sealing:[],
contract:[]
},
state: {
trade:[],
stage:0
},
scenes: [
{w:"vector_news",f:"sceneA",p:1,s:5,t:"The Specialst - Building"}
]
}
};
if(missionVariables.vector_specialist) this.secondaryInfos.specialist.state = JSON.parse(missionVariables.vector_specialist);
this.arnvisitor = false;
this.logging = false;
this.hasShown = false;
this.cleanMVs();
this.delTimer = new Timer(this,this.delayed,1);
delete this.killSelf;
}
this.delayed = function()
{
for(let prop in this.secondaryInfos){
// Reimplement cutscenes
if(this.secondaryInfos[prop].hasOwnProperty("scenes")){
for(let i=0;i<this.secondaryInfos[prop].scenes.length;i++){
if(this.secondaryInfos[prop].scenes[i].s<this.secondaryInfos[prop].state.stage) worldScripts.vector_pad.padInfos.replay.push(this.secondaryInfos[prop].scenes[i]);
}
}
// Reimplement markets
if(this.secondaryInfos[prop].hasOwnProperty("state")){
if(this.secondaryInfos[prop].state.hasOwnProperty("trade")){
if(this.secondaryInfos[prop].state.trade.length){
let w = this.secondaryInfos[prop].state.trade[0];
this.setMarketStats(w[0],w[1],w[2],w[3]);
}
}
}
}
// CCL_Music
this.ccl_handlers = worldScripts.Cabal_Common_Music.requestHandlerSet;
this.ccl_music = [
{fadeQ:1,ent:"vector_specialist",dist:25000,music:"vector_areidis.ogg"},
{prop:"arnvisitor",fadeQ:1,ent:"Headhunter",dist:25000,music:"vector_areidis.ogg"}
];
this.startMusicSet([0x070100,0x070101],false);
this.delTimer.stop();
delete this.delTimer;
return;
}
this.playerWillSaveGame = function()
{
missionVariables.vector_specialist = JSON.stringify(this.secondaryInfos.specialist.state);
missionVariables.vector_newspointer = this.newsPointer.join('|');
this.saved = true;
}
this.cleanMVs = function()
{
missionVariables.vector_specialist = null;
missionVariables.vector_newspointer = null;
delete this.saved;
return;
}
this.killSelf = function(desc)
{
if(desc!==1){
player.consoleMessage(this.name+" - Check your Latest.log.",10);
log(this.name,this.name+" - Shutting down."+desc);
}
this.showNews = false;
delete this.shipWillExitWitchspace;
delete this.shipWillLaunchFromStation;
delete this.performCheck;
delete this.guiScreenChanged;
delete this.alertConditionChanged;
delete this.prepare;
return;
}
/* Usage: worldScripts.vector_news.startNews(type); */
this.startNews = function(type,specifier)
{
if(!missionVariables.TL_FOR_EQ_VECTOR_PAD) return(false);
if(!this.showNews){
if(type===2 && this.newsPointer[2]>2) this.changeEQ(1);
return(false);
}
if(type===3) this.newsPointer[type] = specifier;
if(this.objNews[type].length<=this.newsPointer[type]) return(false);
var m = "",ID = "",Ag = null,Pr = null,Pi = null,Mu = null,Mo = null,Po = null;
m = expandMissionText(this.objNews[type][this.newsPointer[type]].m);
if(this.objNews[type][this.newsPointer[type]].Ag) Ag = this.objNews[type][this.newsPointer[type]].Ag;
if(this.objNews[type][this.newsPointer[type]].Pi) Pi = this.objNews[type][this.newsPointer[type]].Pi;
if(this.objNews[type][this.newsPointer[type]].Mo) Mo = this.objNews[type][this.newsPointer[type]].Mo;
if(this.objNews[type][this.newsPointer[type]].Po) Po = this.objNews[type][this.newsPointer[type]].Po;
if(this.objNews[type][this.newsPointer[type]].Pr) Pr = this.objNews[type][this.newsPointer[type]].Pr;
var obj = new Object({ID:this.name,Agency:Ag,Priority:Pr,Message:m,Pic:Pi,Music:Mu,Model:Mo,Pos:Po});
var a = worldScripts.snoopers.insertNews(obj);
if(!a){
++this.newsPointer[type];
return(true);
} else return(false);
}
this.newsDisplayed = function(which)
{
if(!worldScripts.vector_missionArn.grabSettings && !worldScripts.vector_missionArn.deactivated) return;
switch(which){
case "A MURDER investigati":
worldScripts.vector_pad.padInfos.phones.current |= 1;
worldScripts.vector_pad.addToLogbook("CAA","AAE"); break;
case "Conspiracy or strang": worldScripts.vector_pad.addToLogbook("CAB"); break;
case "We're trying to conf": worldScripts.vector_pad.addToLogbook("CAJ"); break;
case "USQUEN -- On an open": worldScripts.vector_pad.addToLogbook("BAG"); this.changeEQ(1); break;
}
return;
}
this.changeEQ = function(mode)
{
switch(mode){
case 1: if(!missionVariables.TL_FOR_EQ_VECTOR_SCOOPS) EquipmentInfo.infoForKey('EQ_VECTOR_SCOOPS').effectiveTechLevel = 9; break;
}
return;
}
this.shipWillExitWitchspace = function()
{
this.placeSpecials();
}
this.shipWillLaunchFromStation = this.alertConditionChanged = function(w)
{
if(this.saved) this.cleanMVs();
if(w && w.isValid) this.placeSpecials();
}
this.shipLaunchedFromStation = function()
{
this.hasShown = false;
}
this.guiScreenChanged = function(w)
{
if(!player.ship.isValid || player.ship.docked) return;
if(this.saved) this.cleanMVs();
}
this.shipWillDockWithStation = function(station)
{
this.killOVs();
if(!player.ship.isValid || !station) return;
this.checkers = [];
switch(station.name){
case "vector_specialist":
var a = station.script.granted;
var b = station.subEntities[3].energy;
this.checkers = [a,b];
if(b>1){
var s = new SoundSource;
s.sound = "cabal_common_bang.ogg";
s.play();
}
break;
}
}
this.shipWillEnterWitchspace = function()
{
this.killOVs();
this.arnvisitor = false;
this.changeMusicStatus(false);
}
this.killOVs = function()
{
// Removing is necessary to avoid CTD
var t = system.shipsWithRole("vector_ov");
while(t.length){
t[0].script.getRid(1,1);
t.shift();
}
missionVariables.vector_cslot = null;
missionVariables.vector_islot = null;
return;
}
this.placeSpecials = function()
{
var iss = false,nov = false,what,where,ori=false,boo=0;
if(worldScripts.Cabal_Common_OXPStrength) boo = worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkPower(player.ship);
if(system.isInterstellarSpace) iss = true;
else if(system.sun.isGoingNova || system.sun.hasGoneNova) nov = true;
switch(galaxyNumber){
case 5:
if(!iss && !nov){
switch(system.ID){
case 3:
what = "vector_areidisAlpha";
where = new Vector3D([0.5,-0.5,-0.3]).fromCoordinateSystem("wsu");
ori = system.sun;
break;
case 76:
if(boo && boo<350){
what = "vector_specialist";
where = system.sun.position.add([system.sun.radius*2,0,0]);
this.changeMusicStatus(true);
}
break;
case 84:
what = "vector_areidisDelta";
where = new Vector3D([0.5,-0.5,-0.3]).fromCoordinateSystem("wsu");
ori = system.sun;
break;
case 88:
what = "vector_areidisEpsilon";
where = new Vector3D([0.5,-0.5,-0.3]).fromCoordinateSystem("wsu");
ori = system.sun;
break;
case 184:
what = "vector_areidisGamma";
where = new Vector3D([0.5,-0.5,-0.3]).fromCoordinateSystem("wsu");
ori = system.sun;
break;
case 196:
what = "vector_areidisBeta";
where = new Vector3D([0.5,-0.5,-0.3]).fromCoordinateSystem("wsu");
ori = system.sun;
break;
}
}
break;
}
if(what){
let a;
if(system.countShipsWithRole(what)) return;
if(where) a = system.addShips(what,1,where,10000);
else a = system.addShips(what,1,player.ship.position,10000);
if(a && a.isValid && ori) this.helper.entFaceEntity(a[0],ori);
} else {
this.changeMusicStatus(false);
}
return;
}
this.setMarketStats = function(who,typ,n,times)
{
var d = this.secondaryInfos[who].goods[typ][n];
d.times = times;
if(worldScripts.Cabal_Common_SpecialMarkets.registerLocation(d)){
this.secondaryInfos[who].state.trade.push([who,typ,n,times]);
return(true);
}
return(false);
}
this.missionScreenOpportunity = function()
{
if(!player.ship.isValid || !player.ship.docked || this.hasShown) return;
switch(player.ship.dockedStation.name){
case "vector_specialist":
var a = player.ship.dockedStation.script.granted;
var b = player.ship.dockedStation.subEntities[3].energy;
if(this.checkers[0]){
if(this.checkers[1]>1) this.showScreen(1,null,"[VECTOR_SPECIALIST_AA]","VECTOR_SPECIALIST_A","vector_specialist.png","vector_ovfull.png","vector_intermezzo.ogg");
else {
switch(this.secondaryInfos.specialist.state.stage){
case 0: this.showScreen(1,null,"[VECTOR_SPECIALIST_AB]",null,"vector_specialist.png","vector_ovfull.png","vector_opener.ogg"); break;
case 1: this.showScreen(1,null,"[VECTOR_SPECIALIST_AC]","VECTOR_SPECIALIST_C","vector_specialist.png","vector_ovfull.png","vector_opener.ogg");
worldScripts.vector_pad.addToLogbook("EAB "+system.name,"EAC"); break;
case 3: this.showScreen(1,null,"[VECTOR_SPECIALIST_AE]",null,"vector_specialist.png","vector_ovfull.png","vector_opener.ogg");
this.secondaryInfos.specialist.state.stage = 4; player.ship.dockedStation.spawnOne("vector_specialistmark");
player.credits += 1000; player.ship.fuel = 7; break;
case 4: this.sceneA(); this.secondaryInfos.specialist.state.stage = 6; this.hasShown = true;
worldScripts.vector_pad.padInfos.replay.push(this.secondaryInfos.specialist.scenes[0]);
worldScripts.vector_pad.addToLogbook("EAD");
break;
}
}
} else {
if(this.checkers[1]>1){
player.ship.energy /= this.checkers[1];
player.ship.forwardShield /= this.checkers[1];
player.ship.aftShield /= this.checkers[1];
}
if(player.ship.dockedStation.script.psa) this.showScreen(1,null,"[VECTOR_ARNVISIT4NA]","VECTOR_SPECIALIST_A","vector_specialist.png","vector_ovfull.png","vector_caught.ogg");
else this.showScreen(1,null,"[VECTOR_SPECIALIST_AA]","VECTOR_SPECIALIST_A","vector_specialist.png","vector_ovfull.png","vector_intermezzo.ogg");
}
break;
}
}
this.showScreen = function(sho,tit,tex,chc,pic,ov,mus,mod)
{
if(sho) this.hasShown = true;
var spin = false;
if(!tit) tit = player.ship.dockedStation.displayName;
if(tex && tex[0]==="["){
tex = tex.substr(1,tex.length-2);
tex = expandMissionText(tex);
}
if(chc) mission.runScreen({title:tit,message:tex,choicesKey:chc,background:pic,overlay:ov,model:mod,spinModel:spin,music:mus},this.choiceEval);
else mission.runScreen({title:tit,message:tex,background:pic,overlay:ov,model:mod,music:mus});
}
this.choiceEval = function(choice){worldScripts.vector_news.choiceEvaluation(choice); return;}
this.choiceEvaluation = function(choice)
{
switch(choice){
case "VECTOR_SPECIALIST_EXIT":
player.ship.launch();
break;
case "VECTOR_SPECIALIST_ACCEPT":
this.secondaryInfos.specialist.state.stage = 2;
worldScripts.vector_pad.addToLogbook("BAH Intisoar");
this.showScreen(1,null,"[VECTOR_SPECIALIST_AD]",null,"vector_specialist.png","vector_ovfull.png","vector_opener.ogg");
this.setMarketStats("specialist","illegal",0,clock.days-10);
break;
}
return;
}
this.sceneA = function(n)
{
var objA = {
role:"vector_buildUpA",
getOri:"vector_buildO",
getPos:"vector_buildP",
prepareProps:{energy:0,fuel:0},
briefing:[
[0,"mes","\f\f\f\fNow I'll show you something."],
[9,"mes","\f\f\f\fMatrix generator enabled."],
[10,"prop",[0,-1,"energy",130,0,0,0]],
[11,"prop",[0,-1,"energy",0.02,60,0,40]],
[50,"mes","\f\f\f\fCalculating hull."],
[150,"mes","\f\f\f\fEstablishing welding and plating."],
[230,"prop",[0,-1,"lightsActive",true,0,0,0],null],
[250,"mes","\f\f\f\fReady for a testride."],
[251,"mVelo",[0,-1,2,1.003,0,0,1,0.85,0.85],null,"ccl_briefing_enginestart.ogg"],
[260,"prop",[0,0,"energy",7,5,1,0]],
[270,"mSpeed",[0,-1,6,370,0,4,0]],
[285,"prop",[0,-1,"energy",-2,10,0,0]],
[286,"prop",[0,0,"energy",0,0,0,0]],
[300,"stopVelo",[0,-1]],
[301,0]
],
title:"The Specialist - Building",
background:"vector_buildUpA.png",
callback:this.name,
callbackf:"choiceEval",
music:"vector_cubesm.ogg"
};
worldScripts.Cabal_Common_Briefing.startBriefing(objA);
return;
}
this.specialCargo = function(what,amount){worldScripts.vector_news.specialCargoEval(what,amount); return;}
this.specialCargoEval = function(what,amount)
{
var c = false;
switch(what){
case "Dephrac Crystals":
this.secondaryInfos.specialist.state.stage = 3;
this.secondaryInfos.specialist.state.trade = [];
c=true;
break;
}
return(c);
}
this.startMusicSet = function(arr,ini)
{
var eventMusic = {who:this.name,start:ini};
for(let i=0;i<arr.length;i++){
let a = (arr[i]&0xFF0000)>>16,b = (arr[i]&0xFF00)>>8,c = arr[i]&0xFF;
if(!eventMusic.hasOwnProperty(this.ccl_handlers[a][0])) eventMusic[ccl_handlers[a][0]] = {};
if(!eventMusic[this.ccl_handlers[a][0]].hasOwnProperty(this.ccl_handlers[a][b])) eventMusic[this.ccl_handlers[a][0]][this.ccl_handlers[a][b]] = [];
eventMusic[this.ccl_handlers[a][0]][this.ccl_handlers[a][b]].push(this.ccl_music[c]);
}
worldScripts.Cabal_Common_Music.addMedia(eventMusic);
return;
}
this.changeMusicStatus = function(stat)
{
worldScripts.Cabal_Common_Music.changeStatus(this.name,stat);
return;
}
this.removeMusic = function()
{
worldScripts.Cabal_Common_Music.removeMedia(this.name);
return;
}
this.VectorOV = function(){}
VectorOV.prototype = {
addOv: function(s,which,always,slot,simple,sounds){
if(always || missionVariables.TL_FOR_EQ_VECTOR_PAD){
var a = 'vector_ov'+which;
if(!system.countShipsWithRole(a)){
let vu = player.ship.vectorUp.multiply(300.0);
let pos = player.ship.position.add(player.ship.vectorForward.multiply(300)).subtract(vu);
var shw = system.addShips(a,1,pos,1000)[0];
} else var shw = system.shipsWithRole(a)[0];
if(s) shw.script.passPods(slot,simple);
else {
if(sounds) shw.script.speakUp(slot,simple,sounds);
else shw.script.speakUp(slot,simple);
}
}
return;
},
offPosition: function(){
var moveOutPos;
if(system.isInterstellarSpace || !system.sun || system.sun.isGoingNova || system.sun.hasGoneNova) moveOutPos = new Vector3D([100000,74580,0]);
else moveOutPos = system.sun.position;
var pos = moveOutPos.multiply(20).add([1000,0,0]);
return(pos);
},
addCharacterOVOff: function(which){
var a = 'vector_ov'+which;
if(!system.countShipsWithRole(a)){
var shw = system.addShips(a,1,this.offPosition(),1000)[0];
shw.script.addSilent();
}
return;
}
};
|
Scripts/vector_ovc.js |
"use strict";
this.name = "vector_ovc";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Overlays Characters";
this.version = "1.7.1";
this.shipSpawned = function()
{
this.getSlot();
this.cycle = parseInt(this.ship.scriptInfo.vector_ovcycle);
this.getPos();
if(!this.reposTimer) this.reposTimer = new Timer(this,this.repositionIt,0,3.81);
delete this.shipSpawned;
}
this.repositionIt = function()
{
if(!player.ship.isValid || player.ship.docked){this.getRid(1,1); return;}
if(!this.cycle){
this.ship.position = this.moveOutPos.add([1000+this.ship.fuel,0,0]);
this.getRid();
return;
}
let a = player.ship.vectorForward.multiply(400.0*(this.ship.fuel+1)),b = player.ship.vectorUp.multiply(200.0*(this.ship.fuel+1));
this.ship.position = player.ship.position.subtract(a).subtract(b);
this.ship.orientation = player.ship.orientation;
if(this.cycle>0) this.cycle--;
if(this.displayMessage){
var mySound = new SoundSource;
if(this.displaySound) mySound.sound = this.displaySound;
else mySound.sound = '[vector_peep]';
mySound.play();
if(typeof(this.displayMessage)==='string') this.ship.commsMessage(this.displayMessage);
else this.displayMessage.ent.commsMessage(this.displayMessage.message);
delete this.displayMessage;
}
return;
}
this.getRid = function(way,all)
{
if(this.reposTimer) this.reposTimer.stop();
missionVariables.vector_cslot &= 0xffff-Math.pow(2,this.ship.fuel);
if(way) this.ship.remove(true);
if(all) missionVariables.vector_cslot = null;
else if(missionVariables.vector_cslot==="0") missionVariables.vector_cslot = null;
return;
}
this.shipRemoved = function(suppressDeathEvent)
{
delete this.shipDied;
return;
}
this.shipDied = this.shipWillEnterWitchspace = function()
{
this.getRid();
return;
}
this.speakUp = function(slot,message,audio)
{
if(!slot && (!this.reposTimer || !this.reposTimer.isRunning)) this.getSlot();
this.cycle = parseInt(this.ship.scriptInfo.vector_ovcycle);
if(!this.moveOutPos) this.getPos();
if(!this.reposTimer) this.reposTimer = new Timer(this,this.repositionIt,0,3.81);
else {
if(!this.reposTimer.isRunning){
this.reposTimer.nextTime = clock.absoluteSeconds+1;
this.reposTimer.start();
}
}
if(message) this.displayMessage = message;
if(audio) this.displaySound = audio;
delete this.shipSpawned;
return;
}
this.addSilent = function()
{
delete this.shipSpawned;
this.cycle = 0;
this.getPos();
if(this.reposTimer) this.reposTimer.stop();
return;
}
this.getSlot = function()
{
if(missionVariables.vector_cslot===null) missionVariables.vector_cslot = 0;
var a = parseInt(missionVariables.vector_cslot);
for(var i=0;i<8;i++){
var o = Math.pow(2,i);
if(!(a&o)){
this.ship.fuel = i;
missionVariables.vector_cslot |= o;
break;
}
}
return;
}
this.getPos = function()
{
if(system.isInterstellarSpace || !system.sun || system.sun.isGoingNova || system.sun.hasGoneNova) this.moveOutPos = new Vector3D([100000,66640,0]);
else this.moveOutPos = system.sun.position;
this.moveOutPos = this.moveOutPos.multiply(20);
return;
} |
Scripts/vector_ovi.js |
"use strict";
this.name = "vector_ovi";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Overlays Instruments and Special Point Markers";
this.version = "1.7.1";
this.shipSpawned = function()
{
this.getSlot();
this.cycle = parseInt(this.ship.scriptInfo.vector_ovcycle);
if(this.ship.primaryRole==='vector_ov02') this.passPods(1);
this.getMoveOutPos();
if(!this.reposTimer) this.reposTimer = new Timer(this,this.repositionIt,0,3.81);
delete this.shipSpawned;
}
this.getMoveOutPos = function()
{
if(system.isInterstellarSpace || !system.sun || system.sun.isGoingNova || system.sun.hasGoneNova) this.moveOutPos = new Vector3D([100000,55550,0]);
else this.moveOutPos = system.sun.position;
this.moveOutPos = this.moveOutPos.multiply(20);
return;
}
this.repositionIt = function()
{
if(!player.ship.isValid || player.ship.docked){this.getRid(1,1); return;}
if(!this.cycle){
this.ship.position = this.moveOutPos.add([1000+this.ship.fuel,0,0]);
this.getRid();
return;
}
let a = player.ship.vectorForward.multiply(200.0*(this.ship.fuel+1)),b = player.ship.vectorUp.multiply(400.0*(this.ship.fuel+1));
this.ship.position = player.ship.position.subtract(a).subtract(b);
this.ship.orientation = player.ship.orientation;
if(this.cycle>0) this.cycle--;
return;
}
this.getRid = function(way,all)
{
if(this.reposTimer) this.reposTimer.stop();
missionVariables.vector_islot &= 0xffff-Math.pow(2,this.ship.fuel);
if(way) this.ship.remove(true);
if(all) missionVariables.vector_islot = null;
else if(missionVariables.vector_islot==="0") missionVariables.vector_islot = null;
return;
}
this.shipRemoved = function(suppressDeathEvent)
{
delete this.shipDied;
return;
}
this.shipDied = this.shipWillEnterWitchspace = function()
{
this.getRid();
return;
}
this.passPods = function(slot,simple)
{
if(!slot && (!this.reposTimer || !this.reposTimer.isRunning)) this.getSlot();
if(!simple){
var d=0,c = worldScripts.vector_pad.padInfos.generic.cpods,e = worldScripts.vector_pad.padInfos.generic.epods;
if(c) d = Math.pow(2,c)-1;
if(e) for(let i=0;i<e;i++){d += Math.pow(2,i+5);}
this.ship.energy = 100+d;
player.consoleMessage("Cargo:"+c+" Pods:"+e);
}
this.cycle = parseInt(this.ship.scriptInfo.vector_ovcycle);
if(!this.moveOutPos) this.getMoveOutPos();
if(!this.reposTimer) this.reposTimer = new Timer(this,this.repositionIt,0,3.81);
else {
if(!this.reposTimer.isRunning){
this.reposTimer.nextTime = clock.absoluteSeconds+1;
this.reposTimer.start();
}
}
delete this.shipSpawned;
return;
}
this.getSlot = function()
{
if(missionVariables.vector_islot===null) missionVariables.vector_islot = 0;
var a = parseInt(missionVariables.vector_islot);
for(var i=0;i<8;i++){
var o = Math.pow(2,i);
if(!(a&o)){
this.ship.fuel = i;
missionVariables.vector_islot = a+o;
break;
}
}
return;
}
// Later on I'll move it into a multiEQ script
this.activated = function(equipmentKey)
{
switch(this.equipmentKey){
case "EQ_VECTOR_SPACELANE":
if(!system.countShipsWithRole('vector_ov01')) var a = system.addShips('vector_ov01',1,player.ship.position.add([5000,0,-500]))[0];
else {
var a = system.shipsWithRole('vector_ov01')[0];
a.script.cycle = 0;
}
break;
case "EQ_VECTOR_SCOOPS":
if(!system.countShipsWithRole('vector_ov02')) var a = system.addShips('vector_ov02',1,player.ship.position.add([5000,0,-500]))[0];
else {
var a = system.shipsWithRole('vector_ov02')[0];
a.script.passPods();
}
break;
}
}
|
Scripts/vector_pad.js |
"use strict";
this.name = "vector_pad";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "PAD";
this.version = "1.7.2";
this.startUp = function()
{
delete this.startUp;
if(missionVariables.TL_FOR_EQ_VECTOR_PAD) delete this.shipExitedWitchspace;
else this.showBenus = false;
if(!worldScripts.Cabal_Common_Functions || typeof(worldScripts.Cabal_Common_Functions.Cabal_Common)==='undefined'){this.killSelf(" -> Cabal_Common_Library is missing."); return;}
this.helper = new worldScripts.Cabal_Common_Functions.Cabal_Common();
if(this.helper.internalVersion<14){this.killSelf(" -> Cabal_Common_Functions is too old."); return;}
delete this.killSelf;
this.core = [];
this.compEnts = [];
this.actOnEnts = 55;
this.seenArn = false;
this.padSound = new SoundSource;
function fib(){var i=0,j=1; while(true){yield i;[i,j] = [j,i+j];}}
var g = fib(); for(let i=0;i<50;i++){let a = g.next(); if(i>40) this.core.push(a);}
this.padInfos = {
areidis:{
materials: [
{"vector_modelview.png":{fragment_shader:"vector_ovcode.fragment",vertex_shader:"vector_ov.vertex",textures:["vector_modelview.png",{name:"vector_codes.png",repeat_s:"yes",min_filter:"linear"}],uniforms:{tex0:{type:"texture",value:0},tex1:{type:"texture",value:1},uDisplay:{type:"int",value:0},uFuel:"fuel",uTime:"timeElapsedSinceSpawn",uDestination:{type:"vector",value:"0.56 -0.62 1.0 1.0"},uVRA:{type:"vector",value:"4.0 1.0 4.0 1.0"},uVWA:{type:"vector",value:"0.0 0.0 3.0 1.0"},uVRB:{type:"vector",value:"1.0 5.0 0.0 1.0"},uVWB:{type:"vector",value:"0.0 6.0 1.0 1.0"},uVRC:{type:"vector",value:"3.0 0.0 2.0 1.0"},uVWC:{type:"vector",value:"3.0 5.0 6.0 1.0"}}}},
{"vector_modelview.png":{fragment_shader:"vector_ovcode.fragment",vertex_shader:"vector_ov.vertex",textures:["vector_modelview.png",{name:"vector_codes.png",repeat_s:"yes",min_filter:"linear"}],uniforms:{tex0:{type:"texture",value:0},tex1:{type:"texture",value:1},uDisplay:{type:"int",value:0},uFuel:"fuel",uTime:"timeElapsedSinceSpawn",uDestination:{type:"vector",value:"0.56 -0.62 1.0 1.0"},uVRA:{type:"vector",value:"2.0 4.0 1.0 1.0"},uVWA:{type:"vector",value:"5.0 0.0 6.0 1.0"},uVRB:{type:"vector",value:"0.0 3.0 4.0 1.0"},uVWB:{type:"vector",value:"0.0 3.0 1.0 1.0"},uVRC:{type:"vector",value:"5.0 4.0 1.0 1.0"},uVWC:{type:"vector",value:"3.0 2.0 5.0 1.0"}}}},
{"vector_modelview.png":{fragment_shader:"vector_ovcode.fragment",vertex_shader:"vector_ov.vertex",textures:["vector_modelview.png",{name:"vector_codes.png",repeat_s:"yes",min_filter:"linear"}],uniforms:{tex0:{type:"texture",value:0},tex1:{type:"texture",value:1},uDisplay:{type:"int",value:0},uFuel:"fuel",uTime:"timeElapsedSinceSpawn",uDestination:{type:"vector",value:"0.56 -0.62 1.0 1.0"},uVRA:{type:"vector",value:"5.0 4.0 3.0 1.0"},uVWA:{type:"vector",value:"0.0 2.0 3.0 1.0"},uVRB:{type:"vector",value:"4.0 0.0 2.0 1.0"},uVWB:{type:"vector",value:"0.0 7.0 3.0 1.0"},uVRC:{type:"vector",value:"1.0 1.0 5.0 1.0"},uVWC:{type:"vector",value:"5.0 6.0 3.0 1.0"}}}},
{"vector_modelview.png":{fragment_shader:"vector_ovcode.fragment",vertex_shader:"vector_ov.vertex",textures:["vector_modelview.png",{name:"vector_codes.png",repeat_s:"yes",min_filter:"linear"}],uniforms:{tex0:{type:"texture",value:0},tex1:{type:"texture",value:1},uDisplay:{type:"int",value:0},uFuel:"fuel",uTime:"timeElapsedSinceSpawn",uDestination:{type:"vector",value:"0.56 -0.62 1.0 1.0"},uVRA:{type:"vector",value:"4.0 5.0 1.0 1.0"},uVWA:{type:"vector",value:"6.0 3.0 6.0 1.0"},uVRB:{type:"vector",value:"3.0 2.0 1.0 1.0"},uVWB:{type:"vector",value:"6.0 5.0 0.0 1.0"},uVRC:{type:"vector",value:"4.0 0.0 5.0 1.0"},uVWC:{type:"vector",value:"6.0 6.0 0.0 1.0"}}}},
{"vector_modelview.png":{fragment_shader:"vector_ovcode.fragment",vertex_shader:"vector_ov.vertex",textures:["vector_modelview.png",{name:"vector_codes.png",repeat_s:"yes",min_filter:"linear"}],uniforms:{tex0:{type:"texture",value:0},tex1:{type:"texture",value:1},uDisplay:{type:"int",value:0},uFuel:"fuel",uTime:"timeElapsedSinceSpawn",uDestination:{type:"vector",value:"0.56 -0.62 1.0 1.0"},uVRA:{type:"vector",value:"2.0 2.0 0.0 1.0"},uVWA:{type:"vector",value:"0.0 5.0 4.0 1.0"},uVRB:{type:"vector",value:"1.0 3.0 5.0 1.0"},uVWB:{type:"vector",value:"6.0 3.0 0.0 1.0"},uVRC:{type:"vector",value:"5.0 3.0 4.0 1.0"},uVWC:{type:"vector",value:"3.0 0.0 0.0 1.0"}}}}
],
cubic: [3440,4415,4611,5240,7846],
code: "VECTOR_CODEHINTS",
hints: [
{hint:"VECTOR_CODEHINTAA",fib:0},
{hint:"VECTOR_CODEHINTAA",fib:0},
{hint:"VECTOR_CODEHINTAA",fib:0},
{hint:"VECTOR_CODEHINTAA",fib:0},
{hint:"VECTOR_CODEHINTAA",fib:0},
],
names: ['Alpha','Beta','Gamma','Delta','Epsilon'],
locations:[3,196,184,84,88],
codes:[0,0,0,0,0,0],
pwd:["VECTOR_AREIDIS_CA","VECTOR_AREIDIS_CB","VECTOR_AREIDIS_CC","VECTOR_AREIDIS_CD","VECTOR_AREIDIS_CE",""],
messages:["VECTOR_AREIDIS_MA","VECTOR_AREIDIS_MB","VECTOR_AREIDIS_MC","VECTOR_AREIDIS_MD","VECTOR_AREIDIS_ME",""],
display:{
who:["Linda Bevenger","","","","",""],
where:["Unknown","Unknown","Unknown","Unknown","Unknown","Unknown"]
}
},
ranks: {
names: ["Inofficial","GCI Private Second Class","GCI Private First Class","GCI Sergeant","GCI Lieutenant","GCI Captain","None"]
},
medals: {
names: ["Confed Blue Belt Medal","Confed Medal of Services","Confed Medal of Honour","Confed Cross Medal","Confed White Star Medal","Confed Defender of Freedom Medal"],
energy: [101,103,107,115,131,163]
},
phones: {
code: "VECTOR_NUMBERS",
who:[
{link:"VECTOR_NUMBERAA",fib:0},
{link:"VECTOR_NUMBERAB",fib:0},
{link:"VECTOR_NUMBERAC",fib:0},
{link:"VECTOR_NUMBERAD",fib:0},
{link:"VECTOR_NUMBERAE",fib:0},
{link:"VECTOR_NUMBERAF",fib:0}
],
current:0
},
linkUp: {
code: "VECTOR_ARNHINTS",
dialOK: "vector_phoneA.ogg",
dialNO: "vector_phoneB.ogg",
who:[
{tov:"vector_ov09.png",tme:["VECTOR_ARNHINTAA","VECTOR_ARNHINTAB"],fib:0},
{tov:"vector_ov14.png",tme:["VECTOR_ARNHINTBA"],fib:0},
{tov:"vector_ov13.png",tme:["VECTOR_ARNHINTCA"],fib:0},
{tov:"vector_ov01.png",tme:["VECTOR_ARNHINTDA"],fib:0},
{tov:"vector_ov01.png",tme:["VECTOR_ARNHINTEA"],fib:0},
{tov:"vector_ov10.png",tme:["VECTOR_ARNHINTFA"],fib:0}
]
},
replay:[],
logExtensions:[],
generic: {
cpod:[],
cpods:0,
epod:[],
epods:0,
expFactor:1,
passengerState:0,
superman:0
}
};
if(!missionVariables.vector_logbook) this.logbook = ["AAA"];
else this.logbook = missionVariables.vector_logbook.split('|');
if(missionVariables.vector_codes) this.padInfos.areidis.codes = missionVariables.vector_codes.split('|');
if(missionVariables.vector_areidis) this.padInfos.areidis.display = JSON.parse(missionVariables.vector_areidis);
if(missionVariables.vector_generic) this.padInfos.generic = JSON.parse(missionVariables.vector_generic);
if(missionVariables.vector_expFactor) this.padInfos.generic.expFactor = parseInt(missionVariables.vector_expFactor);
if(missionVariables.vector_phone) this.padInfos.phones.current = parseInt(missionVariables.vector_phone);
if(!this.padInfos.generic.hasOwnProperty("superman")) this.padInfos.generic.superman = 0;
this.cleanMVs();
}
this.playerWillSaveGame = function()
{
missionVariables.vector_codes = this.padInfos.areidis.codes.join('|');
missionVariables.vector_areidis = JSON.stringify(this.padInfos.areidis.display);
missionVariables.vector_generic = JSON.stringify(this.padInfos.generic);
missionVariables.vector_phone = this.padInfos.phones.current;
missionVariables.vector_logbook = this.logbook.join('|');
this.mvClean = true;
}
this.guiScreenChanged = function()
{
if(player.ship.docked && this.mvClean){
this.cleanMVs();
delete this.mvClean;
}
}
this.cleanMVs = function()
{
missionVariables.vector_areidis = null;
missionVariables.vector_codes = null;
missionVariables.vector_expFactor = null;
missionVariables.vector_generic = null;
missionVariables.vector_logbook = null;
missionVariables.vector_phone = null;
return;
}
this.killSelf = function(desc)
{
if(desc!==1){
player.consoleMessage(this.name+" - Check your Latest.log.",10);
log(this.name,this.name+" - Shutting down."+desc);
}
var leave = ['name','version','startPad','addToLogbook','clearLogbook','logbook','playerBoughtEquipment','oolite_manifest_identifier'];
for(prop in this){if(leave.indexOf(prop)===-1) delete this[prop];}
this.deactivated = true;
return;
}
this.playerBoughtEquipment = function(equipmentKey)
{
if(equipmentKey==='EQ_VECTOR_PAD'){
player.ship.removeEquipment('EQ_VECTOR_PAD');
if(!this.deactivated) this.startPAD();
else player.consoleMessage("Nope. Still no Cabal_Common_Library.");
}
return;
}
this.startPAD = function(direct)
{
if(this.deactivated || !player.ship.docked || !missionVariables.TL_FOR_EQ_VECTOR_PAD) return;
this.pad = {logPages:12,logScreen:0,comms:[],cb:0,codePages:0,codeScreen:1,scenePage:0,sceneCur:0};
if(direct){
switch(direct){
case 'codes': delete this.currentCodes; this.showCodes(); break;
}
}
this.showOverview();
return;
}
this.showOverview = function()
{
var sel = 0,chc = "";
if(this.padInfos.phones.current) sel |= 1;
if(this.padInfos.areidis.codes[0]) sel |= 2;
if(this.padInfos.replay.length) sel |= 4;
if(!sel) chc = 'VECTOR_PADOVERVIEWA';
else {
if(sel===1) chc = 'VECTOR_PADOVERVIEWB';
else {
if((sel&4)) chc = 'VECTOR_PADOVERVIEWE';
else {
if((sel&1)) chc = 'VECTOR_PADOVERVIEWD';
else chc = 'VECTOR_PADOVERVIEWC';
}
}
}
mission.runScreen({title:"P.A.D",choicesKey:chc,background:'vector_pad.png',model:'vector_padOverview',spinModel:false},this.padEval);
var mod = mission.displayModel;
mod.energy = 100;
mission.addMessageText("Name: \r\r\r\r\r"+player.name+"\r\r\r\r\rGC-ID: #"+player.ship.entityPersonality);
mission.addMessageText("Account:\r\r\r\r"+player.credits.toFixed(1)+"\nStatus:\r\r\r\r\r"+player.legalStatus+"\nClassification: \r"+player.rank+"\nRating:\r\r\r\r\r"+player.score);
var exp = parseInt(this.padInfos.generic.expFactor);
if(exp<=1) var b = "none";
else {
var a = Math.floor(exp*0.33),b = '';
while(a--){b += '\b';}
}
mission.addMessageText("\nGuild Rank: "+b);
if(missionVariables.vector_gcirank){
b = missionVariables.vector_gcirank;
mission.addMessageText("\nGCI Rank:\f\f\f\f\f\f"+b);
mod.fuel = this.padInfos.ranks.names.indexOf(b);
if(missionVariables.vector_gcimedal){
mission.addMessageText("Medals:");
var c = this.padInfos.medals.names.indexOf(missionVariables.vector_gcimedal);
if(c!==-1){
for(let i=0;i<c+1;i++) mission.addMessageText("- "+this.padInfos.medals.names[i]);
mod.energy = this.padInfos.medals.energy[c];
}
}
}
return;
}
this.showLogbook = function()
{ // Special signs # = get name for system.ID, $ = credits, & = more than a word
if(this.logbook.length<this.pad.logPages+1) mission.runScreen({title:"P.A.D",choicesKey:'VECTOR_PADLOGBOOKA',background:'vector_pad.png'},this.padEval);
else {
if(this.logbook.length>this.pad.logScreen+this.pad.logPages){
if(this.pad.logScreen && this.logbook.length>this.pad.logScreen+this.pad.logPages) mission.runScreen({title:"P.A.D",choicesKey:'VECTOR_PADLOGBOOKC',background:'vector_pad.png'},this.padEval);
else mission.runScreen({title:"P.A.D",choicesKey:'VECTOR_PADLOGBOOKB',background:'vector_pad.png'},this.padEval);
} else mission.runScreen({title:"P.A.D",choicesKey:'VECTOR_PADLOGBOOKD',background:'vector_pad.png'},this.padEval);
}
var txt = "\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\fLogs from: "+this.pad.logScreen+" of "+this.logbook.length+"\n\n";
var display = "",m = this.logbook.length,check;
for(var d=this.pad.logScreen;d<this.pad.logScreen+this.pad.logPages;d++){
if(m-1>=d){
let a = this.logbook[d].split(' ');
check = expandMissionText('VECTOR_PAD'+a[0]);
if(check==='null' || !check && this.padInfos.logExtensions.length){
for(let ex=0;ex<this.padInfos.logExtensions.length;ex++){
check = expandMissionText(this.padInfos.logExtensions[ex]+a[0]);
if(check) break;
}
}
// External entries available?
if(check==='null' || !check) display += "- not available -\n";
else {
if(a.length>1){
display += check+" ";
let b = a[1][0];
let c = a[1].substr(1);
if(b==='#') display += System.systemNameForID(c)+".\n";
else {
if(b==='$') display += c+".0 Cr.\n";
else {
if(b==='&'){
display += c;
for(let i=2;i<a.length;i++) display += " "+a[i];
display += ".\n";
} else display += a[1]+".\n";
}
}
} else display += check+"\n";
}
}
if(d==m-1) display += "\n***End***";
}
txt += display;
mission.addMessageText(txt);
return;
}
this.showPhone = function()
{
mission.runScreen({title:"P.A.D",choicesKey:'VECTOR_PADPHONEA',background:'vector_pad.png'},this.padEval);
mission.addMessageText("Communicator Channels:\n");
this.phone = this.padInfos.phones.current;
var txt='',temp='',tmp =[],loop = this.padInfos.phones.who.length,cur=0;
this.pad.comms = [];
for(let i=0;i<loop;i++){
cur = Math.pow(2,i);
if((this.phone&cur)){
temp = this.decrypt(this.padInfos.phones.code,this.padInfos.phones.who[i].link,this.padInfos.phones.who[i].fib);
this.pad.comms.push(temp);
tmp = this.getSplit(temp,": ",10);
txt += tmp+"\n";
}
}
mission.addMessageText(txt);
return;
}
this.showComm = function(which)
{
/* phone.current
1 GalCop Police
2 Benus Triadon
4 Major Hurst
8 Linda Bevenger
16 Pavel Stokitch
32 Arn D'ercul */
mission.runScreen({title:"P.A.D",choicesKey:'VECTOR_PADPHONEB',background:'vector_pad.png',model:'vector_ovComm',spinModel:false},this.padEval);
mission.displayModel.orientation = [1,0,0,0];
mission.displayModel.position = [150,100,600];
var tov,tso = 'vector_phoneB.ogg',tpw,tme;
switch(which){
case 1: if((this.phone&1)){tov = 'vector_ov09.png'; tso = 'vector_phoneA.ogg';
if(this.seenArn){tpw = 'VECTOR_ARNHINTS'; tme = 'VECTOR_ARNHINTAA';}
else {tpw = 'VECTOR_ARNHINTS'; tme = 'VECTOR_ARNHINTAB';}} break;
case 2: if((this.phone&2)){tov = 'vector_ov14.png'; tso = 'vector_phoneA.ogg';} break;
case 3: if((this.phone&4)){tov = 'vector_ov13.png'; tso = 'vector_phoneA.ogg';} break;
case 4: if((this.phone&8)){tov = 'vector_ov01.png'; tso = 'vector_phoneA.ogg';} break;
case 5: if((this.phone&16)){tov = 'vector_ov01.png'; tso = 'vector_phoneA.ogg';} break;
case 6: if((this.phone&32)){tov = 'vector_ov10.png'; tso = 'vector_phoneA.ogg';} break;
default: tov = null; break;
}
this.talkLoop = 0;
this.padSound.sound = tso;
this.padSound.play();
if(tpw) this.talkBox = {over:tov,sound:tso,messages:this.decrypt(tpw,tme,0).split("|")};
else delete this.talkBox;
this.talkTimer = new Timer(this,this.doTalk,0,3);
return;
}
this.doTalk = function()
{
if(!player.ship.docked){
this.talkTimer.stop();
delete this.talkTimer;
}
if(this.padSound.isPlaying) return;
switch(this.talkLoop){
case 0: if(this.talkBox && this.talkBox.over) mission.displayModel.setMaterials({"vector_modelview.png":{diffuse_map:this.talkBox.over}});
else {mission.addMessageText("\nSeems to be a wrong number."); this.talkLoop = 5;}
break;
case 1: mission.addMessageText(this.talkBox.messages[0]); break;
case 2: mission.addMessageText(this.talkBox.messages[1]); break;
case 3: mission.addMessageText(this.talkBox.messages[2]); break;
case 4: mission.addMessageText(this.talkBox.messages[3]); break;
}
this.talkLoop++;
if(this.talkLoop>4){
this.talkTimer.stop();
delete this.talkTimer;
this.padSound.sound = 'vector_phoneC.ogg';
this.padSound.play();
mission.displayModel.setMaterials({"vector_modelview.png":{}});
if((this.phone&1) && this.seenArn){
this.seenArn = false;
if(player.bounty>1) player.bounty--;
}
}
return;
}
this.showCodes = function()
{
// Codes 1 = codecard, 2 who, 4 where, 8 password, 16 message, 32 decrypted, 64 visited, 128 disabled, 256 destroyed, 512 actor found, 1024 actor done
if(oolite.gameSettings.shaderEffectsLevel==='SHADERS_OFF' || oolite.gameSettings.shaderEffectsLevel==='SHADERS_NOT_SUPPORTED') this.textHints = true;
else this.textHints = false;
if(!this.currentCodes){
this.currentCodes = this.padInfos.areidis.codes;
var n = 0;
for(let i=0;i<this.currentCodes.length;i++){
this.currentCodes[i] = parseInt(this.currentCodes[i]);
if(this.currentCodes[i]!==0) n++;
}
this.pad.codePages = n;
}
var chc = '';
if(this.pad.codePages>1){
if((this.currentCodes[this.pad.codeScreen-1]&32)) chc = 'VECTOR_PADCODESA';
else if((this.currentCodes[this.pad.codeScreen-1]&16)) chc = 'VECTOR_PADCODESC';
else chc = 'VECTOR_PADCODESA';
} else {
if((this.currentCodes[this.pad.codeScreen-1]&32)) chc = 'VECTOR_PADLOGBOOKA';
else if((this.currentCodes[this.pad.codeScreen-1]&16)) chc = 'VECTOR_PADCODESB';
else chc = 'VECTOR_PADLOGBOOKA';
}
mission.runScreen({title:"P.A.D",choicesKey:chc,background:'vector_pad.png',model:'vector_ovComm',spinModel:false},this.padEval);
mission.displayModel.position = [180,100,600];
mission.displayModel.orientation = [1,0,0,0];
// who
mission.addMessageText("Codecard: "+this.padInfos.areidis.display.who[this.pad.codeScreen-1]+"\n");
// where
mission.addMessageText("Where:\f\f\f"+this.padInfos.areidis.display.where[this.pad.codeScreen-1]+".");
if((this.currentCodes[this.pad.codeScreen-1]&64)) mission.addMessageText("Status:\f\f\fVisited.");
else mission.addMessageText("Status:\f\f\fUnknown.");
// Hints and overlays
if((this.currentCodes[this.pad.codeScreen-1]&1)){
mission.addMessageText("\nUsage:");
if(this.textHints){
mission.addMessageText("Something is scribbled on the rearside.\n");
var a = this.decrypt('VECTOR_CODEHINTS','VECTOR_CODEHINTAA',0); // TODO
mission.addMessageText(a);
if((this.currentCodes[this.pad.codeScreen-1]&1)) mission.displayModel.orientation = [1,0,1,0];
mission.displayModel.setMaterials({"vector_modelview.png":{diffuse_map:"vector_codes_ns.png"}});
} else {
mission.addMessageText("Orient the symbols in the same way.\n");
if((this.currentCodes[this.pad.codeScreen-1]&1)) mission.displayModel.setMaterials({"vector_modelview.png":{diffuse_map:"vector_modelview.png"}},this.padInfos.areidis.materials[this.pad.codeScreen-1]);
}
} else {
mission.displayModel.orientation = [1,0,1,0];
mission.addMessageText("\n\n\n");
}
// pwd
if((this.currentCodes[this.pad.codeScreen-1]&8)){
let a = expandMissionText(this.padInfos.areidis.pwd[this.pad.codeScreen-1]);
let b = this.helper.strDecrypt(a,String(this.core[0]));
mission.addMessageText("Password:\f\f\f"+b+".");
} else mission.addMessageText("");
// message
if((this.currentCodes[this.pad.codeScreen-1]&32)){
mission.addMessageText("Message:");
let a = this.padInfos.areidis.messages[this.pad.codeScreen-1];
let b = this.decrypt(this.padInfos.areidis.pwd[this.pad.codeScreen-1],a,0);
let c = this.helper.strScreenString(b,null,null);
mission.addMessageText(c);
} else if((this.currentCodes[this.pad.codeScreen-1]&16)){
mission.addMessageText("Message:");
var a = expandMissionText(this.padInfos.areidis.messages[this.pad.codeScreen-1]);
var b = this.helper.strScreenSubString(a,70);
mission.addMessageText(b);
} else mission.addMessageText("\n\n");
mission.displayModel.fuel=7;
return;
}
this.showSpecials = function()
{
return;
}
this.showReplayPage = function()
{
if(this.padInfos.replay.length<2) mission.runScreen({title:"P.A.D",choicesKey:"VECTOR_PADREPLAYSA",background:'vector_pad.png'},this.padEval);
else mission.runScreen({title:"P.A.D",choicesKey:"VECTOR_PADREPLAYSB",background:'vector_pad.png'},this.padEval);
mission.addMessageText("Cutscenes:\n-------------------------------\n");
var m = " ";
for(let i=0;i<this.padInfos.replay.length;i++){
if(this.pad.sceneCur===i) m = "> ";
else m = " ";
mission.addMessageText(m+this.padInfos.replay[i].t);
}
delete this.replayScene;
return;
}
this.showReplay = function(n)
{
var a = this.padInfos.replay[n];
worldScripts[a.w][a.f](a.s);
this.replayScene = 1;
return;
}
this.getSplit = function(m,sep,width)
{
var a = m.split(sep),b='';
if(width){
b = this.helper.strToWidth(a[0],width);
b += a[1];
} else b = a.join(" ");
return(b);
}
this.decrypt = function(a,b,c)
{
var ha = this.helper.strDecrypt(expandMissionText(a),String(this.core[c]));
var hb = this.helper.strDecrypt(expandMissionText(b),ha);
return(hb);
}
this.padEval = function(choice){worldScripts.vector_pad.doChoice(choice); return;}
this.doChoice = function(choice)
{
switch(choice){
case 'VECTOR_PADOVA': this.pad.logScreen = 0; this.showLogbook(); break;
case 'VECTOR_PADOVB': if(this.talkTimer){this.talkTimer.stop(); delete this.talkTimer;} this.showPhone(); break;
case 'VECTOR_PADOVC': delete this.currentCodes; this.showCodes(); break;
case 'VECTOR_PADOVD': this.showReplayPage(); break;
case 'VECTOR_PADLOGA': this.pad.logScreen += this.pad.logPages; if(this.pad.logScreen>=this.logbook.length) this.pad.logScreen = 0; this.showLogbook(); break;
case 'VECTOR_PADLOGB': this.pad.logScreen -= this.pad.logPages; if(this.pad.logScreen<=0) this.pad.logScreen = 0; this.showLogbook(); break;
case 'VECTOR_PADLOGC': this.showOverview(); break;
case 'VECTOR_PADCALLP': this.pad.cb = 1; worldScripts.Cabal_Common_Keyboard.start(this.name,4,2,'vector'); break;
case 'VECTOR_PADCODEA': this.pad.codeScreen++; if(this.pad.codeScreen>this.pad.codePages) this.pad.codeScreen=1; this.showCodes(); break;
case 'VECTOR_PADCODEB': this.pad.cb = 2; worldScripts.Cabal_Common_Keyboard.start(this.name,6,1,'vector'); break;
case 'VECTOR_PADQUIT': if(this.talkTimer){this.talkTimer.stop(); delete this.talkTimer;} break;
case 'VECTOR_PADEPLAYA': this.showReplay(this.pad.sceneCur); break;
case 'VECTOR_PADEPLAYB': this.pad.sceneCur++; if(this.pad.sceneCur>this.padInfos.replay.length-1) this.pad.sceneCur = 0; this.showReplayPage(); break;
}
return;
}
this.Cabal_Common_Keyboard_Output = function(str)
{
switch(this.pad.cb){
case 1:
if(str==='') this.showPhone(0);
else {
var c = [],react = 0;
for(let i=0;i<this.pad.comms.length;i++){c.push(this.pad.comms[i].split(": "));}
for(let i=0;i<c.length;i++){if(c[i][1]===str){react = i+1; break;}}
this.showComm(react);
}
break;
case 2:
if(str==='') this.showCodes();
else {
let a = this.helper.strDecrypt(expandMissionText(this.padInfos.areidis.messages[this.pad.codeScreen-1]),str);
if(a.substr(0,16)==='Diplomatic Code:'){
if(!(this.padInfos.areidis.codes[this.pad.codeScreen-1]&32)) this.addToLogbook("DAG");
this.padInfos.areidis.codes[this.pad.codeScreen-1] |= 40;
this.currentCodes = this.padInfos.areidis.codes;
} else this.addToLogbook("DAH");
this.showCodes();
}
break;
}
return;
}
this.addToLogbook = function(wa,wb,wc,wd)
{
for(var i=0;i<arguments.length;++i){
let a = arguments[i];
this.logbook.push(a);
if(this.logbook.length>47){
while(this.logbook.length>47) this.logbook.shift();
}
}
return(true);
}
this.clearLogbook = function()
{
this.logbook = ["AAA"];
return;
}
this.shipWillLaunchFromStation = function()
{
if(this.talkTimer){
this.talkTimer.stop();
delete this.talkTimer;
}
}
this.shipSpawned = function(ship)
{
if(!player.ship || this.startUp || !ship) return;
if(ship && ship.hasHostileTarget && ship.target && ship.target===player.ship.target && !ship.owner && !ship.group){
if(ship.forwardWeapon){this.padInfos.generic.superman++; return;}
if(ship.subEntities) for(let s=0;s<ship.subEntities.length;s++) if(ship.subEntities[s].forwardWeapon){this.padInfos.generic.superman++; break;}
}
return;
}
this.shipExitedWitchspace = function()
{
this.showBenus = false;
this.seenArn = false;
if(system.isInterstellarSpace || system.sun.isGoingNova || system.sun.hasGoneNova || !missionVariables.vector_version || player.score<300) return;
if(!missionVariables.TL_FOR_EQ_VECTOR_PAD){
// Get average number of entities
if(this.compEnts){
if(this.compEnts.length<10){
this.compEnts.push(system.allShips.length);
var n=0;
for(let a=0;a<this.compEnts.length;a++){n+=this.compEnts[a];}
this.actOnEnts = Math.max(Math.ceil(n/this.compEnts.length),55);
} else delete this.compEnts;
}
if((clock.seconds&1)) return;
if(system.allShips.length<this.actOnEnts && !system.countShipsWithRole('vector_benus')) system.addShipsToRoute('vector_benus',1,0.75,'wp');
}
}
this.missionScreenOpportunity = function()
{
if(!player.ship.docked) return;
if(this.showBenus){
mission.runScreen({title:player.ship.dockedStation.displayName,messageKey:'VECTOR_BENUSPRESENT',background:'vector_benuspresent.png',music:'vector_gift.ogg'});
EquipmentInfo.infoForKey('EQ_VECTOR_PAD').effectiveTechLevel = 1;
delete this.showBenus;
this.addToLogbook("AAD");
} else if(this.replayScene) this.showReplayPage();
return;
}
|
Scripts/vector_pirate.js |
"use strict";
this.name = "vector_pirate";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Gold,gold,gold.";
this.version = "1.7.1";
this.shipSpawned = function()
{
if(worldScripts.vector_pad.deactivated) this.noAct = true;
if(worldScripts.vector.red<3 || !this.ship.missiles) this.mAction = false;
else this.mAction = true;
}
this.shipDied = function()
{
var c = Math.random();
if((c<0.9 && !missionVariables.vector_arn) || c<0.6) return;
if(!this.noAct){
var entryNumber = (Math.random()*this.ship.entityPersonality)&3;
var podToEject = ['vector_cpodA','vector_cpodB','vector_cpodC','vector_cpodD'];
this.ship.ejectSpecificItem(podToEject[entryNumber]);
}
}
this.shipFiredMissile = function(missile,target)
{
if(!target.isPlayer || !this.mAction) return;
this.ship.awardEquipment(Math.random()>0.5?'EQ_VECTOR_FUNA_MISSILE':'EQ_VECTOR_FUNB_MISSILE');
this.mAction = false;
}
|
Scripts/vector_ppodF.js |
"use strict";
this.name = "vector_ppodF";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Special Escapepod Arn";
this.version = "1.7.1";
this.shipSpawned = function()
{
this.ship.switchAI('vector_epodAI.plist');
if(this.ship.owner) this.ship.owner.switchAI('vector_wreckAI.plist');
this.ov = new worldScripts.vector_news.VectorOV();
delete this.shipSpawned;
}
this.shipWasScooped = function(scooper)
{
if(scooper.isPlayer){
if(!missionVariables.vector_arn){
worldScripts.vector_pad.addToLogbook("CAC");
missionVariables.vector_arn = "SCOOPED";
this.ov.addOv(null,'10',1,null,"I'm Arn, Arn D'ercul - you have rescued me. I really thought you'd be one of them. For a safe passage to the next main station I'll give you something special...");
} else {
if(player.ship.equipmentStatus('EQ_VECTOR_SCOOPS')==='EQUIPMENT_OK') this.ov.addOv(null,'10',1,null,"Nice to see you again. And you've visited my friends, very good.");
else this.ov.addOv(null,'10',1,null,"You again! Hehe. Nice joke.");
player.addMessageToArrivalReport("Arn D'ercul: 'I'm afraid I must buy a new ship now. Well, it was fun while it lasted ...' With this word he walked away.");
}
if(this.breakoff){
for(var i=this.breakoff.length-1;i>-1;--i){
if(this.breakoff[i].isValid) this.breakoff[i].switchAI('vector_leaveAI.plist');}
}
}
}
|
Scripts/vector_richman.js |
"use strict";
this.name = "vector_richman";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Richman's action";
this.version = "1.7.1";
this.shipSpawned = function()
{
if(worldScripts.vector_pad.deactivated) this.noAct = true;
this.cargoAmount = Math.max(1,Math.ceil(Math.random()*8));
this.hitsCounter = 0;
this.entryNumber = (Math.random()*this.ship.entityPersonality)&3;
if(Math.random()>0.9 && missionVariables.vector_arn) this.podToEject = ['vector_cpodD','vector_cpodB','vector_cpodC','vector_cpodD'];
else this.podToEject = ['vector_cpodA','vector_cpodB','vector_cpodC','vector_cpodD'];
if(this.ship.primaryRole==='vector_richman') this.ship.primaryRole = 'trader';
if(this.ship.scriptInfo.vector_name!==null) this.vector_plea = "[vector_plea"+this.ship.scriptInfo.vector_name+"]";
this.ship.displayName = "Vector"+this.ship.scriptInfo.vector_epodName;
if(system.sun.isGoingNova || system.sun.isGoneNova || system.countShipsWithRole('vector')>1){
this.ship.switchAI('vector_leaveAI.plist');
return;
} else {
if(!system.mainStation || system.mainStation.position.distanceTo(this.ship)<35000 || this.entryNumber===1) this.ship.switchAI('vector_sunskimAI.plist');
else {
this.ship.switchAI('vector_traderAI.plist');
this.ship.fuel = 2;
if(Math.random()<0.4 && system.countShipsWithRole('repaired-buoy-station')) this.goToStat = system.shipsWithPrimaryRole('repaired-buoy-station')[0];
else this.goToStat = system.mainStation;
}
}
this.init = true;
}
this.shipBeingAttacked = function(whom)
{
if(!this.init) this.shipSpawned();
if(this.cargoAmount) this.vectorDropCargo(whom);
this.vectorDisplayName();
}
this.shipAttackedWithMissile = function(missile,whom)
{
if(!this.init) this.shipSpawned();
this.ship.target = missile;
if(this.cargoAmount) this.vectorDropCargo(whom);
this.vectorDisplayName();
}
this.shipTargetDestroyed = function()
{
this.ship.displayName = "Vector(Pleased "+this.ship.scriptInfo.vector_name+")";
}
this.vectorDisplayName = function()
{
if(this.ship.energy===this.ship.maxEnergy) this.ship.displayName = "Vector("+this.ship.scriptInfo.vector_name+")";
if(this.ship.energy>430 && this.ship.energy<this.ship.maxEnergy) this.ship.displayName = "Vector(Angry "+this.ship.scriptInfo.vector_name+")";
if(this.ship.energy<431 && this.ship.energy>179) this.ship.displayName = "Vector(Shaked "+this.ship.scriptInfo.vector_name+")";
if(this.ship.energy<180) this.ship.displayName = "Vector(Scared "+this.ship.scriptInfo.vector_name+")";
this.entryNumber =(Math.random()*this.ship.entityPersonality)&3;
}
this.vectorDropCargo = function(whom)
{
if(this.hitsCounter<5) ++this.hitsCounter;
else {
if(!this.noAct) this.ship.ejectSpecificItem(this.podToEject[this.entryNumber]);
this.cargoAmount -= 1;
this.hitsCounter = 0;
if(whom.isPlayer) player.commsMessage(expandDescription(this.vector_plea));
}
this.vectorDisplayName();
}
this.shipHitByECM = function(ecmPulsesRemaining)
{
if(!this.ship.target && ecmPulsesRemaining===2 &&(this.ship.AIState==='HEAD_FOR' || this.ship.AIState==='GO_TO_WAYPOINT') && this.ship.escorts) this.ship.AIState = 'SCAN_AREA';
}
this.checkTarget = function()
{
var attackbreak = false;
if(this.ship.escorts){
var i = this.ship.escorts.length;
while(--i){
if(this.ship.escorts[i]==this.ship.target){
attackbreak = true;
this.ship.target = null;
this.ship.AIState = 'HEAD_FOR';
}
}
if(!attackbreak) this.ship.AIState = 'ATTACK_SHIP';
} else {
if(this.ship.energy<250) this.ship.AIState = 'FLEE';
else this.ship.AIState = 'ATTACK_SHIP';
}
}
this.checkDistanceToSun = function()
{
if(this.ship.AI==='vector_sunskimAI.plist' && system.sun.position.distanceTo(this.ship)<system.sun.radius*2.5){
this.ship.fuel += 3.0;
this.ship.reactToAIMessage('SPEED_UP');
}
}
this.addFuel = function()
{
this.ship.fuel += 3.0;
}
this.getStation = function()
{
if(this.goToStat===system.mainStation || Math.random()<0.4){
if(!system.mainStation || !system.mainStation.isValid){
this.ship.switchAI('vector_leaveAI.plist');
return;
} else {
this.ship.target = system.mainStation;
this.ship.AIState = 'GO_TO_STATIONA';
}
} else {
this.ship.target = this.goToStat;
this.ship.AIState = 'GO_TO_STATIONB';
}
return;
}
|
Scripts/vector_specialiststation.js |
"use strict";
this.name = "vector_specialiststation";
this.author = "Svengali";
this.copyright = "CC-by-nd-sa-3.0";
this.description = "Station";
this.version = "1.7.1";
this.shipSpawned = function()
{
this.fcbhelper = new worldScripts.Cabal_Common_Briefing.Cabal_Common_ScreenFCB();
this.anim = false;
this.dd = this.ship.dockedDefenders;
this.ddscheduled = 0;
this.fun = [
[{display:"Send identification"},{display:"Back"}],
[{display:"Send identification"},{display:"Readout status"},{display:"Back"}]
];
this.commChannel = {display:"Specialist",who:this.ship,ent:true,pID:this.ship.entityPersonality,callback:"commCall",react:this.fun[0]};
this.ov = new worldScripts.vector_news.VectorOV();
this.granted = false;
if(worldScripts.vector_news.secondaryInfos.specialist.state>3) this.ship.spawnOne("vector_specialistmark");
}
this.doAnim = function(n)
{
if(this.anim) return;
this.anim = true;
if(this.ship.subEntities[3].energy>0) this.fcbhelper.fcbSetProp(this.ship,3,"energy",-0.01*n,19/n,1,0);
else this.fcbhelper.fcbSetProp(this.ship,3,"energy",0.01*n,19/n,1,0);
this.animTimer = new Timer(this,this.doAnimTimer,20/n,0);
}
this.doAnimTimer = function()
{
this.shipDied();
if(this.granted && this.ship.subEntities[3].energy===0) this.ship.commsMessage("Laser disabled.");
this.anim = false;
}
this.shipDied = this.shipRemoved = function()
{
this.fcbhelper.fcbRemoveAll();
if(this.animTimer) this.animTimer.stop();
delete this.animTimer;
if(this.closeDD){
this.closeDD.stop();
delete this.closeDD;
}
if(this.closeup){
this.closeup.stop();
delete this.closeup;
}
return;
}
this.commCall = function(action)
{
if(this.ship.position.distanceTo(player.ship.position)>25000 || this.psa) return;
switch(action){
case 0:
this.ship.commsMessage("Received Identification. We'll disable the laser now.");
if(this.ship.subEntities[3].energy>0) this.doAnim(1);
if(!this.granted){
this.granted = true;
var newSet = this.fun[1];
worldScripts.Cabal_Common_Comms.changeChoicesComm(this.commChannel.pID,newSet);
this.commChannel.react = newSet;
}
break;
case 1:
if(this.animTimer) this.ship.commsMessage("Laser status is changing.");
else {
if(this.ship.subEntities[3].energy>0) this.ship.commsMessage("Laser enabled.");
else this.ship.commsMessage("Laser disabled.");
}
}
return;
}
this.shipBeingAttacked = function(whom)
{
if(!whom){
this.ship.spawnOne("EQ_VECTOR_EMP_MINE");
return;
}
if(!this.ddscheduled && this.ship.dockedDefenders && this.ship.AIState==="DEFENSE_MODE") this.getThemOut();
if(player.ship.isValid && whom.isPlayer){
if(this.chan){
worldScripts.Cabal_Common_Comms.removeFromComm(this.commChannel);
delete this.chan;
}
this.psa = true;
this.granted = false;
}
this.ship.fireMissile("EQ_VECTOR_FUNC_MISSILE");
}
this.getThemOut = function()
{
let n = this.ship.dockedDefenders;
if(n){
while(n--){
this.ship.launchDefenseShip();
this.ddscheduled++;
}
if(!this.anim && this.ship.subEntities[3].energy>0) this.doAnim(10);
}
return;
}
this.shipTargetCloaked = function()
{
if(!this.anim && this.ship.subEntities[3].energy===0) this.doAnim(10);
this.ship.spawnOne("EQ_VECTOR_EMP_MINE");
}
this.checkDock = function()
{
if(!player.ship.isValid) return;
if(!this.psa && !this.chan){
if(this.ship.position.distanceTo(player.ship.position)<25000){
if(player.ship.isCloaked){
this.ship.commsMessage("Unknown vessel. Decloak to communicate.");
} else {
worldScripts.Cabal_Common_Comms.addToComm(this.commChannel);
this.ov.addOv(1,'07',null,null,1);
this.ship.commsMessage("Unknown vessel. Identify! We have established a secure channel.");
this.chan = true;
}
}
}
if(!this.closeup) this.closeup = new Timer(this,this.doCloseup,0,2);
}
this.stationLaunchedShip = function(whom)
{
if(whom){
if(whom.isPlayer){
this.shipDied();
this.anim = false;
this.ship.subEntities[3].energy = 9;
} else {
if(this.ddscheduled) this.ddscheduled--;
this.dd = this.ship.dockedDefenders;
if(!this.closeDD) this.closeDD = new Timer(this,this.doCloseDD,0,2);
}
}
}
this.doCloseDD = function()
{
if(this.ddscheduled) return;
if(!this.anim && this.ship.subEntities[3].energy===0){
this.doAnim(10);
this.closeDD.stop();
delete this.closeDD;
this.dd = this.ship.dockedDefenders;
}
}
this.doCloseup = function()
{
function isDocker(entity){return entity.isValid && entity.isShip && !entity.isWeapon && !entity.isCargo}
var a = system.filteredEntities(this,isDocker,this.ship,3500);
if(a.length){
for(let i=0;i<a.length;i++){
if(a[i].owner && a[i].owner===this.ship){
let d = a[i].position.distanceTo(this.ship.position);
if(a[i].position.distanceTo(this.ship.position)<2600 && !this.anim && this.ship.subEntities[3].energy>0) this.doAnim(10);
}
}
}
}
this.otherShipDocked = function(whom)
{
if(whom.owner===this.ship){
this.dd = this.ship.dockedDefenders;
if(this.closeup){
this.closeup.stop();
delete this.closeup;
}
if(this.ddscheduled) this.ddscheduled = 0;
}
if(!this.anim && this.ship.subEntities[3].energy===0) this.doAnim(10);
}
|
Scripts/vector_trader.js |
"use strict";
this.name = "vector_trader";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Display name change";
this.version = "1.7.1";
this.shipSpawned = function()
{
var a = ["GRS Chairman","Independent Courier","Hotelmanager","Banker","Dubious Businessman",
"Ship-Dealer","Hoopy frood","Financial Consultant","Miss Universe","Master of Science",
"Ultra G-Kricket Captain","Head Programmer","Selfmademan","Testpilot Vector Inc.","Yuppie","Vector"];
this.ship.displayName = a[(this.ship.entityPersonality&15)];
delete this.shipSpawned;
}
|
Scripts/vector_updater.js |
"use strict";
this.name = "vector_updater";
this.author = "svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "Updater for older versions";
this.version = "1.7.2";
this.startUp = function()
{
delete this.startUp;
if(worldScripts.vector_pad.startUp) worldScripts.vector_pad.startUp();
if(worldScripts.vector_pad.deactivated){this.killSelf(); return;}
if(player.ship.status === "STATUS_START_GAME"){this.killSelf(); return;}
if(missionVariables.vector_version){this.killSelf(); return;}
var excl = ["vector_cpod","vector_cpods","vector_epod","vector_epods","vector_expFactor","vector_passengerState","vector_limiter","vector_generic"];
var action = false;
for(let prop in missionVariables){if((prop.substr(0,6)==='vector' || prop.substr(0,9)==='localhero') && excl.indexOf(prop)===-1){action = true; break;}}
if(!action){this.killSelf(); return;}
}
this.killSelf = function()
{
missionVariables.vector_version = "1_7";
/* for(prop in this){
log(this.name, prop);
if(prop!=='name' && prop!=='version' && prop!=='oolite_manifest_identifier')
delete this[prop];
//will break on each new read-only property like oolite_manifest_identifier in 1.81
}
*/
delete this.startUp;
delete this.missionScreenOpportunity;
this.deactivated = true;
return;
}
this.missionScreenOpportunity = function()
{
if(!player.ship.docked) return;
mission.runScreen({messageKey:'VECTOR_UPDATE',choicesKey:'VECTOR_UPDATEYN',background:'vector_official1.png',music:'vector_transmission.ogg'},this.choiceEval);
return;
}
this.choiceEval = function(choice)
{
if(!choice){log(this.name,"Booh. Not updated!"); return;}
switch(choice){
case 'VECTOR_UPDATEJ':
var gal,destNum,destIDs,destName;
// Clear destinations from versions<1.4.3
if(missionVariables.vector){
if((missionVariables.vector[0]==='V' || missionVariables.vector[0]==='R')){
if(missionVariables.vector_visits && galaxyNumber===parseInt(missionVariables.vector_visits[missionVariables.vector_visits.length-1])){
gal = parseInt(missionVariables.vector_visits[missionVariables.vector_visits.length-1])
destNum = parseInt(missionVariables.vector[5]);
destIDs = missionVariables.vector_visits.split(" ");
destName = System.systemNameForID(destIDs[destNum-1]);
mission.unmarkSystem(destIDs[destNum-1]);
mission.setInstructionsKey(null,'vector');
} else mission.setInstructionsKey(null,'vector');
}
}
// Clear destinations versions>1.4.2
if(missionVariables.vector_arn){
if((missionVariables.vector_arn[0]==='V' || missionVariables.vector_arn[0]==='R')){
if(missionVariables.vector_arnvisits && galaxyNumber===parseInt(missionVariables.vector_arnvisits[missionVariables.vector_arnvisits.length-1])){
gal = parseInt(missionVariables.vector_arnvisits[missionVariables.vector_arnvisits.length-1]);
destNum = parseInt(missionVariables.vector_arn[5]);
destIDs = missionVariables.vector_arnvisits.split(" ");
destName = System.systemNameForID(destIDs[destNum-1]);
mission.unmarkSystem(destIDs[destNum-1]);
mission.setInstructionsKey(null,'vector_missionArn');
} else mission.setInstructionsKey(null,'vector_missionArn');
}
}
mission.setInstructionsKey(null,'localhero');
// Clear mVs
var excl = ["vector_cpod","vector_cpods","vector_epod","vector_epods","vector_expFactor","vector_passengerState","vector_limiter","vector_generic"];
for(let prop in missionVariables){
if((prop.substr(0,6)==='vector' || prop.substr(0,9)==='localhero') && excl.indexOf(prop)===-1){
missionVariables[prop] = null;
}
}
// Get rid of the EQs
missionVariables.TL_FOR_EQ_VECTOR_SCOOPS = null;
if(player.ship.equipmentStatus('EQ_VECTOR_SCOOPS')==='EQUIPMENT_OK') player.ship.removeEquipment('EQ_VECTOR_SCOOPS');
missionVariables.TL_FOR_EQ_VECTOR_PAD = null;
if(player.ship.equipmentStatus('EQ_VECTOR_PAD')==='EQUIPMENT_OK') player.ship.removeEquipment('EQ_VECTOR_PAD');
if(player.ship.equipmentStatus('EQ_VECTOR_ARNP')==='EQUIPMENT_OK') player.ship.removeEquipment('EQ_VECTOR_ARNP');
if(player.ship.equipmentStatus('EQ_VECTOR_ALDRIN')==='EQUIPMENT_OK') player.ship.removeEquipment('EQ_VECTOR_ALDRIN');
// Byebye
this.killSelf();
break;
case 'VECTOR_UPDATEN':
this.killSelf();
break;
default: log(this.name,"Choice not handled.");
}
// Kill mission to avoid problems
for(let prop in worldScripts.vector_missionArn){if(prop!=='name' && prop!=='version') delete worldScripts.vector_missionArn.prop;}
for(let prop in worldScripts.vector_news){if(prop!=='name' && prop!=='version') delete worldScripts.vector_news.prop;}
// Clear log
worldScripts.vector_pad.clearLogbook();
return;
}
|