Open megascatterbomb opened 2 days ago
for copy-pasting convenience:
fn handle_message(&mut self, message: &Message, _tick: DemoTick, parser_state: &ParserState) {
match message {
Message::PacketEntities(message) => {
for entity in &message.entities {
self.handle_entity(entity, parser_state);
}
}
Message::GameEvent(GameEventMessage { event, .. }) => match event {
GameEvent::PlayerShoot(_) => {
println!("player shoot event");
}
GameEvent::PlayerDeath(death) => {
self.state.kills.push(Kill::new(self.tick, death.as_ref()))
}
GameEvent::RoundStart(_) => {
self.state.buildings.clear();
}
GameEvent::TeamPlayRoundStart(_) => {
self.state.buildings.clear();
}
GameEvent::ObjectDestroyed(ObjectDestroyedEvent { index, .. }) => {
self.state.remove_building((*index as u32).into());
}
_ => {
let event_string = format!("{:?}", event);
if event_string.contains("Shoot") {
println!("player shoot event");
}
}
},
_ => {
println!("unhandled message: {message:?}");
}
}
}
Unsure if this is a tf2 issue or an implementation issue, but I've tried putting a GameEvent::PlayerShoot into GameStateAnalyser.handle_message for the purposes of tracking weapon usage, however none of the demos I've tried (both my own and from others) have resulted in this event being executed. I've confirmed that the player death event is firing as intended using a print statement, and I've confirmed that no PlayerShoot events are missing the match statement by checking all unhandled GameEvents and messages for events containing "Shoot" in their serialized form.
I am using the command
cargo run --release --bin gamestate -- "path/to/demo.dem"
with the modification listed below.src\demo\parser\gamestateanalyser.rs