Back to Index Page generated: Dec 20, 2024, 7:22:09 AM

Expansion Shaky Drive

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 Shaky Drive makes the ship shake and steer randomly while the Torus drive is engaged. Apply manual corrections to maintain desired heading Shaky Drive makes the ship shake and steer randomly while the Torus drive is engaged. Apply manual corrections to maintain desired heading
Identifier oolite.oxp.Astrobe.ShakyDrive oolite.oxp.Astrobe.ShakyDrive
Title Shaky Drive Shaky Drive
Category Mechanics Mechanics
Author Astrobe Astrobe
Version 1.0.0 1.0.0
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/a/a8/Oolite.oxp.Astrobe.ShakyDrive.oxz n/a
License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
File Size n/a
Upload date 1610873405

Documentation

Also read http://wiki.alioth.net/index.php/Shaky%20Drive

Bullet Drive READ ME.txt

----------------------------
Shaky Drive OXP  ver. 0.0.2
----------------------------
  Date: April 12th, 2016
Author: Astrobe, based on "Bullet Drive" by Wildblood


Imperfections in thrusters and mass imbalances within the ship are normally
automatically corrected by the flight control software.
However, at very high speeds, those corrections are no longer effective. The
ship starts to "shake" and has a tendency to "steer" in a some direction, and
becomes harder to control securely.
For this reason, the flight control software automatically disengage the Torus
drive when it detects a significant mass nearby; a security commonly known as
a "mass lock".

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
"use strict";

this.name    = "Shaky Drive";
this.version = "1.0.0"; // Astrobe. Based on Bullet Drive by Wildblood, May 16th, 2013

/* ====================================================================================
			MAINTAIN LOCKED HEADING AT HIGH SPEED
======================================================================================= */

this.$maintainHeading = function()
{
	var self = player.ship;
	if (self.status !== "STATUS_IN_FLIGHT" && self.status !== "STATUS_WITCHSPACE_COUNTDOWN")
	{
		removeFrameCallback(this.$monitor);
		delete this.$monitor;
		delete this.$heading;
		return;
	}
	if (self.speed > 8*self.maxSpeed)
	{
		// the strength of the "shaking" depends on speed.
		// This works by rotating a bit the ship on all of its axis, by a random angle.
		// The randomness has two components: one that is picked for every new frame, and one that is picked at launch time.
		// This way, the ships has a tendency to "deviate" in a certain way.
		var k= (self.speed/(32*self.maxSpeed))/100;
		if (this.$heading) self.orientation = self.orientation.rotate(Vector3D.randomDirectionAndLength(0.4).add(this.$heading), k);
		else this.$heading = Vector3D.randomDirectionAndLength(0.4);
	}
}

/* ====================================================================================
			STARTING $maintainHeading
======================================================================================= */

this.shipLaunchedFromStation = function(station)
{
	if (!this.$monitor)
	{
		this.$monitor = addFrameCallback(this.$maintainHeading.bind(this));
	}
}

this.shipExitedWitchspace = function()
{
	if (player.alertCondition == 1 && !this.$monitor)
	{
		this.$monitor = addFrameCallback(this.$maintainHeading.bind(this));
	}
}

// CHANGELOG
// 1.0.0 2016-10-28 Release
// 0.0.3 2016-08-26 alertConditionChanged does not seem to take place on launching; replaced with willLaunchFromStation.
// 0.0.2 2016-04-12 No shaking at max witchdrive speed, reduced shaking.
// 0.0.1 2016-04-09 Beta version.