diff --git a/src/parser/src/e2e_test.rs b/src/parser/src/e2e_test.rs index 7f9be842..603ef241 100644 --- a/src/parser/src/e2e_test.rs +++ b/src/parser/src/e2e_test.rs @@ -307,7 +307,8 @@ pub fn _create_ge_tests() { parse_ents: true, wanted_players: vec![], wanted_ticks: (0..5).into_iter().map(|x| x * 10000).collect_vec(), - wanted_prop_states: AHashMap::default(), + wanted_player_prop_states: AHashMap::default(), + wanted_other_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, @@ -681,7 +682,8 @@ pub fn _create_tests() { parse_ents: true, wanted_players: vec![], wanted_ticks: (0..5).into_iter().map(|x| x * 10000).collect_vec(), - wanted_prop_states: AHashMap::default(), + wanted_player_prop_states: AHashMap::default(), + wanted_other_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, @@ -1054,7 +1056,8 @@ fn create_data() -> (DemoOutput, PropController, BTreeMap parse_ents: true, wanted_players: vec![], wanted_ticks: (0..5).into_iter().map(|x| x * 10000).collect_vec(), - wanted_prop_states: AHashMap::default(), + wanted_player_prop_states: AHashMap::default(), + wanted_other_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, @@ -1079,7 +1082,8 @@ fn create_data() -> (DemoOutput, PropController, BTreeMap parse_ents: true, wanted_players: vec![], wanted_ticks: (0..5).into_iter().map(|x| x * 10000).collect_vec(), - wanted_prop_states: AHashMap::default(), + wanted_player_prop_states: AHashMap::default(), + wanted_other_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, @@ -1195,7 +1199,8 @@ mod tests { wanted_other_props: vec!["CCSTeam.m_iScore".to_string()], parse_ents: true, wanted_ticks: vec![10000, 10001], - wanted_prop_states: AHashMap::default(), + wanted_player_prop_states: AHashMap::default(), + wanted_other_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, diff --git a/src/parser/src/first_pass/parser_settings.rs b/src/parser/src/first_pass/parser_settings.rs index 0a4bc844..47809432 100644 --- a/src/parser/src/first_pass/parser_settings.rs +++ b/src/parser/src/first_pass/parser_settings.rs @@ -28,7 +28,8 @@ pub struct ParserInputs<'a> { pub wanted_players: Vec, pub wanted_player_props: Vec, pub wanted_other_props: Vec, - pub wanted_prop_states: AHashMap, + pub wanted_player_prop_states: AHashMap, + pub wanted_other_prop_states: AHashMap, pub wanted_ticks: Vec, pub wanted_events: Vec, pub parse_ents: bool, @@ -65,7 +66,8 @@ pub struct FirstPassParser<'a> { pub wanted_players: AHashSet, pub wanted_ticks: AHashSet, pub wanted_other_props: Vec, - pub wanted_prop_states: AHashMap, + pub wanted_player_prop_states: AHashMap, + pub wanted_other_prop_states: AHashMap, pub wanted_events: Vec, pub parse_entities: bool, pub parse_projectiles: bool, @@ -107,7 +109,8 @@ impl<'a> FirstPassParser<'a> { prop_controller: PropController::new( inputs.wanted_player_props.clone(), inputs.wanted_other_props.clone(), - inputs.wanted_prop_states.clone(), + inputs.wanted_player_prop_states.clone(), + inputs.wanted_other_prop_states.clone(), inputs.real_name_to_og_name.clone(), false, &vec!["None".to_string()], @@ -135,7 +138,8 @@ impl<'a> FirstPassParser<'a> { wanted_players: AHashSet::from_iter(inputs.wanted_players.iter().cloned()), wanted_ticks: AHashSet::from_iter(inputs.wanted_ticks.iter().cloned()), wanted_other_props: inputs.wanted_other_props.clone(), - wanted_prop_states: inputs.wanted_prop_states.clone(), + wanted_player_prop_states: inputs.wanted_player_prop_states.clone(), + wanted_other_prop_states: inputs.wanted_player_prop_states.clone(), settings: &inputs, controller_ids: SpecialIDs::new(), id: 0, diff --git a/src/parser/src/first_pass/prop_controller.rs b/src/parser/src/first_pass/prop_controller.rs index 5f5cef67..eb2f8511 100644 --- a/src/parser/src/first_pass/prop_controller.rs +++ b/src/parser/src/first_pass/prop_controller.rs @@ -66,7 +66,8 @@ pub struct PropController { pub event_with_velocity: bool, pub needs_velocity: bool, pub path_to_name: AHashMap<[i32; 7], String>, - pub wanted_prop_states: AHashMap, + pub wanted_player_prop_states: AHashMap, + pub wanted_other_prop_states: AHashMap, pub wanted_prop_state_infos: Vec, } @@ -95,7 +96,8 @@ impl PropController { pub fn new( wanted_player_props: Vec, wanted_other_props: Vec, - wanted_prop_states: AHashMap, + wanted_player_prop_states: AHashMap, + wanted_other_prop_states: AHashMap, real_name_to_og_name: AHashMap, needs_velocty: bool, wanted_events: &[String], @@ -114,7 +116,8 @@ impl PropController { event_with_velocity: !wanted_events.is_empty() && needs_velocty, path_to_name: AHashMap::default(), needs_velocity: needs_velocty, - wanted_prop_states: wanted_prop_states, + wanted_player_prop_states: wanted_player_prop_states, + wanted_other_prop_states: wanted_other_prop_states, wanted_prop_state_infos: vec![], } } @@ -134,7 +137,7 @@ impl PropController { }); someid += 1; } - if let Some(wanted_state) = self.wanted_prop_states.get(&(bn.to_string())) { + if let Some(wanted_state) = self.wanted_player_prop_states.get(&(bn.to_string())) { self.wanted_prop_state_infos.push(WantedPropStateInfo { base: PropInfo { id: someid2, @@ -163,7 +166,7 @@ impl PropController { is_player_prop: true, }) } - if let Some(wanted_state) = self.wanted_prop_states.get(&(custom_prop_name.to_string())) { + if let Some(wanted_state) = self.wanted_player_prop_states.get(&(custom_prop_name.to_string())) { self.wanted_prop_state_infos.push(WantedPropStateInfo { base: PropInfo { id: *custom_prop_id, @@ -190,7 +193,7 @@ impl PropController { is_player_prop: true, }); } - if let Some(wanted_state) = self.wanted_prop_states.get(&("game_time".to_string())) { + if let Some(wanted_state) = self.wanted_player_prop_states.get(&("game_time".to_string())) { self.wanted_prop_state_infos.push(WantedPropStateInfo { base: PropInfo { id: GAME_TIME_ID, @@ -212,6 +215,18 @@ impl PropController { is_player_prop: false, }); } + if let Some(wanted_state) = self.wanted_other_prop_states.get(&("game_time".to_string())) { + self.wanted_prop_state_infos.push(WantedPropStateInfo { + base: PropInfo { + id: GAME_TIME_ID, + prop_type: PropType::GameTime, + prop_name: "game_time".to_string(), + prop_friendly_name: "game_time".to_string(), + is_player_prop: false, + }, + wanted_prop_state: wanted_state.clone(), + }); + } self.prop_infos.push(PropInfo { id: TICK_ID, @@ -286,7 +301,23 @@ impl PropController { is_player_prop: false, }) } - if let Some(wanted_state) = self.wanted_prop_states.get(&prop_name.to_string()) { + if let Some(wanted_state) = self.wanted_player_prop_states.get(&prop_name.to_string()) { + self.wanted_prop_state_infos.push(WantedPropStateInfo { + base: PropInfo { + id: f.prop_id as u32, + prop_type: *prop_type, + prop_name: prop_name.to_string(), + prop_friendly_name: self + .real_name_to_og_name + .get(&prop_name.to_string()) + .unwrap_or(&(prop_name.to_string())) + .to_string(), + is_player_prop: true, + }, + wanted_prop_state: wanted_state.clone(), + }); + } + if let Some(wanted_state) = self.wanted_other_prop_states.get(&prop_name.to_string()) { self.wanted_prop_state_infos.push(WantedPropStateInfo { base: PropInfo { id: f.prop_id as u32, @@ -297,7 +328,7 @@ impl PropController { .get(&prop_name.to_string()) .unwrap_or(&(prop_name.to_string())) .to_string(), - is_player_prop: false, // does this actually affect anything? + is_player_prop: false, }, wanted_prop_state: wanted_state.clone(), }); diff --git a/src/parser/src/first_pass/sendtables.rs b/src/parser/src/first_pass/sendtables.rs index b08fad34..54e4eebc 100644 --- a/src/parser/src/first_pass/sendtables.rs +++ b/src/parser/src/first_pass/sendtables.rs @@ -97,7 +97,8 @@ impl<'a> FirstPassParser<'a> { let mut prop_controller = PropController::new( self.wanted_player_props.clone(), self.wanted_other_props.clone(), - self.wanted_prop_states.clone(), + self.wanted_player_prop_states.clone(), + self.wanted_other_prop_states.clone(), self.real_name_to_og_name.clone(), needs_velocity(&self.wanted_player_props), &self.wanted_events,