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

Expansion RRS Black Box - Hot&Cold game

Content

Warnings

  1. 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 Play the Hot&Cold game while looking the Black Box for RRS Groups Play the Hot&Cold game while looking the Black Box for RRS Groups
Identifier oolite.oxp.SMax.RRSBlackBoxHC oolite.oxp.SMax.RRSBlackBoxHC
Title RRS Black Box - Hot&Cold game RRS Black Box - Hot&Cold game
Category HUDs HUDs
Author SMax SMax
Version 0.1 0.1
Tags RRS, game RRS, game
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/7/73/RRSBlackBoxHC_0.1.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1610873336

Documentation

Also read http://wiki.alioth.net/index.php/RRS%20Black%20Box%20-%20Hot&Cold%20game

README.md

RRS Black Box - Hot&Cold game

By S Max

Play the Hot&Cold game while looking the Black Box for RRS Groups.

# License
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 4.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/

# Version History
## [0.1] - 2016-09-24

- Initial release

Equipment

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

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
Config/script.js
/* global system log Timer player*/

this.name = "RRSBlackBoxHC";
this.author = "SMax";
this.copyright = "2016 SMax";
this.licence = "CC-BY-NC-SA 4.0";
this.description = "Play the Hot&Cold game while looking the Black Box for RRS Groups";
this.version = "0.1";

"use strict";

this._DEBUG = false;

this._timer = null;
this._lastMSG = "";

this.shipLaunchedFromStation = function(station) {
	this._runGame();
};

this.shipDockedWithStation = function(station) {
	this._timerStop();
};

this.shipWillExitWitchspace = function() {
	this._runGame();
};

this._logger = function(msg) {
	if (this._DEBUG) {
		log(this.name, msg);
	}
};

this._timerStop = function() {
	if (this._timer) {
		this._timer.stop();
		this._timer = null;
		this._lastMSG = "";
	}
}

this._getBB = function() {
	var bb = system.shipsWithPrimaryRole("rescue_blackbox");

	if (bb && bb[0]) {
		return bb[0];
	}

	this._timerStop();
	return null;
};

this._runGame = function() {
	var bb = this._getBB();
	if (!bb) {
		return;
	}

	player.consoleMessage("Hot&Cold game started! Find the Black Box!");
	this._timer = new Timer(this, this._timerCallBack, 1, 1);
};

this._timerCallBack = function() {
	var bb = this._getBB();
	if (!bb) {
		return;
	}

	var vecBB = bb.position.subtract(player.ship.position);
	var alpha = vecBB.angleTo(player.ship.orientation.vectorForward());
	var msg = "";

	if (alpha < (Math.PI / 4)) {
		msg = "Very hot";
	}
	else if (alpha < (Math.PI / 2)) {
		msg = "Hot";
	}
	else {
		msg = "Cold";
	}

	if (this._lastMSG != msg) {
		player.consoleMessage("Black Box - " + msg + "!");
		this._lastMSG = msg;
	}
};