From 853f167b64c9a9e4f7ea98483496cd044458e12d Mon Sep 17 00:00:00 2001 From: Schark Date: Sat, 31 Jan 2026 00:44:56 -0500 Subject: Removed an issue where bomb-kills messed up death segments --- cs2pov/preprocessor.py | 15 ++++++++++----- 1 file 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 -- cgit v1.2.3-18-g5258