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

Expansion Police IFF Scanner

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description An upgrade to the IFF Scanner System to show ships with offender or fugitive status in alternative scanner colours. An upgrade to the IFF Scanner System to show ships with offender or fugitive status in alternative scanner colours.
Identifier oolite.oxp.CaptMurphy.PoliceIFFScanner oolite.oxp.CaptMurphy.PoliceIFFScanner
Title Police IFF Scanner Police IFF Scanner
Category Equipment Equipment
Author Capt. Murphy Capt. Murphy
Version 1.3.1 1.3.1
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Police_IFF_Scanner_Upgrade n/a
Download URL https://wiki.alioth.net/img_auth.php/9/96/Police_IFF_Scanner.oxz n/a
License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
File Size n/a
Upload date 1610873377

Documentation

Also read http://wiki.alioth.net/index.php/Police%20IFF%20Scanner

readme.rtf

{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang2057\deflangfe2057{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f36\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f37\froman\fcharset238\fprq2 Times New Roman CE;}
{\f38\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}{\f41\froman\fcharset162\fprq2 Times New Roman Tur;}{\f42\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
{\f43\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f45\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f397\fswiss\fcharset238\fprq2 Tahoma CE;}
{\f398\fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f400\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f401\fswiss\fcharset162\fprq2 Tahoma Tur;}{\f402\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f403\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);}
{\f404\fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f405\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f406\fswiss\fcharset222\fprq2 Tahoma (Thai);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;
\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \snext0 Normal;}{\*\cs10 
\additive \ssemihidden Default Paragraph Font;}{\*
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \af0\afs16 
\ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \styrsid11034898 annotation reference;}{\s16\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 
\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext16 \ssemihidden \styrsid11034898 annotation text;}{\s17\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 
\ltrch\fcs0 \b\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon16 \snext16 \ssemihidden \styrsid11034898 annotation subject;}{\s18\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 
\af36\afs16\alang1025 \ltrch\fcs0 \f36\fs16\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext18 \ssemihidden \styrsid11034898 Balloon Text;}{\*\cs19 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \styrsid6977686 Hyperlink;}}
{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid482292\rsid617230\rsid945440\rsid2117399\rsid3362386\rsid4136354\rsid5178355\rsid5647503\rsid6752516\rsid6977686\rsid7300156\rsid8531776\rsid8534657\rsid8722828\rsid8740882\rsid9380248
\rsid10437290\rsid10964090\rsid11034898\rsid11675904\rsid11808611\rsid11873217\rsid12530637\rsid13002505\rsid14186319\rsid14295430\rsid15605813\rsid16087615\rsid16544959}{\*\generator Microsoft Word 11.0.0000;}{\info
{\title Police IFF Scanner Upgrade (19/6/11)}{\operator Murphy}{\creatim\yr2011\mo6\dy19\hr4\min49}{\revtim\yr2011\mo12\dy18\hr10\min21}{\version8}{\edmins39}{\nofpages2}{\nofwords354}{\nofchars2018}{\nofcharsws2368}{\vern24615}{\*\password 00000000}}
{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect 
\widowctrl\ftnbj\aenddoc\donotembedsysfont0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3
\jcompress\viewkind4\viewscale100\rsidroot5647503 \fet0{\*\wgrffmtfilter 013f}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2
\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6
\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang 
{\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid6977686 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {
\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6977686 Police IFF Scanner Upgrade 1.3}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid4136354 .1}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6977686  (}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid4136354 18/12}{\rtlch\fcs1 \af0 
\ltrch\fcs0 \insrsid6977686 /11)\line By Capt Murphy 2011\line Licence: CC BY-NC-SA 3.0 : Please visit }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6977686  HYPERLINK "http://creativecommons.org/licenses/by-nc-sa/3.0/" }{\rtlch\fcs1 
\af0 \ltrch\fcs0 \insrsid4136354 {\*\datafield 
00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b7c00000068007400740070003a002f002f006300720065006100740069007600650063006f006d006d006f006e0073002e006f00720067002f006c006900630065006e007300650073002f00620079002d006e006300
2d00730061002f0033002e0030002f000000795881f43b1d7f48af2c825dc485276300000000a5ab0000}}}{\fldrslt {\rtlch\fcs1 \af0 \ltrch\fcs0 \cs19\ul\cf2\insrsid6977686 http://creativecommons.org/licenses/by-nc-sa/3.0/}}}\sectd \linex0\sectdefaultcl\sftnbj {
\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6977686  for more info.\line Requires Oolite 1.75.2\line \line Overview: \line \line Upgrade to the IFF (lollipop) scanner system which highlights ships with an offender or fugitive legal status with custom \lquote 
lollipop\rquote  colours to allow rapid visual identification of criminals via the scanner.\line \line Description:\line \line In a bid to raise fun
ds to replace their ageing Viper fleet, and in recognition of the lack of control they are exhibiting over many of the space lanes, Galcop have licensed a civilian version of the IFF scanner unit used in Police ships to quickly identify criminals in fligh
t. \line \line 
Welcomed by both Bounty Hunters wanting that extra few seconds advantage in identifying targets and nervous traders wanting an extra few seconds to avoid potentially hostile pirates the unit is available from Tech Level 12 or above planets for the prin
cely sum of 2500 credits. It can also be resold for 60% refund of normal sale price at Tech level 12 or above. There is a 10 credit admin fee to sell the equipment.\line \line 
The unit complements the Bounty Scanner equipment and has also been designed to work well with the Target Autolock Plus equipment. It is particularly useful when players run into an ongoing furball to quickly work out who the \lquote bad\rquote  guys are.
\line \line Once installed ships (excluding Thargoids) with an offender status are displayed on the scanner as flashing yellow/orange \lquote lollipops\rquote , whilst fugitives are displayed as flashing }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid4136354 o
ange}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6977686 /magenta \lquote lollipops\rquote , instead of the default yellow. If targeting and hostile to the player both offender and fugitive ships turn deep red on the scanner.\line \line Change Log:\line \line 
Version 1: 19/6/11 \endash  Initial release.\line \line Version 1.1: 21/6/11 \endash  Bug fix to the timer mechanism that updates the scanner to avoid log warning messages.\line \line 
Version 1.2: 25/6/11 - Fixed a 'silent' bug in timer mechanism. Added code to stop Timer on ship death.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid16544959 
\par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6977686 
\par Version 1.3: 24/9/11 \endash  Added code to script so that scanner colours are always reset properly if the Police Scanner is damaged in combat.
\par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid4136354 
\par Version 1.3.1 18/12/11 \endash  Minor update. Code is now compliant with JavaScript strict mode. Fugitives now have orange/magenta lollipop colours to differentiate them slightly from hired guns.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 
\insrsid4136354\charrsid6977686 
\par }}

