diff options
| author | Schark <jordan@schark.online> | 2026-01-31 00:44:56 -0500 |
|---|---|---|
| committer | Schark <jordan@schark.online> | 2026-01-31 00:44:56 -0500 |
| commit | 853f167b64c9a9e4f7ea98483496cd044458e12d (patch) | |
| tree | a57b202f1ad40070a4a73372201385e1e727f125 | |
| parent | 84b5adccbd60fb7cdf73d014a2d631f23b7884e9 (diff) | |
| download | cs2pov-853f167b64c9a9e4f7ea98483496cd044458e12d.tar.gz cs2pov-853f167b64c9a9e4f7ea98483496cd044458e12d.zip | |
Removed an issue where bomb-kills messed up death segments
| -rw-r--r-- | cs2pov/preprocessor.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/cs2pov/preprocessor.py b/cs2pov/preprocessor.py index e7077b4..b7bb396 100644 --- a/cs2pov/preprocessor.py +++ b/cs2pov/preprocessor.py @@ -213,10 +213,14 @@ def _extract_deaths(parser: DemoParser, player_steamid: int, tickrate: float) -> time_seconds = tick / tickrate if tickrate > 0 else 0 # Extract optional fields + # Note: NaN values from pandas need special handling (NaN is not None, and NaN != 0) attacker_steamid = row.get("attacker_steamid") - if attacker_steamid is not None and attacker_steamid != 0: - attacker_steamid = int(attacker_steamid) - else: + try: + if attacker_steamid is not None and attacker_steamid == attacker_steamid and attacker_steamid != 0: + attacker_steamid = int(attacker_steamid) + else: + attacker_steamid = None + except (ValueError, TypeError): attacker_steamid = None weapon = row.get("weapon") @@ -553,10 +557,11 @@ def compute_alive_segments( else: round_end_tick = total_ticks - # Find first death in this round (between freeze_end and round_end) + # Find first death in this round (between freeze_end and round_end, inclusive) + # Note: Use <= for round_end to catch bomb kills that happen exactly at round end death_in_round = None for death in deaths: - if round_start_tick <= death.tick < round_end_tick: + if round_start_tick <= death.tick <= round_end_tick: death_in_round = death break |
