mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
Add find lightest shield generator
This commit is contained in:
@@ -117,7 +117,18 @@ angular.module('shipyard').factory('ComponentSet', ['lodash', function(_) {
|
||||
return th.class + th.rating;
|
||||
};
|
||||
|
||||
ComponentSet.prototype.lightestPowerPlant = function(powerUsed) {
|
||||
ComponentSet.prototype.lightestShieldGenerator = function(hullMass) {
|
||||
var sg = null;
|
||||
|
||||
_.forEach(this.internal.sg, function(s) {
|
||||
if (sg == null || (s.mass < sg.mass && s.minmass <= hullMass && s.maxmass > hullMass)) {
|
||||
sg = s;
|
||||
}
|
||||
});
|
||||
return sg.id;
|
||||
};
|
||||
|
||||
ComponentSet.prototype.lightestPowerPlant = function(powerUsed, rating) {
|
||||
var pps = this.common[0];
|
||||
var pp = null;
|
||||
|
||||
@@ -126,7 +137,7 @@ angular.module('shipyard').factory('ComponentSet', ['lodash', function(_) {
|
||||
pp = pps[i];
|
||||
}
|
||||
}
|
||||
return pp.class + (pp.rating != 'D' ? 'A' : 'D'); // Use A rated if C,E
|
||||
return pp.class + (pp.rating != 'D' || rating == 'A' ? 'A' : 'D'); // Use A rated if C,E
|
||||
};
|
||||
|
||||
return ComponentSet;
|
||||
|
||||
Reference in New Issue
Block a user