Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions eos/capSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def scale_activation(self, duration, capNeed):
return duration, capNeed

def init(self, modules):
"""prepare modules. a list of (duration, capNeed, clipSize) tuples is
"""prepare modules. a list of (duration, capNeed, clipSize, disableStagger) tuples is
expected, with clipSize 0 if the module has infinite ammo.
"""
self.modules = modules
Expand All @@ -72,7 +72,7 @@ def reset(self):
disable_period = False

# Loop over modules, clearing clipSize if applicable, and group modules based on attributes
for (duration, capNeed, clipSize) in self.modules:
for (duration, capNeed, clipSize, disableStagger) in self.modules:
if self.scale:
duration, capNeed = self.scale_activation(duration, capNeed)

Expand All @@ -82,14 +82,14 @@ def reset(self):
clipSize = 0

# Group modules based on their properties
if (duration, capNeed, clipSize) in mods:
mods[(duration, capNeed, clipSize)] += 1
if (duration, capNeed, clipSize, disableStagger) in mods:
mods[(duration, capNeed, clipSize, disableStagger)] += 1
else:
mods[(duration, capNeed, clipSize)] = 1
mods[(duration, capNeed, clipSize, disableStagger)] = 1

# Loop over grouped modules, configure staggering and push to the simulation state
for (duration, capNeed, clipSize), amount in mods.iteritems():
if self.stagger:
for (duration, capNeed, clipSize, disableStagger), amount in mods.iteritems():
if self.stagger and not disableStagger:
if clipSize == 0:
duration = int(duration/amount)
else:
Expand Down
10 changes: 7 additions & 3 deletions eos/saveddata/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from copy import deepcopy
from math import sqrt, log, asinh
from eos.types import Drone, Cargo, Ship, Character, State, Slot, Module, Implant, Booster, Skill
from eos.saveddata.module import State
from eos.saveddata.module import State, Hardpoint
from eos.saveddata.mode import Mode
import eos.db
import time
Expand Down Expand Up @@ -847,10 +847,14 @@ def __generateDrain(self):
else:
capAdded -= capNeed

drains.append((int(fullCycleTime), mod.getModifiedItemAttr("capacitorNeed") or 0, mod.numShots or 0))
# If this is a turret, don't stagger activations
disableStagger = mod.hardpoint == Hardpoint.TURRET

drains.append((int(fullCycleTime), mod.getModifiedItemAttr("capacitorNeed") or 0, mod.numShots or 0, disableStagger))

for fullCycleTime, capNeed, clipSize in self.iterDrains():
drains.append((int(fullCycleTime), capNeed, clipSize))
# Stagger incoming effects for cap simulation
drains.append((int(fullCycleTime), capNeed, clipSize, False))
if capNeed > 0:
capUsed += capNeed / (fullCycleTime / 1000.0)
else:
Expand Down