Config/script.js |
"use strict";
this.name = "Bullet Drive";
this.version = "1.0.4"; // February 19th, 2024
/* ====================================================================================
MAINTAIN LOCKED HEADING AT HIGH SPEED
======================================================================================= */
this.$maintainHeading = function () {
"use strict";
var self = player.ship;
if (self.status !== "STATUS_IN_FLIGHT" &&
self.status !== "STATUS_WITCHSPACE_COUNTDOWN") {
removeFrameCallback(this.$monitor);
delete this.$monitor;
return;
}
if (self.speed <= 7 * self.maxSpeed) {
if (this.$heading) {
delete this.$heading;
}
if (player.alertCondition != 1) {
removeFrameCallback(this.$monitor);
delete this.$monitor;
}
return;
}
if (self.speed > 7 * self.maxSpeed) { // Exceeding injector speed, must be torus button speed.
if (this.$heading) {
var angle = self.heading.angleTo(this.$heading);
var cross = self.heading.cross(this.$heading).direction();
self.orientation = self.orientation.rotate(cross, - angle);
} else {
this.$heading = self.heading;
}
}
}
/* ====================================================================================
STARTING $maintainHeading
======================================================================================= */
this.alertConditionChanged = function (newCondition, oldCondition) {
"use strict";
if (newCondition == 1 && !this.$monitor) {
this.$monitor = addFrameCallback(this.$maintainHeading.bind(this));
}
}
this.shipExitedWitchspace = function () {
"use strict";
if (player.alertCondition == 1 && !this.$monitor) {
this.$monitor = addFrameCallback(this.$maintainHeading.bind(this));
}
}
/* ====================================================================================
CHANGE LOG
1.0.4 (February 19th, 2024) Formatted to look less like PHP. No actual changes.
1.0.3 (May 16th, 2013) Added this.shipExitedWitchspace check.
1.0.2 (December 19th, 2012) Changed < to <= in speed check.
1.0.1 (December 18th, 2012) Comment removed.
1.0 (December 18th, 2012) Created.
======================================================================================= */ |