(self, src)
| 25 | class SubwarpSpeedCache(FitDataCache): |
| 26 | |
| 27 | def getSubwarpSpeed(self, src): |
| 28 | try: |
| 29 | subwarpSpeed = self._data[src.item.ID] |
| 30 | except KeyError: |
| 31 | modStates = {} |
| 32 | disallowedGroups = ( |
| 33 | # Active modules which affect ship speed and cannot be used in warp |
| 34 | 'Propulsion Module', |
| 35 | 'Mass Entanglers', |
| 36 | 'Cloaking Device', |
| 37 | # Those reduce ship speed to 0 |
| 38 | 'Siege Module', |
| 39 | 'Super Weapon', |
| 40 | 'Cynosural Field Generator', |
| 41 | 'Clone Vat Bay', |
| 42 | 'Jump Portal Generator') |
| 43 | for mod in src.item.activeModulesIter(): |
| 44 | if mod.item is not None and mod.item.group.name in disallowedGroups: |
| 45 | modStates[mod] = mod.state |
| 46 | mod.state = FittingModuleState.ONLINE |
| 47 | projFitStates = {} |
| 48 | for projFit in src.item.projectedFits: |
| 49 | projectionInfo = projFit.getProjectionInfo(src.item.ID) |
| 50 | if projectionInfo is not None and projectionInfo.active: |
| 51 | projFitStates[projectionInfo] = projectionInfo.active |
| 52 | projectionInfo.active = False |
| 53 | projModStates = {} |
| 54 | for mod in src.item.projectedModules: |
| 55 | if not mod.isExclusiveSystemEffect and mod.state >= FittingModuleState.ACTIVE: |
| 56 | projModStates[mod] = mod.state |
| 57 | mod.state = FittingModuleState.ONLINE |
| 58 | projDroneStates = {} |
| 59 | for drone in src.item.projectedDrones: |
| 60 | if drone.amountActive > 0: |
| 61 | projDroneStates[drone] = drone.amountActive |
| 62 | drone.amountActive = 0 |
| 63 | projFighterStates = {} |
| 64 | for fighter in src.item.projectedFighters: |
| 65 | if fighter.active: |
| 66 | projFighterStates[fighter] = fighter.active |
| 67 | fighter.active = False |
| 68 | src.item.calculateModifiedAttributes() |
| 69 | subwarpSpeed = src.getMaxVelocity() |
| 70 | self._data[src.item.ID] = subwarpSpeed |
| 71 | for projInfo, state in projFitStates.items(): |
| 72 | projInfo.active = state |
| 73 | for mod, state in modStates.items(): |
| 74 | mod.state = state |
| 75 | for mod, state in projModStates.items(): |
| 76 | mod.state = state |
| 77 | for drone, amountActive in projDroneStates.items(): |
| 78 | drone.amountActive = amountActive |
| 79 | for fighter, state in projFighterStates.items(): |
| 80 | fighter.active = state |
| 81 | src.item.calculateModifiedAttributes() |
| 82 | return subwarpSpeed |
no test coverage detected