Back to Index Page generated: May 8, 2024, 6:16:03 AM

Expansion Breakable HUD and IFF Scanner

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description This OXP makes the HUD and Scanner into equipment that can be damaged in combat. This OXP makes the HUD and Scanner into equipment that can be damaged in combat.
Identifier oolite.oxp.CaptMurphy.BreakableHUDIFFScanner oolite.oxp.CaptMurphy.BreakableHUDIFFScanner
Title Breakable HUD and IFF Scanner Breakable HUD and IFF Scanner
Category Equipment Equipment
Author Capt Murphy Capt Murphy
Version 1.2 1.2
Tags Equipment Equipment
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Breakable_%27Standard%27_Equipment_OXPs n/a
Download URL https://wiki.alioth.net/img_auth.php/3/3d/Oolite.oxp.CaptMurphy.BreakableHUDIFFScanner.oxz n/a
License CC BY-NC-SA 3.0 CC BY-NC-SA 3.0
File Size n/a
Upload date 1610873279

Documentation

Also read http://wiki.alioth.net/index.php/Breakable%20HUD%20and%20IFF%20Scanner

readme.rtf

{\rtf1\ansi\ansicpg1252\deff0\deflang2057\deflangfe2057{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}}
{\colortbl ;\red0\green0\blue255;}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\nowidctlpar\f0\fs20 Breakable HUD/IFF Scanner 1.2 (05/05/11)\par
By Capt Murphy 2011\par
Licence: CC BY-NC-SA 3.0 : Please visit {\field{\*\fldinst{HYPERLINK "http://creativecommons.org/licenses/by-nc-sa/3.0/"}}{\fldrslt{\ul\cf1 http://creativecommons.org/licenses/by-nc-sa/3.0/}}}\f0\fs20  for more info.\par
Requires Oolite 1.76\par
\par
Overview: \par
\par
An OXP intended for the experienced Commander who wishes to make their Oolife a little more difficult. This OXP makes the HUD and Scanner into equipment that can be damaged in combat. If damaged the HUD flickers on and off at random until repaired. This is very standard technology and repair costs are low at 125 credits and can be conducted at any Tech Level. This equipment can also be repaired by other mechanisms such as Thargoid\rquote s Repair Bots.\par
\par
Technical:\par
\par
This OXP creates a new equipment item \ldblquote Standard HUD/IFF Scanner\rdblquote , which is listed on the equipment manifest and can be damaged in combat. It automatically fits the equipment to the current ship on first run, and is automatically fitted when player purchases a new ship. If damaged the script simulates a damaged HUD/IFF scanner using Timers and the player.ship.hudHidden object.\par
\par
Should be compatible with all OXP HUDS, although the affect might be a bit strange for HUDs that include cockpit graphics.\par
\par
ChangeLog: \par
\par
Version 1  \tab 25/6/11 \endash  Initial release.\par
Version 1.1       10/7/11 \endash  Minor bugfix \endash  if repaired on the fly by Repair Bots or similar HUD could sometimes remain invisible. Reduced repair costs.\par
Version 1.2       05/5/12 - Minor update for compatibility with Ship_Storage_Helper.oxp\par
\par
\par
Tested and built using Oolite 1.76\par
}

Equipment

Name Visible Cost [deci-credits] Tech-Level
HUD & IFF Scanner yes 2500 1+

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Scripts/Breakable_HUD_IFF_Scanner.js
this.name        = "Breakable_HUD_IFF_Scanner"; 
this.author      = "capt murphy"; 
this.copyright   = "2011 capt murphy";
this.licence     = "CC BY-NC-SA 3.0"; // see http://creativecommons.org/licenses/by-nc-sa/3.0/ for more info.
this.description = "Script to simulate combat damage to the HUD/IFF Scanner."; 
this.version     = "1.2";

// event handler driven function for functions at startup - awards equipment to existing ship if first run with OXP.
this.startUp = function()
{
	this.bis_warning = new SoundSource;
	this.bis_warning.sound = "warning.ogg";
	if (!missionVariables.bis_scannerstatus)
	{
		missionVariables.bis_scannerstatus = "OK";
	}
	this.bis_scannerstatus = missionVariables.bis_scannerstatus;
	if (player.ship.equipmentStatus("EQ_BREAKABLE_HUD_IFF_SCANNER") != "EQUIPMENT_OK" && this.bis_scannerstatus == "OK")
	{
		player.ship.awardEquipment("EQ_BREAKABLE_HUD_IFF_SCANNER");	
	}
		
}

// event handler driven function to fit equipment to newly purchased ship.
this.playerBoughtNewShip = function()
{
	player.ship.awardEquipment("EQ_BREAKABLE_HUD_IFF_SCANNER");
	this.bis_scannerstatus = "OK";
}

// event handler driven function to control actions if equipment damaged in combat.
this.equipmentDamaged = this.equipmentDestroyed = function(equipment)
{
	if (this.shipRestore && equipment === "EQ_BREAKABLE_HUD_IFF_SCANNER") {this.bis_scannerstatus = "DAMAGED"; return;}
	if (equipment == "EQ_BREAKABLE_HUD_IFF_SCANNER")
	{
		this.bis_scannerstatus = "DAMAGED";
		this.bis_setuptimer();
	}
}
	
	
// event handler driven function for actions on launching and exiting witchspace.
this.shipLaunchedFromStation = this.shipExitedWitchspace = function()
{
	if (player.ship.equipmentStatus("EQ_BREAKABLE_HUD_IFF_SCANNER") == "EQUIPMENT_OK" && this.bis_scannerstatus != "OK")
	{
		this.bis_resetscanner();	
	}
	if (this.bis_scannerstatus != "OK")
	{
		this.bis_setuptimer();
	}
}
// event handler driven function to stop timer on docking or on player death.
this.shipWillDockWithStation = this.shipDied = function()
{
	if (this.bis_updatescannerTimer && this.bis_updatescannerTimer.isRunning)
		{
			this.bis_updatescannerTimer.stop();
			delete this.bis_updatescannerTimer;
			player.ship.hudHidden = null;
		}
	if (this.bis_warningTimer && this.bis_warningTimer.isRunning)
		{
			this.bis_warningTimer.stop();
			delete this.bis_warningTimer;
		}
}

// event handler driven function for actions on save game.
this.playerWillSaveGame = function()
{
	missionVariables.bis_scannerstatus = this.bis_scannerstatus;
}

// creates timers if not already in existance otherwise restarts existing timers.
this.bis_setuptimer = function()
{
	if (!this.bis_updatescannerTimer)
		{
			this.bis_updatescannerTimer = new Timer(this, this.bis_updatescanner, 0, 0.25);
		}
		else
		{
			this.bis_updatescannerTimer.start();
		}
	if (!this.bis_warningTimer)
		{
			this.bis_warningTimer = new Timer(this,this.bis_warningsound,0,10);
		}
		else
		{
			this.bis_warningTimer.start();
		}
}

// called by timer every 0.25 seconds when player is in flight to hide the HUD to simulate HUD/scanner damage.
this.bis_updatescanner = function()
{	
	if (player.ship.equipmentStatus("EQ_BREAKABLE_HUD_IFF_SCANNER") == "EQUIPMENT_OK") // check to see if something has repaired the scanner on the fly e.g. Thargoid's Repair Bots OXP.
	{
		this.bis_resetscanner();
		return;
	}
	if (Math.random() < 0.66)
	{
	   player.ship.hudHidden = "True";
	}
	else
	{
		player.ship.hudHidden = null;
			
	}
}

// called by timer every 10 seconds when player in flight to give warning noise whilst HUD/Scanner is damaged.
this.bis_warningsound = function()
{
	this.bis_warning.play(1);
	player.consoleMessage("HUD and IFF Scanner Damaged!", 2);
}

// function to reset the scanner.
this.bis_resetscanner = function()
{
	this.bis_scannerstatus = "OK";
	if (this.bis_updatescannerTimer && this.bis_updatescannerTimer.isRunning)
		{
			this.bis_updatescannerTimer.stop();
			delete this.bis_updatescannerTimer;
		}
	player.ship.hudHidden = null;
	if (this.bis_warningTimer && this.bis_warningTimer.isRunning)
		{
			this.bis_warningTimer.stop();
			delete this.bis_warningTimer;
		}
}