Scripts/VimanaHUD.js |
"use strict";
this.name = "VimanaHUD"
this.version = "2.07"
this.author = "Gnievmir";
this.license = "CC-BY-NC-SA 3.0";
this.$AMS = null; // antymissile system
this.$SRS = null; // self repair system
this.$TLS = null; // telescope
this.$TFS = null; // target filtering system
this.$SLS = null; // sniper lock
this.$SLP = null; // sniper lock plus
this.$ACH = null; // autocrosshair
this.$SEC = null; // shield equalizer-capacitors
this.$SC = null; // Shield Cycler
this.$LMSS = null; // LMSS
this.$ReqFuel = 0;
this.$LastUsed = [];
this.$HullAnim = [];
this.$InfoTimer = null; //store pointer to text info timer
this.$IconTimer = null; //store pointer to graphical info timer
this.$Maitenance = false;
this.$CBF = null;
this.$govs = [];
this.$ecos = [];
this.$EqDmg = [];
this.$inflightHud;
this.$GameShips = [ // storage; ships and other model picture
//player ships
{ship: "Python", file: "python"},
{ship: "Boa", file: "boa"},
{ship: "Anaconda", file: "anaconda"},
{ship: "Asp Mark II", file: "asp"},
{ship: "Adder", file: "adder"},
{ship: "Boa Class Cruiser", file: "boa_cruiser"},
{ship: "Cobra Mark III", file: "cobra3"},
{ship: "Cobra Mark I", file: "cobra1"},
{ship: "Fer-de-Lance", file: "ferdelance"},
{ship: "Moray Star Boat", file: "moray"},
{ship: "Moray Medical Boat", file: "moray"},
{ship: "Griff Boa Prototype", file: "griff_boa"},
{ship: "Wolf Mark II", file: "wolf2"},
//other ships
{ship: "Griff Krait", file: "griff_krait"},
{ship: "Gecko", file: "gecko"},
{ship: "Krait", file: "krait"},
{ship: "Training Fighter", file: "krait"},
{ship: "Sidewinder Scout Ship", file: "sidewinder"},
{ship: "Mamba", file: "mamba"},
{ship: "Mamba Escort", file: "mamba"},
{ship: "GalCop Viper", file: "viper"},
{ship: "GalCop Viper Interceptor", file: "interceptor"},
{ship: "Transporter", file: "transporter"},
{ship: "Mining Transporter", file: "transporter"},
{ship: "Worm", file: "worm"},
{ship: "Orbital Shuttle", file: "orbital_shuttle"},
{ship: "Thargoid Robot Fighter", file: "thargon_robot"},
{ship: "Thargoid Warship", file: "thargon"},
{ship: "Light Fighter", file: "light_fighter"},
{ship: "GalTech Interceptor", file: "gt_interceptor"},
{ship: "Raider", file: "raider"},
//other targets
{ship: "Cargo container", file: "cargo"},
{ship: "Escape capsule", file: "escape"},
{ship: "Ejected Pilot", file: "pilot"},
{ship: "Thargoid Spy Satellite", file: "thargon_sat"},
{ship: "Asteroid", file: "asteroid"},
//navi
{ship: "Navigation Buoy", file: "buoy"},
{ship: "Training Buoy", file: "buoy"},
{ship: "Witchpoint Beacon", file: "buoy"},
//dockable
{ship: "Coriolis Station", file: "corolis"},
{ship: "Dodecahedron Station", file: "dodo"},
{ship: "Leesti High", file: "dodo"},
{ship: "Icosahedron Station", file: "ico"},
{ship: "Rock Hermit", file: "rockhermit"}
];
this.$operationalFunctionNames= [ // list of funcitions to enable/disable at HUDSelector callback
"shipWillDockWithStation",
"shipWillLaunchFromStation",
"guiScreenChanged",
"alertConditionChanged",
];
//----------------------------------------------------------------------------------------
this.startUp = function _vimanaHUD_startUp() {
var p = player.ship;
p.crosshairs = "crosshair_off.plist";
this._txtDial("VimanaRh","");
if (!missionVariables.ironHide_percentage) missionVariables.ironHide_percentage = 0;
for (let i = 0; i < 8 ; i++) {
this.$govs.push(String.fromCharCode(i));
this.$ecos.push(String.fromCharCode(23 - i));
}
if (worldScripts["telescope"]) {
this.$TLS = worldScripts["telescope"];
//this.$TLS.$TelescopeVPosHUD = [-14.0, -22.5, -15.0]
// this.$TLS.$TelescopeRing = false
this.$TLS.$TelescopeVSize = 4 ;
this.$TLS.$TelescopeVZoomSize = 4 ;
}
var w;
if (worldScripts.hudselector) this.$HSEL = worldScripts.hudselector;
if (worldScripts.shieldequalizercapacitors) this.$SEC = worldScripts.shieldequalizercapacitors;
if (worldScripts.sniperlock) this.$SLS = worldScripts.sniperlock;
if (worldScripts.sniperlock_plus) this.$SLP = worldScripts.sniperlock_plus;
if (worldScripts["Auto Crosshairs"]) this.$ACH = worldScripts["Auto Crosshairs"];
if (worldScripts.ams_system) this.$AMS = worldScripts.ams_system;
if (worldScripts["Target Filtering System"]) this.$TFS = worldScripts["Target Filtering System"];
w = worldScripts["Repair System"];
if (w && w.version && w.version >= "2.14") this.$SRS = w;
w = worldScripts["Shield Cycler"];
if (w && w.version && w.version >= "2.1") this.$SC = w;
if (worldScripts.LMSS_Core) this.$LMSS = worldScripts.LMSS_Core;
if (this.$HSEL) {
this.$HSEL.$HUDSelectorAddHUD("VimanaHUD 6 MFDs", this.name);
this.$HSEL.$HUDSelectorAddHUD("VimanaHUD 12 MFDs", this.name+"-mfds");
}
for (let i = 0;i<p.equipment.length;i++){
if (p.equipmentStatus(p.equipment[i].equipmentKey) === "EQUIPMENT_DAMAGED") this.$EqDmg.push(p.equipment[i].name);
}
}
//----------------------------------------------------------------------------------------
this.$HUDSelectorCallBack = function _vimanaHUD_HUDSelectorCallBack(off) {
var ws = worldScripts.VimanaHUD;
var pship = player.ship;
var funcNames = this.$operationalFunctionNames;
var i = funcNames.length;
log(this.name, "HUDSelectorCallBack, off:"+off+", pship.hud:"+pship.hud);
if (off) {
// disable
ws.$stopTimers();
while (i--)
if (ws[funcNames[i]]) {
ws["$save_"+funcNames[i]] = ws[funcNames[i]];
delete ws[funcNames[i]];
}
} else {
// enable
while (i--)
if (!ws[funcNames[i]]) {
ws[funcNames[i]] = ws["$save_"+funcNames[i]];
}
this.$inflightHud = pship.hud;
if (!pship.docked) {
ws.shipWillLaunchFromStation();
} else {
pship.hud = "VimanaHUD_docked.plist";
}
}
}
//----------------------------------------------------------------------------------------
this.shipWillDockWithStation = function _vimanaHUD_shipWillDockWithStation() {
var p = player.ship;
this.$stopTimers();
this.$LastUsed[13] = "";
this.$inflightHud = p.hud;
p.hud = "VimanaHUD_docked.plist";
}
//----------------------------------------------------------------------------------------
this.shipWillLaunchFromStation = function _vimanaHUD_shipWillLaunchFromStation() {
var p = player.ship;
var m = null;
for(let i=0;i<19;i++){
this.$LastUsed[i] = null;
}
if (this.$inflightHud) p.hud = this.$inflightHud;
if(!isValidFrameCallback(this.$CBF))
this.$CBF = addFrameCallback(this._showIndicators.bind(this));
this._checkMaint();
//set player ship image
this.$HullAnim[0] = "";
for(var i=0;i<this.$GameShips.length;i++){
if(this.$GameShips[i].ship == p.name){
this.$HullAnim[0] = this.$GameShips[i].file;
break;
}
}
this.$AlertNo = 0;
for(let i = 0;i<p.equipment.length;i++){
if(p.equipment[i].damageProbability > 0) this.$LastUsed[16]++;
}
if(!this.$InfoTimer) this.$InfoTimer = new Timer(this, this._showInfo.bind(this), 0, 0.25);
if(!this.$IconTimer) this.$IconTimer = new Timer(this, this._showIcon.bind(this), 0, 0.5);
if(!this.$AnimTimer) this.$AnimTimer = new Timer(this, this._animHull.bind(this), 0, 1);
this.alertConditionChanged(player.ship.alertCondition);
this._eqipmentStatus();
this.$LastUsed[12] = 1;
this.$HullAnim[1] = 3;
this._setLPanel();
}
//----------------------------------------------------------------------------------------
this.guiScreenChanged = function _vimanaHUD_guiScreenChanged(to, from) {
if (from === "GUI_SCREEN_SHORT_RANGE_CHART" || from === "GUI_SCREEN_LONG_RANGE_CHART") {
this.$LastUsed[12] = 1;
this._setLPanel();
}
}
//----------------------------------------------------------------------------------------
this.equipmentRepaired = function _vimanaHUD_equipmentRepaired(equipment) { //repaired
var p = player.ship;
for(let i = 0;i<p.equipment.length;i++){
if(this.$EqDmg[i] == EquipmentInfo.infoForKey(equipment).name)this.$EqDmg.splice(i,1);
}
this._eqipmentStatus() ;
}
//----------------------------------------------------------------------------------------
this.equipmentDamaged = function _vimanaHUD_equipmentDamaged(equipment) { //damaged
this.$EqDmg.push(EquipmentInfo.infoForKey(equipment).name);
this._eqipmentStatus();
}
//----------------------------------------------------------------------------------------
this.shipTargetAcquired = function _vimanaHUD_shipTargetAcquired(target) {
if(target.isWormhole) return;
var p = player.ship;
this._txtDial("VimanaLPTitle",".: TARGET INFO :.");
this._txtDial("VimanaSClock","");
this._txtDial("VimanaCEnergy","");
this._txtDial("VimanaCSpeed","");
this._txtDial("VimanaCMissile","");
if(p.equipmentStatus("EQ_VIMANA_TARGET_MODULE") === "EQUIPMENT_OK"){
var m = null;
//set ship model and name
for(var i=0;i<this.$GameShips.length;i++){
if(this.$GameShips[i].ship == target.name){
m = this.$GameShips[i].file + ".png";
break;
}
}
if(m) var model = m; else var model = "blank.png";
p.setCustomHUDDial("VimanaPTarget",model);
}
}
//----------------------------------------------------------------------------------------
this.shipExitedWitchspace = function _vimanaHUD_shipExitedWitchspace() {
this._checkMaint();
this.$LastUsed[12] = 1;
this.$LastUsed[13] = "";
this._setLPanel();
}
//----------------------------------------------------------------------------------------
this.alertConditionChanged = function _vimanaHUD_alertConditionChanged(newState, oldState) {
var cond = "";
switch (newState) {
case 1: // "Green Alert"
cond = "green_";
break;
case 2: // "Yellow Alert"
cond = "";
break;
case 3: // "Red Alert"
cond = "red_";
}
log(this.name, "Setting player's crosshairs to "+cond+"crosshair_off.plist");
player.ship.crosshairs = cond + "crosshair_off.plist";
if (this.$ACH) {
this.$ACH.$crosshairs.default.off = this.$ACH.$offTargetCrosshairs = cond + "crosshair_off.plist";
this.$ACH.$onTargetCrosshairs = this.$ACH.$crosshairs.default.on = cond + "crosshair_on.plist";
}
}
//----------------------------------------------------------------------------------------
this.compassTargetChanged = function _vimanaHUD_compassTargetChanged(whom, mode) {
if (!whom) return;
var target = "";
if(mode === "COMPASS_MODE_BASIC"){
if(whom.isPlanet) target = "Planet";
else target = "Main Station";
}else if(mode === "COMPASS_MODE_PLANET"){
var s = System.infoForSystem(system.info.galaxyID, system.info.systemID);
var ex = " (" + (s.techlevel + 1) + ") " + this.$ecos[s.economy] + this.$govs[s.government];
target = whom.name + ex;
}else if(mode === "COMPASS_MODE_TARGET"){
target = "Target";
}else{
if (whom.beaconLabel) target = whom.beaconLabel;
else if (whom.displayName) target = whom.displayName;
else if(whom.name) target = whom.name;
else if(whom.beaconCode) target = whom.beaconCode;
else target = "Unidentified";
}
this._txtDial("VimanaASCName",target.substr(0,26));
}
/*******************************************************************
* display hud icons (pictograms)
* ******************************************************************/
//----------------------------------------------------------------------------------------
this.$stopTimers = function _vimanaHUD_stopTimers() {
if(this.$InfoTimer) {
this.$InfoTimer.stop();
delete this.$InfoTimer;
}
if(this.$IconTimer) {
this.$IconTimer.stop();
delete this.$IconTimer;
}
if(this.$AnimTimer) {
this.$AnimTimer.stop();
delete this.$AnimTimer;
}
}
//----------------------------------------------------------------------------------------
this._showIcon = function _vimanaHUD_showIcon() {
var that = _vimanaHUD_showIcon
var _player = (that._player = that._player || player);
var p = _player.ship;
var h = this._getHostileShips();
if (h.length && p.alertCondition === 3) {
if (Math.floor((this.$IconTimer.nextTime * 10)%2))
p.setCustomHUDDial("VimanaHCG", "combat.png"); //sabre icon
else
p.setCustomHUDDial("VimanaHCG", "blank.png");
} else {
p.setCustomHUDDial("VimanaHCG","blank.png");
}
if (this.$LMSS) { //lmss icon
var ws = this.$LMSS;
switch (p.viewDirection) {
case "VIEW_FORWARD":
if (p.equipmentStatus("EQ_LMSS_FRONT") === "EQUIPMENT_OK")
this._LMSSIcons(ws._forwardTimer);
else if (p.equipmentStatus("EQ_LMSS_FRONT") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaLmss","lmss_d.png");
else
p.setCustomHUDDial("VimanaLmss","blank.png");
break;
case "VIEW_AFT":
if (p.equipmentStatus("EQ_LMSS_AFT") === "EQUIPMENT_OK")
this._LMSSIcons(ws._aftTimer);
else if (p.equipmentStatus("EQ_LMSS_AFT") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaLmss","lmss_d.png");
else
p.setCustomHUDDial("VimanaLmss","blank.png");
break;
case "VIEW_PORT":
if (p.equipmentStatus("EQ_LMSS_PORT") === "EQUIPMENT_OK")
this._LMSSIcons(ws._portTimer);
else if (p.equipmentStatus("EQ_LMSS_PORT") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaLmss","lmss_d.png");
else
p.setCustomHUDDial("VimanaLmss","blank.png");
break;
case "VIEW_STARBOARD":
if (p.equipmentStatus("EQ_LMSS_STARBOARD") === "EQUIPMENT_OK")
this._LMSSIcons(ws._starboardTimer);
else if (p.equipmentStatus("EQ_LMSS_STARBOARD") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaLmss","lmss_d.png");
else
p.setCustomHUDDial("VimanaLmss","blank.png");
}
if (p.equipmentStatus("EQ_LMSS_ACTUATOR") === "EQUIPMENT_OK")
p.setCustomHUDDial("VimanaLmsA","lmsa.png");
else if (p.equipmentStatus("EQ_LMSS_ACTUATOR") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaLmsA","lmsa_d.png");
else
p.setCustomHUDDial("VimanaLmsA","blank.png");
}
if(p.equipmentStatus("EQ_CLOAKING_DEVICE") === "EQUIPMENT_DAMAGED") this._blinkingIcons("VimanaCloaking","invisible_d.png");
else if(p.isCloaked) this._blinkingIcons("VimanaCloaking","invisible.png");
else p.setCustomHUDDial("VimanaCloaking","blank.png");
if (this.$SEC) {
//forward capacitor
if (p.equipmentStatus("EQ_FORWARD_SHIELD_CAPACITOR") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaCapacitorF","cap_f_d.png");
else if (p.equipmentStatus("EQ_FORWARD_SHIELD_CAPACITOR") === "EQUIPMENT_OK") {
if (this.$SEC.secforwardshieldcapacitor == 0)
p.setCustomHUDDial("VimanaCapacitorF","blank.png");
else if (this.$SEC.secforwardshieldcapacitor < this.$SEC.$maxCapacitorCharge - p.forwardShieldRecharge)
this._blinkingIcons("VimanaCapacitorF","cap_f.png");
else
p.setCustomHUDDial("VimanaCapacitorF","cap_f.png");
} else
p.setCustomHUDDial("VimanaCapacitorF","blank.png");
//center dot
if (p.equipmentStatus("EQ_AFT_SHIELD_CAPACITOR") === "EQUIPMENT_DAMAGED" && p.equipmentStatus("EQ_FORWARD_SHIELD_CAPACITOR") === "EQUIPMENT_DAMAGED")
p.setCustomHUDDial("VimanaCapacitorC","cap_c_d.png");
else if (p.equipmentStatus("EQ_AFT_SHIELD_CAPACITOR") === "EQUIPMENT_OK" && p.equipmentStatus("EQ_FORWARD_SHIELD_CAPACITOR") === "EQUIPMENT_OK")
p.setCustomHUDDial("VimanaCapacitorC","cap_c.png");
else if (p.equipmentStatus("EQ_AFT_SHIELD_CAPACITOR") === "EQUIPMENT_OK" || p.equipmentStatus("EQ_FORWARD_SHIELD_CAPACITOR") === "EQUIPMENT_OK")
this._blinkingIcons("VimanaCapacitorC","cap_b.png","cap_c.png");
else
p.setCustomHUDDial("VimanaCapacitorC","blank.png");
//aft capacitor
if (p.equipmentStatus("EQ_AFT_SHIELD_CAPACITOR") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaCapacitorA","cap_a_d.png");
else if (p.equipmentStatus("EQ_AFT_SHIELD_CAPACITOR") === "EQUIPMENT_OK") {
if (this.$SEC.secaftshieldcapacitor == 0)
p.setCustomHUDDial("VimanaCapacitorA","blank.png");
else if (this.$SEC.secaftshieldcapacitor < this.$SEC.$maxCapacitorCharge - p.aftShieldRecharge)
this._blinkingIcons("VimanaCapacitorA","cap_a.png");
else
p.setCustomHUDDial("VimanaCapacitorA","cap_a.png");
} else
p.setCustomHUDDial("VimanaCapacitorA","blank.png");
} else {
p.setCustomHUDDial("VimanaCapacitorF","blank.png");
p.setCustomHUDDial("VimanaCapacitorC","blank.png");
p.setCustomHUDDial("VimanaCapacitorA","blank.png");
}
if (p.equipmentStatus("EQ_SHIELD_EQUALIZER") === "EQUIPMENT_OK")
p.setCustomHUDDial("VimanaSCycler","sc.png");
else if (p.equipmentStatus("EQ_SHIELD_EQUALIZER") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaSCycler","sc_d.png");
else if (this.$SC && this.$SC.$sc_settings && this.$SC.$sc_settings.version) {
if (this.$SC.$sc_settings.functional == 100)
p.setCustomHUDDial("VimanaSCycler","sc.png");
else
this._blinkingIcons("VimanaSCycler","sc_d.png");
} else
p.setCustomHUDDial("VimanaSCycler","blank.png");
//EQ_NAVAL_ENERGY_UNIT
if (p.equipmentStatus("EQ_ENERGY_UNIT") === "EQUIPMENT_UNAVAILABLE" && p.equipmentStatus("EQ_NAVAL_ENERGY_UNIT") === "EQUIPMENT_UNAVAILABLE")
p.setCustomHUDDial("VimanaEEnergy","blank.png");
else {
if (p.equipmentStatus("EQ_ENERGY_UNIT") === "EQUIPMENT_OK")
p.setCustomHUDDial("VimanaEEnergy","eeu.png");
else if (p.equipmentStatus("EQ_ENERGY_UNIT") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaEEnergy","eeu_d.png");
else if (p.equipmentStatus("EQ_NAVAL_ENERGY_UNIT") === "EQUIPMENT_OK")
p.setCustomHUDDial("VimanaEEnergy","eeu.png");
else if (p.equipmentStatus("EQ_NAVAL_ENERGY_UNIT") === "EQUIPMENT_DAMAGED")
this._blinkingIcons("VimanaEEnergy","eeu_d.png");
}
if(p.equipmentStatus("EQ_ECM") === "EQUIPMENT_OK")p.setCustomHUDDial("VimanaECM","ecm_o.png");
else if(p.equipmentStatus("EQ_ECM") === "EQUIPMENT_DAMAGED")this._blinkingIcons("VimanaECM","ecm_d.png");
if(this.$Maitenance == true)this._blinkingIcons("VimanaService","maintenance.png");
else p.setCustomHUDDial("VimanaService","blank.png");
if(p.equipmentStatus("EQ_FUEL_INJECTION") === "EQUIPMENT_DAMAGED"||p.fuel<0.1) this._blinkingIcons("VimanaFInjector","injector_d.png");
else if(p.equipmentStatus("EQ_FUEL_INJECTION") === "EQUIPMENT_OK") p.setCustomHUDDial("VimanaFInjector","injector.png");
else p.setCustomHUDDial("VimanaFInjector","blank.png");
if(((p.fuel).toFixed(1) < this.$ReqFuel && system.ID != p.targetSystem)||p.fuel<0.1) this._blinkingIcons("VimanaLowFuel","low_fuel.png");
else p.setCustomHUDDial("VimanaLowFuel","blank.png") ;
//self repair system icons
var eqKey = (this.$SRS && this.$SRS.$controllerVersion ? this.$SRS.$controllerVersion : null);
if (eqKey) {
if (this.$SRS.$selfRepairsSystemStatus === "Active")
this._blinkingIcons("VimanaRepIcon", "srs_0.png", "srs_1.png");
else if (this.$SRS.$selfRepairsSystemStatus === "Self-repair")
this._blinkingIcons("VimanaRepIcon", "srs_d.png", "blank.png");
else if (this.$SRS.$selfRepairsSystemStatus === "Standby")
p.setCustomHUDDial("VimanaRepIcon", "srs.png");
else if (this.$SRS.$selfRepairsSystemStatus === "Shutdown")
p.setCustomHUDDial("VimanaRepIcon", "srs_d.png");
else
p.setCustomHUDDial("VimanaRepIcon", "blank.png");
} else
p.setCustomHUDDial("VimanaRepIcon", "blank.png");
}
//----------------------------------------------------------------------------------------
this._LMSSIcons = function _vimanaHUD_LMSSIcons(tmr) {
var p = player.ship;
if(tmr && tmr.isRunning){
if(Math.floor(this.$IconTimer.nextTime * 10)&1)p.setCustomHUDDial("VimanaLmss","lmss1.png");
else p.setCustomHUDDial("VimanaLmss","lmss0.png");
}else{
p.setCustomHUDDial("VimanaLmss","lmss0.png");
}
}
//----------------------------------------------------------------------------------------
this._blinkingIcons = function _vimanaHUD_blinkingIcons(key,ico,blank) {
if(blank == null) blank = "blank.png";
if(Math.floor(this.$IconTimer.nextTime * 10)&1){
player.ship.setCustomHUDDial(key,ico);
}else{
player.ship.setCustomHUDDial(key,blank);
}
}
//----------------------------------------------------------------------------------------
this._getHostileShips = function _vimanaHUD_getHostileShips() {
return this._filterEntities(
function(e) { return ( e.isShip && e.hasHostileTarget && e.target === player.ship ); }
);
};
//----------------------------------------------------------------------------------------
this._filterEntities = function _vimanaHUD_filterEntities(filterFunc) {
return system.filteredEntities(
this,
filterFunc,
player.ship,
player.ship.scannerRange
);
}
//----------------------------------------------------------------------------------------
this._showInfo = function _vimanaHUD_showInfo() { //txt information on the hud
var p = player.ship;
/**************************************
* display a list of damaged equipment
**************************************/
//right panel
if(p.equipmentStatus("EQ_VIMANA_SHIP_MODULE") === "EQUIPMENT_OK"){
if(this.$EqDmg.length && !(Math.floor($InfoTimer.nextTime*100)%4)){
if(this.$EqDmg.length<9){
var poz = this.$LastUsed[14] = 0;
}else{
if(this.$LastUsed[14]>this.$EqDmg.length - 1) this.$LastUsed[14] = 0;
var poz = this.$LastUsed[14];
this.$LastUsed[14]++;
}
for(let i=0;i<9;i++){
if(i>this.$EqDmg.length-1) break;
let y = poz + i;
if(y > this.$EqDmg.length - 1) y-= this.$EqDmg.length;
let spc = "";
if(y<9)spc = " ";
let dsp = spc + (1 + y) + ". " + this.$EqDmg[y];
let ln = i + 1;
this._txtDial("VimanaR" + ln, dsp.substr(0,36));
}
}
}
if (p.alertCondition === 3 ) {
if ((this.$SLS && this.$SLS.sniperlockchangeflag && this.$SLS.sniperlockchangeflag === "ON") ||
(this.$SLP && this.$SLP.$slpState === "ON"))
this._txtDial("VimanaTLock","LOCKED");
else
this._txtDial("VimanaTLock","");
//hostile counter
var hc = [];
hc = this._getHostileShips();
if (hc.length > 0) {
if (hc.length > 9)
this._txtDial("VimanaHC",hc.length);
else
this._txtDial("VimanaHC"," " + hc.length);
}
} else
this._txtDial("VimanaTLock","");
this._setLPanel();
//repairbots status
if (this.$SRS && this.$SRS.$controllerVersion)
this._txtDial("VimanaRepBots", this.$SRS.$selfRepairsSystemStatus+", Charges: " + missionVariables.repairCounter);
//ams system
if(p.equipmentStatus("EQ_AMS") === "EQUIPMENT_OK" && missionVariables.amActive === "ACTIVE" && this.$AMS.amCount) this._txtDial("VimanaAMS","Darts: " + this.$AMS.amCount);
else if(p.equipmentStatus("EQ_AMS") === "EQUIPMENT_OK") this._txtDial("VimanaAMS","OFFLINE");
else if(p.equipmentStatus("EQ_AMS") === "EQUIPMENT_DAMAGED") this._txtDial("VimanaAMS","DAMAGED");
else this._txtDial("VimanaAMS","");
/*
* equip mode
*/
var eq_mode = "";
switch(p.primedEquipment){
case "EQ_TARGET_FILTERING_SYSTEM":
if(p.equipmentStatus("EQ_TARGET_FILTERING_SYSTEM") === "EQUIPMENT_OK"){
switch(this.$TFS._mode){
case 0: eq_mode = "hostile/outlaw";
break;
case 1: eq_mode = "thargon";
break;
case 2: eq_mode = "police";
break;
case 3: eq_mode = "neutral";
break;
case 4: eq_mode = "cargo";
break;
case 5: eq_mode = "asteroids";
break;
}
}
break;
case "EQ_WARRANT_SCANNER":
var ws = worldScripts["BountySystem_WarrantScanner"];
switch(ws._outputMode){
case 0: eq_mode = "MFD";
break;
case 1: eq_mode = "console";
}
break;
case "EQ_HYPER_RADIO":
eq_mode = "reconnect";
break;
case "EQ_ORE_PROCESSOR":
eq_mode = "scan minerals";
break;
case "EQ_WPH_ASC_UPGRADE":
eq_mode = "delete selected";
break;
/* case "EQ_TELESCOPE": //.$Telescopeeq_MenuItem
var ws = worldScripts["telescope"];
var tm = ["Nearest target",
"Rescan",
"Step forward",
"Step back",
"Lightballs",
"Sniper ring",
"Steering",
"Targets",
"Visual target",
"Visual target size"];
eq_mode = tm[ws.???];
break; */
case "EQ_TOWBAR":
if(p.equipmentStatus("EQ_TOWBAR") === "EQUIPMENT_OK"){
var ws = worldScripts["towbar"];
switch( ws.$TowbarMiner ) {
case 0: eq_mode = "offline";
break;
case 1: eq_mode = "cargo only";
break;
case 2: eq_mode = "up to full";
break;
case 3: eq_mode = "salvager";
break;
default: eq_mode = "miner N/A";
}
}
break;
default: eq_mode = "N/A";
}
this._txtDial("VimanaEQMode",eq_mode);
}
//----------------------------------------------------------------------------------------
this._txtDial = function _vimanaHUD_txtDial(key,val,center) {
if(center) val = this._shiftTxt(val,22);
player.ship.setCustomHUDDial(key, val);
}
//----------------------------------------------------------------------------------------
this._shiftTxt = function _vimanaHUD_shiftTxt(text,length) {
var s = "";
var l = length - Math.round(text.length/2);
if(l<0)return text;
while(s.length < l){
s += " " ;
}
return s + text;
}
/**************************************
* right panel
* ************************************/
//Player ship shields and hull test animation
//----------------------------------------------------------------------------------------
this._animHull = function _vimanaHUD_animHull() {
var p = player.ship;
if(p.equipmentStatus("EQ_VIMANA_SHIP_MODULE") === "EQUIPMENT_OK"){
if(this.$HullAnim[0]){
if(this.$HullAnim[1] > 5) this.$HullAnim[1] = 0;
else this.$HullAnim[1]++;
if(this.$HullAnim[1] < 4) p.setCustomHUDDial("VimanaHullAnim",this.$HullAnim[0] + "_" + this.$HullAnim[1] + ".png");
else p.setCustomHUDDial("VimanaHullAnim","blank.png");
}
var wtp = Math.round(p.aftShield / p.maxAftShield*100);
var wtt = Math.round(p.forwardShield / p.maxForwardShield*100);
if(wtp > 75) p.setCustomHUDDial("VimanaTT","tt100.png");
else if(wtp>50 && wtp<76) p.setCustomHUDDial("VimanaTT","tt75.png");
else if(wtp>25 && wtp<51) p.setCustomHUDDial("VimanaTT","tt50.png");
else if(wtp>1 && wtp<26) p.setCustomHUDDial("VimanaTT","tt25.png");
else p.setCustomHUDDial("VimanaTT","blank.png");
if(wtt > 75) p.setCustomHUDDial("VimanaTP","tp100.png");
else if(wtt>50 && wtt<76) p.setCustomHUDDial("VimanaTP","tp75.png");
else if(wtt>25 && wtt<51) p.setCustomHUDDial("VimanaTP","tp50.png");
else if(wtt>1 && wtt<26) p.setCustomHUDDial("VimanaTP","tp25.png");
else p.setCustomHUDDial("VimanaTP","blank.png");
}else{
p.setCustomHUDDial("VimanaTT","blank.png");
p.setCustomHUDDial("VimanaTP","blank.png");
p.setCustomHUDDial("VimanaHullAnim","blank.png");
if(p.equipmentStatus("EQ_VIMANA_SHIP_MODULE") === "EQUIPMENT_UNAVAILABLE"){
this.$AnimTimer.stop();
delete this.$AnimTimer;
}
}
}
//----------------------------------------------------------------------------------------
this._eqipmentStatus = function _vimanaHUD_eqipmentStatus() { //check equip
this._txtDial("VimanaRh1","");
this._txtDial("VimanaRh2","");
var p = player.ship;
for(let i=0;i<10;i++){
this._txtDial("VimanaR" + i,"");
}
if(p.equipmentStatus("EQ_VIMANA_SHIP_MODULE") === "EQUIPMENT_OK"){
p.setCustomHUDDial("VimanaPSName",p.displayName);
if(this.$HullAnim[0]) var m = this.$HullAnim[0] + ".png";
else var m = "blank.png";
p.setCustomHUDDial("VimanaPShip",m);
if(this.$EqDmg.length){
/***********************
* equip damaged
* *********************/
var pd = Math.round((this.$EqDmg.length/p.equipment.length)*1000)/10;
this._txtDial("VimanaRh1","SHIP DAMAGED!");
this._txtDial("VimanaRh2",this.$EqDmg.length + " (" + pd + "%) system(s) broken"),true;
this._txtDial("VimanaR0","..:: CheckList ::..",true);
if (this.$SRS && this.$SRS.$controllerVersion && missionVariables.repairCounter > 0) {
if (this.$SRS.$selfRepairsSystemStatus === "Stand-by")
this.$SRS.checkEquipment();
}
}else{
/***********************
* no damage
* *********************/
this._txtDial("VimanaRh1","");
this._txtDial("VimanaRh2","");
if(this.$LastUsed[16] > 0){
this._txtDial("VimanaR8",this.$LastUsed[16] + " equipments & systems");
this._txtDial("VimanaR9","operational and efficient");
}else{
this._txtDial("VimanaR9"," No additional equipment!");
}
}
}else{
var tx = this._shiftTxt("UNAVAILABLE",18);
this._txtDial("VimanaR1",tx);
if(p.equipmentStatus("EQ_VIMANA_SHIP_MODULE") === "EQUIPMENT_DAMAGED") tx = this._shiftTxt("Module damaged",18);
else tx = this._shiftTxt("Module not installed",18)
this._txtDial("VimanaR2",tx);
p.setCustomHUDDial("VimanaPShip","blank.png");
}
}
/**************************************
* left panel
* ************************************/
//----------------------------------------------------------------------------------------
this._setLPanel = function _vimanaHUD_setLPanel() {
var p = player.ship;
for(let i=0;i<10;i++){
this._txtDial("VimanaL" + i,"") ;
}
if(p.target && p.target.isValid && !p.target.isWormhole) {
if(p.equipmentStatus("EQ_VIMANA_TARGET_MODULE") === "EQUIPMENT_OK"){
this._targetInfo();
}else{
p.setCustomHUDDial("VimanaPTarget","blank.png");
p.setCustomHUDDial("VimanaLh","");
var tx = "";
this._txtDial("VimanaL3","UNAVAILABLE",1);
if(p.equipmentStatus("EQ_VIMANA_TARGET_MODULE") === "EQUIPMENT_DAMAGED") tx = "Module damaged";
else tx = "Module not installed";
this._txtDial("VimanaL4",tx,1);
}
}else{ //travel info
if(this.$LastUsed[12] == 1){
this.$LastUsed[12] == 0;
this.$LastUsed[13] = "";
this._txtDial("VimanaLPTitle",".: TRAVEL INFO :.") ;
p.setCustomHUDDial("VimanaPTarget","globe.png");
this._txtDial("VimanaCEnergy","");
this._txtDial("VimanaCSpeed","");
this._txtDial("VimanaCMissile","");
if(p.equipmentStatus("EQ_VIMANA_TRAVEL_MODULE") === "EQUIPMENT_OK"){
this._travelInfo();
}else{
p.setCustomHUDDial("VimanaPTarget","blank.png");
p.setCustomHUDDial("VimanaLh","");
var tx = "";
this._txtDial("VimanaL3","UNAVAILABLE",1);
if(p.equipmentStatus("EQ_VIMANA_TRAVEL_MODULE") === "EQUIPMENT_DAMAGED") tx = "Module damaged";
else tx = "Module not installed";
this._txtDial("VimanaL4",tx,1);
}
}
}
}
//----------------------------------------------------------------------------------------
this._targetInfo = function _vimanaHUD_targetInfo() {
var p = player.ship;
var tdata = [];
var sep = " : ";
for(let i=0;i<10;i++){
tdata[i] = "";
}
this.$LastUsed[12] = 1;
tdata[0] = p.target.displayName;
if(p.target.dataKey == "telescopemarker"){
tdata[1] = "Additional info not available";
tdata[2] = this._shiftTxt("(Out of range)",16);
var itn = tdata[0].indexOf("km ");
if(itn > -1 && itn < 10) tdata[0] = tdata[0].substr(itn + 3);
if(this.$LastUsed[13] != tdata[0]){ //load target model only for telescope
this.$LastUsed[13] = tdata[0];
var m = null;
for(var i=0;i<this.$GameShips.length;i++){ //ship model
if(this.$GameShips[i].ship == tdata[0]){
m = this.$GameShips[i].file + ".png";
break;
}
}
if(m) var model = m; else var model = "blank.png";
p.setCustomHUDDial("VimanaPTarget",model);
}
}else if(p.target.isBoulder || p.target.isRock && !p.target.isPiloted){
tdata[1] = this._shiftTxt("SPEED",9) + sep + Math.round(p.target.velocity.magnitude()/10)*10 + "m/s";
tdata[2] = this._shiftTxt("BOUNTY",6) + sep + p.target.bounty + "€";
}else if(p.target.isMissile){
tdata[1] = this._shiftTxt("SPEED",9) + sep + Math.round(p.target.velocity.magnitude()/10)*10;
tdata[2] = this._shiftTxt("ENERGY",7) + sep + Math.round(p.target.energy);
tdata[4] = this._shiftTxt("TRAVELED",4) + sep + Math.round(p.target.distanceTravelled) + " m";
}else if(p.target.isStation){
tdata[3] = this._shiftTxt("RADIUS",9) + sep + Math.round(p.target.collisionRadius) + " m";
tdata[4] = this._shiftTxt("ENERGY",8) + sep + Math.round(p.target.energy);
tdata[6] = this._shiftTxt("DEFENDERS",1) + sep + p.target.dockedPolice;
if (p.target.requiresDockingClearance){
tdata[1] = this._shiftTxt("DOCK",11) + sep + "REQUEST";
switch (player.dockingClearanceStatus) {
case "DOCKING_CLEARANCE_STATUS_REQUESTED":
tdata[1] = this._shiftTxt("DOCK",11) + sep + "HOLD";
break;
case "DOCKING_CLEARANCE_STATUS_GRANTED":
tdata[1] = this._shiftTxt("DOCK",11) + sep + "GRANTED";
break;
case "DOCKING_CLEARANCE_STATUS_TIMING_OUT":
tdata[1] = this._shiftTxt("DOCK",11) + sep + "EXPIRING";
}
}else{
tdata[1] = this._shiftTxt("DOCK",11) + sep + "FREE";
}
}else if(p.target.isDerelict){
tdata[2] = this._shiftTxt("ENERGY",7) + sep + Math.round(p.target.energy);
tdata[4] = this._shiftTxt("CARGO",8) + sep + p.target.cargoSpaceUsed + "/" + p.target.cargoSpaceCapacity + "t";
}else if(p.target.isShip && p.target.isPiloted || p.target.isThargoid){
tdata[1] = this._shiftTxt("SPEED",9) + sep + Math.round(p.target.velocity.magnitude()/10)*10 + "m/s";
tdata[2] = this._shiftTxt("ENERGY",7) + sep + Math.round(p.target.energy);
if(!p.target.currentWeapon){
tdata[5] = this._shiftTxt("WEAPON",5) + sep + "none";
}else if(p.target.currentWeapon.name == "Remove Laser"){
tdata[5] = this._shiftTxt("WEAPON",5) + sep + "unknown";
}else{
tdata[5] = this._shiftTxt("WEAPON",5) + sep + p.target.currentWeapon.name;
}
tdata[6] = this._shiftTxt("RANGE",8) + sep + Math.round(p.target.weaponRange/100)/10 + "km";
var mc = 0;
var hmc = 0;
var msc = "";
for(let i = 0; i < p.target.missiles.length; i++ ) {
let mst = p.target.missiles[i].equipmentKey;
if( mst == "EQ_MISSILE" || mst == "EQ_ARMOURY_STANDARD_MISSILE") mc++ ;
else hmc++;
}
if(hmc > 0 && mc > 0)msc = hmc + "h/" + mc + "s";
else if(hmc > 0)msc = hmc + "h";
else if(mc > 0)msc = mc + "s";
else msc = "0";
tdata[4] = this._shiftTxt("MISSILE",8) + sep + msc;
tdata[7] = this._shiftTxt("CARGO",8) + sep + p.target.cargoSpaceUsed + "/" + p.target.cargoSpaceCapacity + "t";
tdata[9] = this._shiftTxt("BOUNTY",6) + sep + p.target.bounty + "€";
if(player.alertCondition == 3){
this._txtDial("VimanaCEnergy","E: " + Math.round(p.target.energy));
this._txtDial("VimanaCSpeed","V: " + Math.round(p.target.velocity.magnitude()/10)*10);
this._txtDial("VimanaCMissile","M: " + msc);
}
}else if(p.target.isCargo){
tdata[0] = p.target.name;
tdata[1] = p.target.shipUniqueName;
if(tdata[1].indexOf("Gold") > -1 || tdata[1].indexOf("Platinum") > -1) var unit = "kg";
else if(tdata[1].indexOf("Gem-Stones") > -1) var unit = "g";
else var unit = "t";
tdata[2] = this._shiftTxt("AMOUNT",5) + sep + p.target.commodityAmount + unit;
tdata[3] = this._shiftTxt("SPEED",9) + sep + Math.round(p.target.velocity.magnitude()/10)*10 + "m/s";
}else if(p.target.isBeacon){
if(p.target.name) tdata[0] = p.target.name;
else if(p.target.beaconLabel) tdata[0] = p.target.beaconLabel;
else if(p.target.beaconCode) tdata[0] = p.target.beaconCode;
else tdata[0] = "Unidentified";
tdata[2] = this._shiftTxt("ENERGY",7) + sep + Math.round(p.target.energy);
tdata[3] = this._shiftTxt("RADIUS",7) + sep + Math.round(p.target.collisionRadius) + " m";
}
//--------------
this._txtDial("VimanaLh",tdata[0],true) ;
this._txtDial("VimanaL0","") ;
for(let i=1;i<10;i++){
this._txtDial("VimanaL" + i," " + tdata[i]) ;
}
}
//----------------------------------------------------------------------------------------
this._travelInfo = function _vimanaHUD_travelInfo() {
var p = player.ship;
var dest = "Destination not set " ;
this.$ReqFuel = 0;
var ddist = "";
var nlabel = "";
for(let i=3;i<10;i++){
this._txtDial("VimanaL" + i,"");
}
function spacer(l,txt){
l -= txt.length;
for(let i=0;i<l;i++){
txt = " " + txt;
}
return txt;
}
function addzero(v){
if(v.indexOf(".") == -1) v += ".0";
return v;
}
if(system.isInterstellarSpace){
dest = "Interstellar Space! " ;
ddist = "Route calculation not possible";
nlabel = "";
}else if(system.ID != p.targetSystem){
var fullRoute = system.info.routeToSystem(System.infoForSystem(system.info.galaxyID, p.targetSystem),p.routeMode);
var tsys = System.infoForSystem(system.info.galaxyID, p.targetSystem);
dest = tsys.name + " " + "(" + (tsys.techlevel + 1) + ") " + this.$ecos[tsys.economy] + this.$govs[tsys.government];
let dday = Math.floor(fullRoute.time/24);
let dhour = Math.floor(fullRoute.time % 24);
let dmin = Math.floor(fullRoute.time % 60);
let tx = Math.floor(fullRoute.distance*10)/10;
let hp = fullRoute.route.length - 1;
ddist = "(" + addzero(tx.toString()) + "ly, " + dday + "d:" + dhour + "h:" + dmin + "m, " + "jmp: " + hp + ")";
if(fullRoute.route.length > 0){
if(fullRoute.route.length > 8)var nxr = 8;
else var nxr = fullRoute.route.length;
if(p.routeMode === "OPTIMIZED_BY_NONE" && fullRoute.route.length > 2){
this._txtDial("VimanaL4","Unknown route! ");
}else{
for(let i=1;i < nxr;i++){
let a = i + 2;
let b = System.infoForSystem(system.info.galaxyID, fullRoute.route[i]);
let c = system.info.routeToSystem(System.infoForSystem(system.info.galaxyID, fullRoute.route[i]),p.routeMode);
let tx = Math.floor(c.distance*10)/10;
if(i == 1) this.$ReqFuel = tx;
let d = spacer(5,addzero(tx.toString())) + "ly " + b.name + " (" + (b.techlevel + 1) + ") " + this.$ecos[b.economy] + this.$govs[b.government];
this._txtDial("VimanaL" + a, d);
}
}
nlabel = this._shiftTxt("...: NEXT HOPS :...",22);
}
}
this._txtDial("VimanaLh",dest);
this._txtDial("VimanaL0", ddist);
this._txtDial("VimanaL1", "");
this._txtDial("VimanaL2",nlabel);
}
//----------------------------------------------------------------------------------------
this._checkMaint = function _vimanaHUD_checkMaint() {
var p = player.ship;
if(p.serviceLevel< 85){
this.$Maitenance = true;
}else{
this.$Maitenance = false;
p.setCustomHUDDial("VimanaService","blank.png");
}
}
/***********************************
* indicators
***********************************/
//----------------------------------------------------------------------------------------
this._showIndicators = function _vimanaHUD_showIndicators() {
var p = player.ship;
var efl = 0 //extra fuel
var speed = Math.round(p.velocity.magnitude()/10)*10;
var ctemp = Math.round(p.temperature * 100);
var fuel = (p.fuel).toFixed(1);
var tds = " * * *";
if(p.target && p.target.isValid && !p.target.isWormhole) { //calculate & display distance to player target
var trg = p.target;
if(p.target.dataKey == "telescopemarker")
if(this.$TLS.$TelescopeList[this.$TLS.$TelescopeListi-1]) trg = this.$TLS.$TelescopeList[this.$TLS.$TelescopeListi-1];
if(trg.position){
var td = trg.position.distanceTo(p.position) - Math.round(trg.collisionRadius);
if(td >100000) td = Math.round(td/1000);
else td = Math.round(td/10)/100;
tds = td.toString();
var z = "";
if(td <100){
if(tds.indexOf(".") == -1) z = ".00";
else if(tds.length - tds.indexOf(".") < 3) z = "0";
}
tds += z;
}
}else{
var sec = "" + Math.floor(clock.seconds%60); //display clock
if(sec.length<2)sec = "0" + sec;
var min = "" + Math.floor(clock.minutes%60);
if(min.length<2)min = "0" + min;
this._txtDial("VimanaSClock",Math.floor(clock.hours % 24) + ":" + min + ":" + sec + " - " + clock.days);
}
this._txtDial("VimanaTDist",tds, true);
//DuplexFuelTank.oxz
if( p.equipmentStatus("EQ_DUPLEX_FUEL_TANK_STATE_1") == "EQUIPMENT_OK" ) efl += 1;
else if( p.equipmentStatus("EQ_DUPLEX_FUEL_TANK_STATE_2") == "EQUIPMENT_OK" ) efl += 2;
else if( p.equipmentStatus("EQ_DUPLEX_FUEL_TANK_STATE_3") == "EQUIPMENT_OK" ) efl += 3;
//ExtraFuelTanks
if( p.equipmentStatus("EQ_RESERVE_TANK") == "EQUIPMENT_OK" ) efl += 1;
else if( p.equipmentStatus("EQ_AUX_TANK") == "EQUIPMENT_OK" ) efl += 3;
//Fuel_Tank
if( p.equipmentStatus("EQ_FUELTANK_MINE") == "EQUIPMENT_OK" ) {
for( var i = 0; i < p.missiles.length; i++ ) {
if( p.missiles[i].equipmentKey == "EQ_FUELTANK_MINE" ) efl += 3;
}
}
// altitude calculation
if(system.isInterstellarSpace){
var alt = 99999;
}else{
var ss = system.sun;
var alt = 0;
var sp = system.planets;
var len = sp.length;
if(ss) var d = p.position.distanceTo( ss.position );
else var d = 100000000000000000000.0;
for( var i = 0; i < len; i++ ) { //find the smallest distance
var s = p.position.distanceTo(sp[i].position )-sp[i].radius
if(d > s) {
d = s;
ss = sp[i];
}
}
var u = "";
alt = p.position.distanceTo(ss) - ss.radius - p.collisionRadius;
if(this.$LastUsed[11] != alt){
if(alt<1000){
u = "0.";
var a = alt;
}else{
var a = Math.round(alt/1000);
}
this._setGauge("VimanaAltG",alt,50000,11,"lp");
this._txtDial("VimanaAlt",u + Math.round(a)) ;
}
}
if(this.$LastUsed[0] != ctemp){ //cabin temperature
this._txtDial("VimanaCTemp",ctemp + "°");
this._setGauge("VimanaCTempG",ctemp,100,0,"ln");
}
if(this.$LastUsed[1] != speed){ //speed
this._txtDial("VimanaSpeed",speed);
if(speed>p.maxSpeed)this._setGauge("VimanaSpeedG",speed,p.maxSpeed,1,"ln");
else this._setGauge("VimanaSpeedG",speed,p.maxSpeed,1,"lp");
}
if(this.$LastUsed[2] != fuel || this.$LastUsed[3] != efl){ //fuel
var ef = "";
if(efl)ef = "+" + Math.round(efl);
this._txtDial("VimanaFuel",fuel + ef);
this._setGauge("VimanaFuelG",fuel,7,2,"lp");
this.$LastUsed[3] = efl;
this.$LastUsed[2] = fuel;
}
if(this.$LastUsed[15] != this.$ReqFuel){ //required fuel
var a = Math.round(this.$ReqFuel/(7/15));
player.ship.setCustomHUDDial("VimanaFuelR","fr" + a + ".png");
this.$LastUsed[15] = this.$ReqFuel;
}
if(this.$LastUsed[4] != p.cargoSpaceUsed || this.$LastUsed[5] != p.cargoSpaceCapacity){ //cargo
this._txtDial("VimanaCargo",p.cargoSpaceUsed + "/" + p.cargoSpaceCapacity);
this.$LastUsed[5] = p.cargoSpaceCapacity;
if(p.cargoSpaceCapacity == 0) this._setGauge("VimanaCargoG",1,1,4,"ln");
else this._setGauge("VimanaCargoG",p.cargoSpaceUsed,p.cargoSpaceCapacity,4,"ln");
}
if(this.$LastUsed[6] != p.energy){ //energy
this._txtDial("VimanaEnergy",Math.round(p.energy));
this._setGauge("VimanaEnergyG",p.energy,p.maxEnergy,6,"pp");
}
if(this.$LastUsed[7] != p.aftShield){
var wtp = Math.round(p.aftShield / p.maxAftShield*100);
this._txtDial("VimanaAsh",wtp + "%");
this._setGauge("VimanaAshG",p.aftShield,p.maxAftShield,7,"pp");
}
if(this.$LastUsed[8] != p.forwardShield){
var wtt = Math.round(p.forwardShield / p.maxForwardShield*100);
this._txtDial("VimanaFsh",wtt + "%");
this._setGauge("VimanaFshG",p.forwardShield,p.maxForwardShield,8,"pp");
}
this._txtDial("VimanaLaserName",p.currentWeapon.name) ;
if(this.$LastUsed[9] != p.laserHeatLevel){
this._txtDial("VimanaLaserTemp",Math.round(p.laserHeatLevel * 1190) + "°");
this._setGauge("VimanaLaserTempG",p.laserHeatLevel,0.85,9,"pn");
}
if(this.$LastUsed[10] != missionVariables.ironHide_percentage){
this._txtDial("VimanaArmour",missionVariables.ironHide_percentage + "%");
this._setGauge("VimanaArmourG",missionVariables.ironHide_percentage,100,10,"pp");
}
}
//----------------------------------------------------------------------------------------
this._setGauge = function _vimanaHUD_setGauge(key,cur,max,i,pos) {
//set gauge speed, ctemp, alt, shield, etc
var a = max/15;
this.$LastUsed[i] = cur;
if(cur > max) cur = max;
a = Math.round(cur/a);
player.ship.setCustomHUDDial(key,a + "_" + pos + ".png");
}
|