(self, itemSpec)
| 877 | self.getContainerBySlot(m.slot).append(m) |
| 878 | |
| 879 | def __makeModule(self, itemSpec): |
| 880 | # Mutate item if needed |
| 881 | m = None |
| 882 | if itemSpec.mutationIdx in self.mutations: |
| 883 | mutaItem, mutaAttrs = self.mutations[itemSpec.mutationIdx] |
| 884 | mutaplasmid = getDynamicItem(mutaItem.ID) |
| 885 | if mutaplasmid: |
| 886 | try: |
| 887 | m = Module(mutaplasmid.resultingItem, itemSpec.item, mutaplasmid) |
| 888 | except ValueError: |
| 889 | pass |
| 890 | else: |
| 891 | for attrID, mutator in m.mutators.items(): |
| 892 | if attrID in mutaAttrs: |
| 893 | mutator.value = mutaAttrs[attrID] |
| 894 | # If we still don't have item (item is not mutated or we |
| 895 | # failed to construct mutated item), try to make regular item |
| 896 | if m is None: |
| 897 | try: |
| 898 | m = Module(itemSpec.item) |
| 899 | except ValueError: |
| 900 | return None |
| 901 | |
| 902 | if itemSpec.charge is not None and m.isValidCharge(itemSpec.charge): |
| 903 | m.charge = itemSpec.charge |
| 904 | if itemSpec.offline and m.isValidState(FittingModuleState.OFFLINE): |
| 905 | m.state = FittingModuleState.OFFLINE |
| 906 | elif m.isValidState(FittingModuleState.ACTIVE): |
| 907 | m.state = activeStateLimit(m.item) |
| 908 | return m |
| 909 | |
| 910 | def addImplant(self, itemSpec): |
| 911 | if itemSpec is None: |
no test coverage detected