Cannisters
Posted: Sun Aug 14, 2022 9:13 am
Would like a reworking of their ejection maths, it's ridiculous when some get dumped or you nail a ship after a fight and the cargo goes zipping off at .87LM.
Code: Select all
//-------------------------------------------------------------------------------------------------------------
this.shipDumpedCargo = function (cargo) {
if (this._unitOn === true) {
player.consoleMessage("Ejection dampening applied.", 2);
cargo.maxThrust = 1;
cargo.thrust = 1;
this._usesLeft -= 1;
this._cargoList.push(cargo);
if (this._resetTimer == null || this._resetTimer.isRunning === false) {
this._resetTimer = new Timer(this, this.$resetCargo, 2, 2);
}
if (this._usesLeft <= 0) {
this._usesLeft = 0;
this._unitOn = false;
this.$playSound("off");
player.ship.removeEquipment("EQ_GCM_EJECTION_DAMPER");
player.consoleMessage("Ejection damper expended and removed.", 5);
}
}
}
//-------------------------------------------------------------------------------------------------------------
this.$resetCargo = function $resetCargo() {
if (this._cargoList.length === 0) {
this._resetTimer.stop();
this._resetTimer = null;
return;
}
for (var i = this._cargoList.length - 1; i >= 0; i--) {
var cargo = this._cargoList[i];
if (!cargo.velocity || cargo.velocity.magnitude() === 0) {
if (cargo.isValid && cargo.isInSpace) {
cargo.maxThrust = 0;
cargo.thrust = 0;
}
this._cargoList.splice(i, 1);
}
}
}