mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Calculate top boost speed
This commit is contained in:
@@ -398,7 +398,9 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
};
|
||||
|
||||
Ship.prototype.updateTopSpeed = function() {
|
||||
this.topSpeed = calcSpeed(this.unladenMass + this.fuelCapacity, this.speed, this.common[1].c, this.pipSpeed)['4 Pips'];
|
||||
var speeds = calcSpeed(this.unladenMass + this.fuelCapacity, this.speed, this.boost, this.common[1].c, this.pipSpeed);
|
||||
this.topSpeed = speeds['4 Pips'];
|
||||
this.topBoost = speeds['boost'];
|
||||
};
|
||||
|
||||
Ship.prototype.updateShieldStrength = function() {
|
||||
|
||||
@@ -33,7 +33,7 @@ angular.module('shipyard', ['ngLodash'])
|
||||
sc: 'Scanner',
|
||||
am: 'Auto Field-Maintenance Unit',
|
||||
cr: 'Cargo Rack',
|
||||
fi: 'FSD Interdictor',
|
||||
fi: 'Frame Shift Drive Interdictor',
|
||||
hb: 'Hatch Breaker Limpet Controller',
|
||||
hr: 'Hull Reinforcement Package',
|
||||
rf: 'Refinery',
|
||||
@@ -233,16 +233,19 @@ angular.module('shipyard', ['ngLodash'])
|
||||
*
|
||||
* @param {number} mass Current mass of the ship
|
||||
* @param {number} baseSpeed Base speed m/s for ship
|
||||
* @param {number} baseBoost Base boost speed m/s for ship
|
||||
* @param {object} thrusters The Thrusters used
|
||||
* @param {number} pipSpeed Speed pip multiplier
|
||||
* @return {object} Approximate speed by pips
|
||||
*/
|
||||
.value('calcSpeed', function(mass, baseSpeed, thrusters, pipSpeed) {
|
||||
var speed = baseSpeed * ((1 - thrusters.M) + (thrusters.M * Math.pow(3 - (2 * Math.max(0.5, mass / thrusters.optmass)), thrusters.P)));
|
||||
.value('calcSpeed', function(mass, baseSpeed, baseBoost, thrusters, pipSpeed) {
|
||||
var multiplier = mass > thrusters.maxmass ? 0 : ((1 - thrusters.M) + (thrusters.M * Math.pow(3 - (2 * Math.max(0.5, mass / thrusters.optmass)), thrusters.P)));
|
||||
var speed = baseSpeed * multiplier;
|
||||
|
||||
return {
|
||||
'0 Pips': speed * (1 - (pipSpeed * 4)),
|
||||
'2 Pips': speed * (1 - (pipSpeed * 2)),
|
||||
'4 Pips': speed
|
||||
'4 Pips': speed,
|
||||
'boost': baseBoost * multiplier
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user