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

Expansion Auto S.O.S.

Content

Warnings

  1. http://wiki.alioth.net/index.php/Auto%20S.O.S. -> 404 Not Found
  2. Information URL mismatch between OXP Manifest and Expansion Manager string length at character position 0

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description This simple transponder will automatically broadcast an S.O.S. distress signal when your ship comes under direct attack or Red Alert condition - and... 'S.O.S.' does mean *help*, doesn't it? This simple transponder will automatically broadcast an S.O.S. distress signal when your ship comes under direct attack or Red Alert condition - and... 'S.O.S.' does mean *help*, doesn't it?
Identifier oolite.oxp.Reval.Auto_SOS oolite.oxp.Reval.Auto_SOS
Title Auto S.O.S. Auto S.O.S.
Category Equipment Equipment
Author Reval Reval
Version 1.1 1.1
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL n/a
Download URL https://wiki.alioth.net/img_auth.php/c/ce/Auto_SOS.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1670701586

Documentation

Equipment

Name Visible Cost [deci-credits] Tech-Level
Auto S.O.S. yes 1500 3+

Ships

This expansion declares no ships. This may be related to warnings.

Models

This expansion declares no models. This may be related to warnings.

Scripts

Path
Scripts/as_script.js
"use strict"
this.name = "Auto S.O.S.";
this.author = "Reval";
this.license = "CC-BY-NC-SA 4.0";
this.version = "1.1";
this.description = "This simple transponder will automatically broadcast an S.O.S. distress signal when your ship comes under direct attack or Red Alert condition - and... 'S.O.S.' does mean *help*, doesn't it?";


this.startUp = function() {
	this.$asConds = ["DOCKED","GREEN","YELLOW","RED"];
	this.$asTesting = false;
	this.$asHasEQ = false;
	this.$asMaxHens = 8;
	this.$asHens = 0;
	this.$asAttackMsg = "Under attack. Under attack.";
	this.$asAlertMsg = "RED alert. RED alert. RED alert.";
}


this.shipWillLaunchFromStation = function() {
	var ps = player.ship;
	this.$asHasEQ = (ps.equipmentStatus ("EQ_AUTO_SOS") === "EQUIPMENT_OK");
	this.$asHens = 0;
}


this.playerBoughtEquipment = function(equipment, paid) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_AUTO_SOS") 
		pc("Auto S.O.S. installed and monitoring.",9);
}


this.shipBeingAttacked = function(whom) {
	if (this.$asHasEQ) { 
		if (this.$asHens<this.$asMaxHens) {
			var hen = system.addShips("police", 1, whom.position);
			this.$asHens++;
		}
		this._asDistress(this.$asAttackMsg);
	}
}


this.shipAttackedWithMissile = function(missile, whom) {
	if (this.$asHasEQ) {
		if (this.$asHens<this.$asMaxHens) {
			var hen = system.addShips("police", 1, whom.position);
			this.$asHens++;
		}
		this._asDistress(this.$asAttackMsg);
	}
}


this.alertConditionChanged = function(newCondition, oldCondition) {
	if (this.$asHasEQ) {	
		var ps = player.ship;
		var psa = newCondition;
		var pc  = player.consoleMessage;
		// TEST
		if (this.$asTesting) this._asDoCond(psa);
		// condition Red - send SOS
		if (psa==3)  {
			if (this.$asHens<this.$asMaxHens) {
				var hens = system.addShips("interceptor", 3, ps.position);
				this.$asHens+=3;
			}
			this._asDistress(this.$asAlertMsg);
		} else this.$asHens=0;
	}
}


// report condition status
this._asDoCond = function(cond) {
	var ps = player.ship;
	var pc  = player.consoleMessage;
	var c = ps.messageGuiTextColor;
	if (cond==0) ps.messageGuiTextColor = "blueColor"; else
	if (cond==1) ps.messageGuiTextColor = "greenColor"; else
	if (cond==2) ps.messageGuiTextColor = "yellowColor"; else
	if (cond==3) ps.messageGuiTextColor = "redColor";
	pc("Condition "+this.$asConds[cond],3);
	ps.messageGuiTextColor = c;
}


// put out the distress call
this._asDistress = function(msg) {
	var ps = player.ship;
	var pc = player.consoleMessage;
	var c = ps.messageGuiTextColor;
	ps.messageGuiTextColor = "redColor";
	pc(msg,9);
	ps.broadcastDistressMessage();	
	pc("Transmitting S.O.S.",9);
	ps.messageGuiTextColor = c;
}