From f5121a75c36555d2e5176fe5b9646ff7dded4363 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 16 Nov 2026 22:08:43 +0100 Subject: [PATCH] fix classes in older log without spawn events --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/module/kills.rs | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c5ff11..1022fbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1178,7 +1178,7 @@ dependencies = [ [[package]] name = "tf-log-parser" -version = "0.1.1" +version = "0.1.2" dependencies = [ "ahash", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 257a18a..d020ccf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tf-log-parser" -version = "0.1.1" +version = "0.1.2" edition = "2021" rust-version = "1.90.0" description = "TF2 log parser with a focus on speed and flexibility" diff --git a/src/module/kills.rs b/src/module/kills.rs index e4d9313..f219fe7 100644 --- a/src/module/kills.rs +++ b/src/module/kills.rs @@ -174,6 +174,7 @@ impl GlobalData for Kills { RawEventType::Killed | RawEventType::KillAssist | RawEventType::Spawned + | RawEventType::RoleChange | RawEventType::ShotFired | RawEventType::ChargeDeployed | RawEventType::ChargeReady @@ -213,6 +214,14 @@ impl GlobalData for Kills { } self.alive.insert(subject, true); } + GameEvent::RoleChange(event) => { + self.active = self.game_started; + + if let Some(class) = event.class { + self.classes.insert(subject, class); + } + self.alive.insert(subject, true); + } GameEvent::ShotFired(event) => { if let Some(Ok(weapon)) = event.weapon.map(Weapon::from_str) { let class = self.classes.get(&subject).copied().unwrap_or_default();