From da7b95041d360499e6fb30d3f877d81103f1c2dc Mon Sep 17 00:00:00 2001 From: Neugeniko Date: Wed, 14 Mar 2018 13:40:31 +1100 Subject: [PATCH] Allow variable reload time in CapSim. --- eos/capSim.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/eos/capSim.py b/eos/capSim.py index d57567ae6..0c806f1a3 100644 --- a/eos/capSim.py +++ b/eos/capSim.py @@ -71,7 +71,7 @@ class CapSimulator(object): disable_period = False # Loop over modules, clearing clipSize if applicable, and group modules based on attributes - for (duration, capNeed, clipSize, disableStagger) in self.modules: + for (duration, capNeed, clipSize, disableStagger, reloadTime) in self.modules: if self.scale: duration, capNeed = self.scale_activation(duration, capNeed) @@ -81,22 +81,22 @@ class CapSimulator(object): clipSize = 0 # Group modules based on their properties - if (duration, capNeed, clipSize, disableStagger) in mods: - mods[(duration, capNeed, clipSize, disableStagger)] += 1 + if (duration, capNeed, clipSize, disableStagger, reloadTime) in mods: + mods[(duration, capNeed, clipSize, disableStagger, reloadTime)] += 1 else: - mods[(duration, capNeed, clipSize, disableStagger)] = 1 + mods[(duration, capNeed, clipSize, disableStagger, reloadTime)] = 1 # Loop over grouped modules, configure staggering and push to the simulation state - for (duration, capNeed, clipSize, disableStagger), amount in mods.iteritems(): + for (duration, capNeed, clipSize, disableStagger, reloadTime), amount in mods.iteritems(): if self.stagger and not disableStagger: if clipSize == 0: duration = int(duration / amount) else: - stagger_amount = (duration * clipSize + 10000) / (amount * clipSize) + stagger_amount = (duration * clipSize + reloadTime) / (amount * clipSize) for i in range(1, amount): heapq.heappush(self.state, [i * stagger_amount, duration, - capNeed, 0, clipSize]) + capNeed, 0, clipSize, reloadTime]) else: capNeed *= amount @@ -106,7 +106,7 @@ class CapSimulator(object): if clipSize: disable_period = True - heapq.heappush(self.state, [0, duration, capNeed, 0, clipSize]) + heapq.heappush(self.state, [0, duration, capNeed, 0, clipSize, reloadTime]) if disable_period: self.period = self.t_max @@ -143,7 +143,7 @@ class CapSimulator(object): while 1: activation = pop(state) - t_now, duration, capNeed, shot, clipSize = activation + t_now, duration, capNeed, shot, clipSize, reloadTime = activation if t_now >= t_max: break @@ -179,7 +179,7 @@ class CapSimulator(object): if clipSize: if shot % clipSize == 0: shot = 0 - t_now += 10000 # include reload time + t_now += reloadTime # include reload time activation[0] = t_now activation[3] = shot