Limit drone stacks by ship bandwidth too
This commit is contained in:
@@ -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