mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Calculate speed based on Thrusters. Closes #16
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength', 'calcJumpRange', 'calcTotalRange', 'lodash', 'ArmourMultiplier', function(Components, calcShieldStrength, calcJumpRange, calcTotalRange, _, ArmourMultiplier) {
|
||||
angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength', 'calcJumpRange', 'calcTotalRange', 'calcSpeed', 'lodash', 'ArmourMultiplier', function(Components, calcShieldStrength, calcJumpRange, calcTotalRange, calcSpeed, _, ArmourMultiplier) {
|
||||
|
||||
/**
|
||||
* Returns the power usage type of a slot and it's particular component
|
||||
@@ -159,6 +159,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
this.updatePower();
|
||||
this.updateJumpStats();
|
||||
this.updateShieldStrength();
|
||||
this.updateTopSpeed();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -375,6 +376,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
if (powerChange) {
|
||||
this.updatePower();
|
||||
}
|
||||
this.updateTopSpeed();
|
||||
this.updateJumpStats();
|
||||
this.updateShieldStrength();
|
||||
}
|
||||
@@ -395,6 +397,10 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
this.powerDeployed = prevDeployed;
|
||||
};
|
||||
|
||||
Ship.prototype.updateTopSpeed = function() {
|
||||
this.topSpeed = calcSpeed(this.unladenMass + this.fuelCapacity, this.speed, this.common[1].c, this.pipSpeed)['4 Pips'];
|
||||
};
|
||||
|
||||
Ship.prototype.updateShieldStrength = function() {
|
||||
var sgSlot = this.findInternalByGroup('sg'); // Find Shield Generator slot Index if any
|
||||
this.shieldStrength = sgSlot && sgSlot.enabled ? calcShieldStrength(this.hullMass, this.baseShieldStrength, sgSlot.c, this.shieldMultiplier) : 0;
|
||||
|
||||
Reference in New Issue
Block a user