Equipment

Name Visible Cost [deci-credits] Tech-Level
Police IFF Scanner Upgrade yes 25000 12+
Sell Police IFF Scanner Upgrade yes 100 12+

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Config/script.js
"use strict";
this.name        = "Police_Scanner_Upgrade"; 
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 = "Upgrade to the IFF Scanner System. Shows ships with offender or fugitive status in different scanner colours"; 
this.version     = "1.3.1";

// event handler driven function to allow scanner to be resold.
this.playerBoughtEquipment = function(equipmentKey)
{
	if(equipmentKey === "EQ_POLICE_SCANNER_UPGRADE_REMOVAL")
		{
			player.ship.removeEquipment("EQ_POLICE_SCANNER_UPGRADE");
			player.ship.removeEquipment("EQ_POLICE_SCANNER_UPGRADE_REMOVAL");
			player.credits += (EquipmentInfo.infoForKey("EQ_POLICE_SCANNER_UPGRADE").price * 0.1 * 0.6);
		}
}
// event handler driven function which starts a timer when player is in yellow or red alert.
this.alertConditionChanged = function(newAlert, oldAlert)
{
	if (player.ship.equipmentStatus("EQ_POLICE_SCANNER_UPGRADE") !== "EQUIPMENT_OK" && player.ship.equipmentStatus("EQ_POLICE_SCANNER_UPGRADE") !== "EQUIPMENT_DAMAGED")
	{return;} // still run timer when equipment damaged in case fixed on the fly.
	switch (newAlert)
	{
		case 0 || 1:
		{
		if (this.psu_updatescannerTimer && this.psu_updatescannerTimer.isRunning)
		{
			this.psu_updatescannerTimer.stop();
		}
		}
		break;
		case 2 || 3:
		{
		if (!this.psu_updatescannerTimer)
		{
			this.psu_updatescannerTimer = new Timer(this, this.psu_updatescanner, 0, 0.25);
		}
		else
		{
			this.psu_updatescannerTimer.start();
		}
		}
	}
}
// caller by timer every 0.25 seconds when player is on yellow or red alert to identify ships within scanner range with a bounty and apply custom scanner colours depending on whether they are currently hostile to player or not.
this.psu_updatescanner = function()
{	var counter;
	var arrayLength;
	if (player.ship.equipmentStatus("EQ_POLICE_SCANNER_UPGRADE") !== "EQUIPMENT_OK")
	{return;} // scanner not updated when equipment damaged.
	if (worldScripts["targetAutolock"] && missionVariables.targetAutolock === "TRUE")
	{this.psu_targetAutolockupdatescanner();} // calls alternative function when Target Autolock is installed and active.
	else
	{
	var targets = system.filteredEntities(this, function (entity){return (entity.scanClass === "CLASS_NEUTRAL" && entity.bounty !== 0)}, player.ship, player.ship.scannerRange); 
	if (targets.length > 0)
	{
	arrayLength = targets.length; // caching the length here makes the loop run a smidgen faster.
	for (counter = 0; counter < arrayLength;counter++)
	{
		if (targets[counter].hasHostileTarget && targets[counter].target === player.ship && player.alertHostiles)
		{
			this.psu_hostilecustomscannercolours (targets[counter]);
		}
		else
		{
			this.psu_assigncustomscannercolours (targets[counter]);
		}
	}
	}
	}
}
// Alternative function to assign custom scanner colours when Target Autolock is installed and active. Does not apply custom colours to the players current target so as not to conflict with Target Autolock OXP.
this.psu_targetAutolockupdatescanner = function()
{
	var counter;
	var arrayLength;
	var targets = system.filteredEntities(this, function (entity){return (entity.scanClass === "CLASS_NEUTRAL" && entity.bounty !== 0)}, player.ship, player.ship.scannerRange);
	if (targets.length > 0)
	{
	arrayLength = targets.length; // caching the length here makes the loop run a smidgen faster.
	for (counter = 0; counter < arrayLength ;counter++)
	{
		if (targets[counter].hasHostileTarget && targets[counter].target === player.ship && player.ship.target !== targets[counter] && player.alertHostiles)
		{
			this.psu_hostilecustomscannercolours (targets[counter]);
		}
		else if (player.ship.target !== targets[counter])
		{
			this.psu_assigncustomscannercolours (targets[counter]);
		}
	}
	}
}
// Assigns custom colours to ships with a bounty.
this.psu_assigncustomscannercolours = function (target)
{
	if (target.bounty > 50)
		{
			target.scannerDisplayColor1 = "orangeColor";
			target.scannerDisplayColor2 = "magentaColor";
		}
		else
		{
			target.scannerDisplayColor1 = "yellowColor";
			target.scannerDisplayColor2 = "orangeColor";
		}
}
// Assigns red colour to ships with a bounty who are targeting and hostile to player.
this.psu_hostilecustomscannercolours = function (target)
{
	target.scannerDisplayColor1 = "redColor";
	target.scannerDisplayColor2 = null;
}
// Event handler driven function to stop timer if player dies.
this.shipDied = function()
{
	if (this.psu_updatescannerTimer && this.psu_updatescannerTimer.isRunning)
		{
			this.psu_updatescannerTimer.stop();
		}
}
// Event handler driven functions to clear custom scanner colours in event of equipment damaged.
this.equipmentDamaged = function(equipment)
{
    var counter;
	var arrayLength;
	if (equipment === "EQ_POLICE_SCANNER_UPGRADE")
	{
		player.consoleMessage("Police IFF Scanner Upgrade is Damaged!");
		if (worldScripts["targetAutolock"] && missionVariables.targetAutolock === "TRUE")
		{this.psu_targetAutolockRemoveCustomColours();} // calls alternative function when Target Autolock is installed and active.
		else
		{
		var targets = system.filteredEntities(this, function (entity){return (entity.scanClass === "CLASS_NEUTRAL" && entity.bounty !== 0)});
		if (targets.length > 0)
		{
		arrayLength = targets.length; // caching the length here makes the loop run a smidgen faster.
		for (counter = 0; counter < arrayLength;counter++)
		{
		targets[counter].scannerDisplayColor1 = null;
		targets[counter].scannerDisplayColor2 = null;
		}
		}
		}
	}
}

this.psu_targetAutolockRemoveCustomColours = function()
{
    var counter;
	var arrayLength;
	var targets = system.filteredEntities(this, function (entity){return (entity.scanClass === "CLASS_NEUTRAL" && entity.bounty != 0)});
	if (targets.length > 0)
	{
	arrayLength = targets.length; // caching the length here makes the loop run a smidgen faster.
	var playerTarget = player.ship.target; // caching the player target here makes the loop run a smidgen faster.
	for (counter = 0; counter < arrayLength;counter++)
	{
		if (playerTarget !== targets[counter])
		{
			targets[counter].scannerDisplayColor1 = null;
			targets[counter].scannerDisplayColor2 = null;
		}
	}
	}
}