Show mining stats in misc column even for inactive mods/drones
This commit is contained in:
@@ -241,27 +241,29 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut, Mu
|
||||
return None
|
||||
return CycleInfo(self.cycleTime, 0, math.inf, False)
|
||||
|
||||
@property
|
||||
def miningYPS(self):
|
||||
def getMiningYPS(self, ignoreState=False):
|
||||
if not ignoreState and self.amountActive <= 0:
|
||||
return 0
|
||||
if self.__miningYield is None:
|
||||
self.__miningYield, self.__miningWaste = self.__calculateMining()
|
||||
return self.__miningYield
|
||||
|
||||
@property
|
||||
def miningWPS(self):
|
||||
def getMiningWPS(self, ignoreState=False):
|
||||
if not ignoreState and self.amountActive <= 0:
|
||||
return 0
|
||||
if self.__miningWaste is None:
|
||||
self.__miningYield, self.__miningWaste = self.__calculateMining()
|
||||
return self.__miningWaste
|
||||
|
||||
def __calculateMining(self):
|
||||
if self.mines is True and self.amountActive > 0:
|
||||
if self.mines is True:
|
||||
getter = self.getModifiedItemAttr
|
||||
cycleParams = self.getCycleParameters()
|
||||
if cycleParams is None:
|
||||
yps = 0
|
||||
else:
|
||||
cycleTime = cycleParams.averageTime
|
||||
yield_ = sum([getter(d) for d in self.MINING_ATTRIBUTES]) * self.amountActive
|
||||
yield_ = sum([getter(d) for d in self.MINING_ATTRIBUTES]) * self.amount
|
||||
yps = yield_ / (cycleTime / 1000.0)
|
||||
wasteChance = self.getModifiedItemAttr("miningWasteProbability")
|
||||
wasteMult = self.getModifiedItemAttr("miningWastedVolumeMultiplier")
|
||||
|
||||
@@ -1656,11 +1656,11 @@ class Fit:
|
||||
droneWaste = 0
|
||||
|
||||
for mod in self.modules:
|
||||
minerYield += mod.miningYPS
|
||||
minerWaste += mod.miningWPS
|
||||
minerYield += mod.getMiningYPS()
|
||||
minerWaste += mod.getMiningWPS()
|
||||
for drone in self.drones:
|
||||
droneYield += drone.miningYPS
|
||||
droneWaste += drone.miningWPS
|
||||
droneYield += drone.getMiningYPS()
|
||||
droneWaste += drone.getMiningWPS()
|
||||
|
||||
self.__minerYield = minerYield
|
||||
self.__minerWaste = minerWaste
|
||||
|
||||
@@ -410,32 +410,33 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut, M
|
||||
|
||||
self.__itemModifiedAttributes.clear()
|
||||
|
||||
@property
|
||||
def miningYPS(self):
|
||||
def getMiningYPS(self, ignoreState=False):
|
||||
if self.isEmpty:
|
||||
return 0
|
||||
if not ignoreState and self.state < FittingModuleState.ACTIVE:
|
||||
return 0
|
||||
if self.__miningYield is None:
|
||||
self.__miningYield, self.__miningWaste = self.__calculateMining()
|
||||
return self.__miningYield
|
||||
|
||||
@property
|
||||
def miningWPS(self):
|
||||
def getMiningWPS(self, ignoreState=False):
|
||||
if self.isEmpty:
|
||||
return 0
|
||||
if not ignoreState and self.state < FittingModuleState.ACTIVE:
|
||||
return 0
|
||||
if self.__miningWaste is None:
|
||||
self.__miningYield, self.__miningWaste = self.__calculateMining()
|
||||
return self.__miningWaste
|
||||
|
||||
def __calculateMining(self):
|
||||
if self.isEmpty:
|
||||
return 0, 0
|
||||
if self.state >= FittingModuleState.ACTIVE:
|
||||
yield_ = self.getModifiedItemAttr("miningAmount")
|
||||
if yield_:
|
||||
cycleParams = self.getCycleParameters()
|
||||
if cycleParams is None:
|
||||
yps = 0
|
||||
else:
|
||||
cycleTime = cycleParams.averageTime
|
||||
yps = yield_ / (cycleTime / 1000.0)
|
||||
else:
|
||||
yield_ = self.getModifiedItemAttr("miningAmount")
|
||||
if yield_:
|
||||
cycleParams = self.getCycleParameters()
|
||||
if cycleParams is None:
|
||||
yps = 0
|
||||
else:
|
||||
cycleTime = cycleParams.averageTime
|
||||
yps = yield_ / (cycleTime / 1000.0)
|
||||
else:
|
||||
yps = 0
|
||||
wasteChance = self.getModifiedItemAttr("miningWasteProbability")
|
||||
|
||||
@@ -538,11 +538,11 @@ class Miscellanea(ViewColumn):
|
||||
tooltip = "Optimal signature radius"
|
||||
return text, tooltip
|
||||
elif itemGroup in ("Frequency Mining Laser", "Strip Miner", "Mining Laser", "Gas Cloud Scoops", "Mining Drone", "Gas Cloud Harvesters"):
|
||||
yps = stuff.miningYPS
|
||||
yps = stuff.getMiningYPS(ignoreState=True)
|
||||
if not yps:
|
||||
return "", None
|
||||
yph = yps * 3600
|
||||
wps = stuff.miningWPS
|
||||
wps = stuff.getMiningWPS(ignoreState=True)
|
||||
wph = wps * 3600
|
||||
textParts = []
|
||||
textParts.append(formatAmount(yps, 3, 0, 3))
|
||||
|
||||
Reference in New Issue
Block a user