mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-11-30 04:40:47 +01:00
also use shot fired to correct classes
This commit is contained in:
parent
8aa8ae6e3f
commit
626dedd73b
1 changed files with 17 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use crate::common::{Class, SubjectId};
|
||||
use crate::data::{Position, Weapon};
|
||||
use crate::event::{GameEvent, KillAssistEvent, KillEvent, MedicDeathEvent, MedicDeathExEvent};
|
||||
|
|
@ -172,6 +174,7 @@ impl GlobalData for Kills {
|
|||
RawEventType::Killed
|
||||
| RawEventType::KillAssist
|
||||
| RawEventType::Spawned
|
||||
| RawEventType::ShotFired
|
||||
| RawEventType::ChargeDeployed
|
||||
| RawEventType::ChargeReady
|
||||
| RawEventType::MedicDeath
|
||||
|
|
@ -210,6 +213,20 @@ impl GlobalData for Kills {
|
|||
}
|
||||
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();
|
||||
|
||||
if !weapon.classes().contains(&class) {
|
||||
let class = match weapon.classes() {
|
||||
&[class] => class,
|
||||
_ => Class::Unknown,
|
||||
};
|
||||
|
||||
self.classes.insert(subject, class);
|
||||
}
|
||||
}
|
||||
}
|
||||
GameEvent::Killed(event) if self.active => {
|
||||
if let Some(mut kill) = Kill::from_event(time, subject, event, &self.classes) {
|
||||
self.alive.insert(kill.victim.subject(), false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue