]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Add weapons fired directly instead of checking first.
authorAnt Zucaro <azucaro@gmail.com>
Sun, 5 Feb 2017 17:39:03 +0000 (12:39 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 5 Feb 2017 17:39:03 +0000 (12:39 -0500)
xonstat/views/submission.py

index 322fd5f81afd2814ceec89c353f7ebaa5bdd06bb..967d3b7336a2754a7c59b1117a1144c12ea3e563 100644 (file)
@@ -119,11 +119,9 @@ class Submission(object):
         except:
             return None, None
 
-    def check_for_new_weapon_fired(self, sub_key):
-        """Checks if a given weapon fired event is a new one for the match."""
-        weapon = sub_key.split("-")[1]
-        if weapon not in self.weapons:
-            self.weapons.add(weapon)
+    def add_weapon_fired(self, sub_key):
+        """Adds a weapon to the set of weapons fired during the match (a set)."""
+        self.weapons.add(sub_key.split("-")[1])
 
     def parse_player(self, key, pid):
         """Construct a player events listing from the submission."""
@@ -148,7 +146,7 @@ class Submission(object):
 
                 if sub_key.endswith("cnt-fired"):
                     player_fired_weapon = True
-                    self.check_for_new_weapon_fired(sub_key)
+                    self.add_weapon_fired(sub_key)
                 elif sub_key == 'scoreboard-score' and int(sub_value) != 0:
                     player_nonzero_score = True
                 elif sub_key == 'scoreboard-fastest':