Skip to content

Commit

Permalink
Conflate together turrets of same aircraft into one id.
Browse files Browse the repository at this point in the history
  • Loading branch information
FGlazov committed Apr 9, 2021
1 parent 3181fee commit 60a390d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/mod_rating_by_type/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,22 @@ def record_hits(target, attacker, ammo):
target.sortie.ammo_breakdown[ALL_TAKEN] += 1

if attacker:
attacker_id = attacker.id
if attacker.cls == 'aircraft_turret' and attacker.parent and attacker.parent.sortie:
# Multiple turrets of an aircraft are counted together!
# That's why we take the aircraft's sortie.
attacker_id = attacker.parent.sortie.index

ammo_breakdown = target.sortie.ammo_breakdown
if ammo_breakdown[LAST_DMG_OBJECT] is None and ammo_breakdown[LAST_DMG_SORTIE] is None:
ammo_breakdown[DMG_FROM_ONE_SOURCE] = True
else:
if attacker.sortie and attacker.sortie.index != ammo_breakdown[LAST_DMG_SORTIE]:
ammo_breakdown[DMG_FROM_ONE_SOURCE] = False
if attacker.id != target.sortie.ammo_breakdown[LAST_DMG_OBJECT]:
if attacker_id != target.sortie.ammo_breakdown[LAST_DMG_OBJECT]:
ammo_breakdown[DMG_FROM_ONE_SOURCE] = False

ammo_breakdown[LAST_DMG_OBJECT] = attacker.id
ammo_breakdown[LAST_DMG_OBJECT] = attacker_id
if attacker.sortie:
ammo_breakdown[LAST_DMG_SORTIE] = attacker.sortie.index

Expand Down Expand Up @@ -78,6 +84,7 @@ def default_ammo_breakdown():
DMG_FROM_ONE_SOURCE: False,
LAST_DMG_SORTIE: None,
LAST_DMG_OBJECT: None,
LAST_TURRET_ACCOUNT: None,
}


Expand Down

0 comments on commit 60a390d

Please sign in to comment.