(self, src, ancReload, maxTime)
| 126 | |
| 127 | # Private stuff |
| 128 | def _generateInternalForm(self, src, ancReload, maxTime): |
| 129 | if self._isTimeCacheValid(src=src, ancReload=ancReload, maxTime=maxTime): |
| 130 | return |
| 131 | fitCache = self._data.setdefault(src.item.ID, {})[ancReload] = {'maxTime': maxTime} |
| 132 | intCacheRps = fitCache['internalRps'] = {} |
| 133 | intCacheRepAmount = fitCache['internalRepAmount'] = {} |
| 134 | |
| 135 | def addRps(rrKey, addedTimeStart, addedTimeFinish, addedRepAmounts): |
| 136 | if not addedRepAmounts: |
| 137 | return |
| 138 | repAmountSum = sum(addedRepAmounts, RRTypes(0, 0, 0, 0)) |
| 139 | if repAmountSum.shield > 0 or repAmountSum.armor > 0 or repAmountSum.hull > 0: |
| 140 | addedRps = repAmountSum / (addedTimeFinish - addedTimeStart) |
| 141 | rrCacheRps = intCacheRps.setdefault(rrKey, []) |
| 142 | rrCacheRps.append((addedTimeStart, addedTimeFinish, addedRps)) |
| 143 | |
| 144 | def addRepAmount(rrKey, addedTime, addedRepAmount): |
| 145 | if addedRepAmount.shield > 0 or addedRepAmount.armor > 0 or addedRepAmount.hull > 0: |
| 146 | intCacheRepAmount.setdefault(rrKey, {})[addedTime] = addedRepAmount |
| 147 | |
| 148 | # Modules |
| 149 | for mod in src.item.activeModulesIter(): |
| 150 | if not mod.isRemoteRepping(): |
| 151 | continue |
| 152 | isAncShield = 'shipModuleAncillaryRemoteShieldBooster' in mod.item.effects |
| 153 | isAncArmor = 'shipModuleAncillaryRemoteArmorRepairer' in mod.item.effects |
| 154 | if isAncShield or isAncArmor: |
| 155 | cycleParams = mod.getCycleParameters(reloadOverride=ancReload) |
| 156 | else: |
| 157 | cycleParams = mod.getCycleParameters(reloadOverride=True) |
| 158 | if cycleParams is None: |
| 159 | continue |
| 160 | currentTime = 0 |
| 161 | nonstopCycles = 0 |
| 162 | cyclesWithoutReload = 0 |
| 163 | cyclesUntilReload = mod.numShots |
| 164 | for cycleTimeMs, inactiveTimeMs, isInactivityReload in cycleParams.iterCycles(): |
| 165 | cyclesWithoutReload += 1 |
| 166 | cycleRepAmounts = [] |
| 167 | repAmountParams = mod.getRepAmountParameters(spoolOptions=SpoolOptions(SpoolType.CYCLES, nonstopCycles, True)) |
| 168 | for repTimeMs, repAmount in repAmountParams.items(): |
| 169 | # Loaded ancillary armor rep can keep running at less efficiency if we decide to not reload |
| 170 | if isAncArmor and mod.charge and not ancReload and cyclesWithoutReload > cyclesUntilReload: |
| 171 | repAmount = repAmount / mod.getModifiedItemAttr('chargedArmorDamageMultiplier', 1) |
| 172 | cycleRepAmounts.append(repAmount) |
| 173 | addRepAmount(mod, currentTime + repTimeMs / 1000, repAmount) |
| 174 | addRps(mod, currentTime, currentTime + cycleTimeMs / 1000, cycleRepAmounts) |
| 175 | if inactiveTimeMs > 0: |
| 176 | nonstopCycles = 0 |
| 177 | else: |
| 178 | nonstopCycles += 1 |
| 179 | if isInactivityReload: |
| 180 | cyclesWithoutReload = 0 |
| 181 | if currentTime > maxTime: |
| 182 | break |
| 183 | currentTime += cycleTimeMs / 1000 + inactiveTimeMs / 1000 |
| 184 | # Drones |
| 185 | for drone in src.item.activeDronesIter(): |
no test coverage detected