Limit drone stacks by ship bandwidth too
This commit is contained in:
@@ -1507,19 +1507,19 @@ class Fit(object):
|
||||
|
||||
return True
|
||||
|
||||
def howManyDronesRelease(self, item):
|
||||
def getReleaseLimitForDrone(self, item):
|
||||
if not item.isDrone:
|
||||
return 0
|
||||
bw = round(self.ship.getModifiedItemAttr("droneBandwidth"))
|
||||
volume = round(item.attribsWithOverrides['volume'])
|
||||
volume = round(item.attribsWithOverrides['volume'].value)
|
||||
return int(bw / volume)
|
||||
|
||||
def howManyDronesStore(self, item):
|
||||
def getStoreLimitForDrone(self, item):
|
||||
if not item.isDrone:
|
||||
return 0
|
||||
bayTotal = round(self.ship.getModifiedItemAttr("droneCapacity"))
|
||||
bayUsed = round(self.droneBayUsed)
|
||||
volume = item.attribsWithOverrides['volume']
|
||||
volume = item.attribsWithOverrides['volume'].value
|
||||
return int((bayTotal - bayUsed) / volume)
|
||||
|
||||
def __deepcopy__(self, memo=None):
|
||||
|
||||
@@ -4,7 +4,7 @@ from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from gui.fitCommands.helpers import DroneInfo
|
||||
from gui.fitCommands.helpers import DroneInfo, droneStackLimit
|
||||
from service.fit import Fit
|
||||
from service.market import Market
|
||||
|
||||
@@ -30,8 +30,8 @@ class CalcAddLocalDroneCommand(wx.Command):
|
||||
# If we're not adding any active drones, check if there's an inactive stack
|
||||
# with enough space for new drones and use it
|
||||
if not self.forceNewStack and self.droneInfo.amountActive == 0:
|
||||
maxStack = droneStackLimit(fit, item)
|
||||
for drone in fit.drones.find(item):
|
||||
maxStack = max(5, fit.extraAttributes["maxActiveDrones"])
|
||||
if (
|
||||
drone is not None and drone.amountActive == 0 and
|
||||
drone.amount + self.droneInfo.amount <= maxStack
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import math
|
||||
|
||||
import wx
|
||||
from logbook import Logger
|
||||
|
||||
@@ -322,6 +324,13 @@ def stateLimit(itemIdentity):
|
||||
return FittingModuleState.ACTIVE
|
||||
|
||||
|
||||
def droneStackLimit(fit, item):
|
||||
hardLimit = max(5, fit.extraAttributes["maxActiveDrones"])
|
||||
releaseLimit = fit.getReleaseLimitForDrone(item)
|
||||
limit = min(hardLimit, releaseLimit if releaseLimit > 0 else math.inf)
|
||||
return limit
|
||||
|
||||
|
||||
def restoreCheckedStates(fit, stateInfo):
|
||||
if stateInfo is None:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user