@@ -13,6 +13,19 @@ function filter(arr, maxClass, minClass, mass) {
13
13
return arr . filter ( m => m . class <= maxClass && m . class >= minClass && ( m . maxmass === undefined || mass <= m . maxmass ) ) ;
14
14
}
15
15
16
+ /**
17
+ * Filter SCO Modules to only return legal size.
18
+ * @param {Array } arr Array of available FSD modules.
19
+ * @param {number } maxSize Maximum allowable size for SCO modules.
20
+ * @return {Array } Subset of modules filtered based on legal size amd type.
21
+ */
22
+ function sco_filter ( arr , maxSize ) {
23
+ return arr . filter ( module => {
24
+ return ! ( module . hasOwnProperty ( 'name' ) && module [ 'name' ] === "Frame Shift Drive (SCO)" && module [ 'class' ] < maxSize ) ;
25
+ } ) ;
26
+ }
27
+
28
+
16
29
/**
17
30
* The available module set for a specific ship
18
31
*/
@@ -41,6 +54,7 @@ export default class ModuleSet {
41
54
42
55
this . standard [ 0 ] = filter ( stnd . pp , maxStandardArr [ 0 ] , 0 , mass ) ; // Power Plant
43
56
this . standard [ 2 ] = filter ( stnd . fsd , maxStandardArr [ 2 ] , 0 , mass ) ; // FSD
57
+ this . standard [ 2 ] = sco_filter ( this . standard [ 2 ] , maxStandardArr [ 2 ] ) // FSD - Filter SCO Modules
44
58
this . standard [ 4 ] = filter ( stnd . pd , maxStandardArr [ 4 ] , 0 , mass ) ; // Power Distributor
45
59
this . standard [ 6 ] = filter ( stnd . ft , maxStandardArr [ 6 ] , 0 , mass ) ; // Fuel Tank
46
60
// Thrusters, filter modules by class only (to show full list of ratings for that class)
0 commit comments