diff --git a/src/parser/src/e2e_test.rs b/src/parser/src/e2e_test.rs index 618086d5..d955082b 100644 --- a/src/parser/src/e2e_test.rs +++ b/src/parser/src/e2e_test.rs @@ -307,8 +307,7 @@ pub fn _create_ge_tests() { parse_ents: true, wanted_players: vec![], wanted_ticks: (0..5).into_iter().map(|x| x * 10000).collect_vec(), - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, @@ -682,8 +681,7 @@ pub fn _create_tests() { parse_ents: true, wanted_players: vec![], wanted_ticks: (0..5).into_iter().map(|x| x * 10000).collect_vec(), - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, @@ -1056,8 +1054,7 @@ 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_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, @@ -1082,8 +1079,7 @@ 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_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, @@ -1201,8 +1197,7 @@ mod tests { wanted_other_props: vec![], parse_ents: true, wanted_ticks: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), parse_projectiles: true, only_header: false, count_props: false, @@ -1211,8 +1206,8 @@ mod tests { order_by_steamid: false, }; - let mut wanted_player_prop_states: AHashMap = AHashMap::default(); - wanted_player_prop_states.insert( + let mut wanted_prop_states: AHashMap = AHashMap::default(); + wanted_prop_states.insert( "CCSGameRulesProxy.CCSGameRules.m_bBombPlanted".to_string(), Variant::Bool(true), ); @@ -1224,113 +1219,7 @@ mod tests { wanted_other_props: vec![], parse_ents: true, wanted_ticks: vec![], - wanted_player_prop_states: wanted_player_prop_states, - wanted_other_prop_states: AHashMap::default(), - parse_projectiles: true, - only_header: false, - count_props: false, - only_convars: false, - huffman_lookup_table: &huf2, - order_by_steamid: false, - }; - - let mut ds = Parser::new(settings, crate::parse_demo::ParsingMode::ForceMultiThreaded); - let mut ds_with_filter = Parser::new(settings_with_filter, crate::parse_demo::ParsingMode::ForceMultiThreaded); - let file = File::open("test_demo.dem").unwrap(); - let mmap = unsafe { MmapOptions::new().map(&file).unwrap() }; - let output = ds.parse_demo(&mmap).unwrap(); - let output_with_filter = ds_with_filter.parse_demo(&mmap).unwrap(); - - let positions = match output - .df - .get(&PLAYER_X_ID) - .unwrap() - .data - .clone() - .unwrap_or(VarVec::F32(vec![])) - { - VarVec::F32(positions_vec) => positions_vec, - _ => vec![], - }; - let bomb_prop_id = output - .prop_controller - .prop_infos - .iter() - .find(|prop| prop.prop_name == "CCSGameRulesProxy.CCSGameRules.m_bBombPlanted") - .map(|prop| prop.id) - .unwrap(); - let bomb = match output - .df - .get(&bomb_prop_id) - .unwrap() - .data - .clone() - .unwrap_or(VarVec::Bool(vec![])) - { - VarVec::Bool(bomb_vec) => bomb_vec, - _ => vec![], - }; - let manually_filtered_positions: Vec> = positions - .iter() - .zip(bomb.iter()) - .filter_map(|(xPos, bombPlanted)| match bombPlanted { - Some(true) => Some(*xPos), - _ => None, - }) - .collect(); - let automatically_filtered_positions = match output_with_filter - .df - .get(&PLAYER_X_ID) - .unwrap() - .data - .clone() - .unwrap_or(VarVec::F32(vec![])) - { - VarVec::F32(positions_vec) => positions_vec, - _ => vec![], - }; - - assert_eq!(manually_filtered_positions, automatically_filtered_positions); - } - - #[test] - fn test_parse_event_prop_state_filter() { - let huf = create_huffman_lookup_table(); - let huf2 = create_huffman_lookup_table(); - - let settings = ParserInputs { - wanted_players: vec![76561198244754626], - real_name_to_og_name: AHashMap::default(), - wanted_player_props: vec!["X".to_string(), "CCSGameRulesProxy.CCSGameRules.m_bBombPlanted".to_string()], - wanted_events: vec!["player_death".to_string()], - wanted_other_props: vec![], - parse_ents: true, - wanted_ticks: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), - parse_projectiles: true, - only_header: false, - count_props: false, - only_convars: false, - huffman_lookup_table: &huf, - order_by_steamid: false, - }; - - let mut wanted_player_prop_states: AHashMap = AHashMap::default(); - wanted_player_prop_states.insert( - "CCSGameRulesProxy.CCSGameRules.m_bBombPlanted".to_string(), - Variant::Bool(true), - ); - let settings_with_filter = ParserInputs { - wanted_players: vec![76561198244754626], - real_name_to_og_name: AHashMap::default(), - wanted_player_props: vec!["X".to_string()], - wanted_events: vec!["player_death".to_string()], - wanted_other_props: vec![], - parse_ents: true, - wanted_ticks: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: wanted_player_prop_states, + wanted_prop_states: wanted_prop_states, parse_projectiles: true, only_header: false, count_props: false, @@ -1410,8 +1299,7 @@ mod tests { wanted_other_props: vec!["CCSTeam.m_iScore".to_string()], parse_ents: true, wanted_ticks: vec![10000, 10001], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_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 d2a31ad9..c27f5e5c 100644 --- a/src/parser/src/first_pass/parser_settings.rs +++ b/src/parser/src/first_pass/parser_settings.rs @@ -28,8 +28,7 @@ pub struct ParserInputs<'a> { pub wanted_players: Vec, pub wanted_player_props: Vec, pub wanted_other_props: Vec, - pub wanted_player_prop_states: AHashMap, - pub wanted_other_prop_states: AHashMap, + pub wanted_prop_states: AHashMap, pub wanted_ticks: Vec, pub wanted_events: Vec, pub parse_ents: bool, @@ -66,8 +65,7 @@ pub struct FirstPassParser<'a> { pub wanted_players: AHashSet, pub wanted_ticks: AHashSet, pub wanted_other_props: Vec, - pub wanted_player_prop_states: AHashMap, - pub wanted_other_prop_states: AHashMap, + pub wanted_prop_states: AHashMap, pub wanted_events: Vec, pub parse_entities: bool, pub parse_projectiles: bool, @@ -109,8 +107,7 @@ impl<'a> FirstPassParser<'a> { prop_controller: PropController::new( inputs.wanted_player_props.clone(), inputs.wanted_other_props.clone(), - inputs.wanted_player_prop_states.clone(), - inputs.wanted_other_prop_states.clone(), + inputs.wanted_prop_states.clone(), inputs.real_name_to_og_name.clone(), false, &vec!["None".to_string()], @@ -138,8 +135,7 @@ 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_player_prop_states: inputs.wanted_player_prop_states.clone(), - wanted_other_prop_states: inputs.wanted_player_prop_states.clone(), + wanted_prop_states: inputs.wanted_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 843d67a8..96d0807f 100644 --- a/src/parser/src/first_pass/prop_controller.rs +++ b/src/parser/src/first_pass/prop_controller.rs @@ -65,8 +65,7 @@ pub struct PropController { pub event_with_velocity: bool, pub needs_velocity: bool, pub path_to_name: AHashMap<[i32; 7], String>, - pub wanted_player_prop_states: AHashMap, - pub wanted_other_prop_states: AHashMap, + pub wanted_prop_states: AHashMap, pub wanted_prop_state_infos: Vec, } @@ -95,8 +94,7 @@ impl PropController { pub fn new( wanted_player_props: Vec, wanted_other_props: Vec, - wanted_player_prop_states: AHashMap, - wanted_other_prop_states: AHashMap, + wanted_prop_states: AHashMap, real_name_to_og_name: AHashMap, needs_velocty: bool, wanted_events: &[String], @@ -115,8 +113,7 @@ impl PropController { event_with_velocity: !wanted_events.is_empty() && needs_velocty, path_to_name: AHashMap::default(), needs_velocity: needs_velocty, - wanted_player_prop_states: wanted_player_prop_states, - wanted_other_prop_states: wanted_other_prop_states, + wanted_prop_states: wanted_prop_states, wanted_prop_state_infos: vec![], } } @@ -136,7 +133,7 @@ impl PropController { }); someid += 1; } - if let Some(wanted_state) = self.wanted_player_prop_states.get(&(bn.to_string())) { + if let Some(wanted_state) = self.wanted_prop_states.get(&(bn.to_string())) { self.wanted_prop_state_infos.push(WantedPropStateInfo { base: PropInfo { id: someid2, @@ -165,7 +162,7 @@ impl PropController { is_player_prop: true, }) } - if let Some(wanted_state) = self.wanted_player_prop_states.get(&(custom_prop_name.to_string())) { + if let Some(wanted_state) = self.wanted_prop_states.get(&(custom_prop_name.to_string())) { self.wanted_prop_state_infos.push(WantedPropStateInfo { base: PropInfo { id: *custom_prop_id, @@ -192,7 +189,7 @@ impl PropController { is_player_prop: true, }); } - if let Some(wanted_state) = self.wanted_player_prop_states.get(&("game_time".to_string())) { + if let Some(wanted_state) = self.wanted_prop_states.get(&("game_time".to_string())) { self.wanted_prop_state_infos.push(WantedPropStateInfo { base: PropInfo { id: GAME_TIME_ID, @@ -214,18 +211,6 @@ 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, @@ -300,7 +285,7 @@ impl PropController { is_player_prop: false, }) } - if let Some(wanted_state) = self.wanted_player_prop_states.get(&prop_name.to_string()) { + if let Some(wanted_state) = self.wanted_prop_states.get(&prop_name.to_string()) { self.wanted_prop_state_infos.push(WantedPropStateInfo { base: PropInfo { id: f.prop_id as u32, @@ -316,22 +301,6 @@ impl PropController { 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, - 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: false, - }, - wanted_prop_state: wanted_state.clone(), - }); - } } } pub fn handle_prop(&mut self, full_name: &str, f: &mut ValueField, path: Vec) { diff --git a/src/parser/src/first_pass/sendtables.rs b/src/parser/src/first_pass/sendtables.rs index 54e4eebc..b08fad34 100644 --- a/src/parser/src/first_pass/sendtables.rs +++ b/src/parser/src/first_pass/sendtables.rs @@ -97,8 +97,7 @@ impl<'a> FirstPassParser<'a> { let mut prop_controller = PropController::new( self.wanted_player_props.clone(), self.wanted_other_props.clone(), - self.wanted_player_prop_states.clone(), - self.wanted_other_prop_states.clone(), + self.wanted_prop_states.clone(), self.real_name_to_og_name.clone(), needs_velocity(&self.wanted_player_props), &self.wanted_events, diff --git a/src/parser/src/second_pass/parser_settings.rs b/src/parser/src/second_pass/parser_settings.rs index 3686df53..c7f390d0 100644 --- a/src/parser/src/second_pass/parser_settings.rs +++ b/src/parser/src/second_pass/parser_settings.rs @@ -142,7 +142,6 @@ impl<'a> SecondPassParser<'a> { vec![], AHashMap::default(), AHashMap::default(), - AHashMap::default(), false, &["none".to_string()], ), diff --git a/src/python/src/lib.rs b/src/python/src/lib.rs index cb25d328..047f988c 100644 --- a/src/python/src/lib.rs +++ b/src/python/src/lib.rs @@ -103,8 +103,7 @@ impl DemoParser { wanted_players: vec![], wanted_player_props: vec![], wanted_other_props: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), wanted_events: vec![], parse_ents: false, wanted_ticks: vec![], @@ -132,8 +131,7 @@ impl DemoParser { wanted_players: vec![], wanted_player_props: vec![], wanted_other_props: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), wanted_events: vec!["all".to_string()], parse_ents: false, wanted_ticks: vec![], @@ -168,8 +166,7 @@ impl DemoParser { wanted_players: vec![], wanted_player_props: vec![], wanted_other_props: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), wanted_events: vec![], parse_ents: true, wanted_ticks: vec![], @@ -240,8 +237,7 @@ impl DemoParser { wanted_players: vec![], wanted_player_props: vec![], wanted_other_props: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), wanted_events: vec![], parse_ents: false, wanted_ticks: vec![], @@ -286,8 +282,7 @@ impl DemoParser { wanted_players: vec![], wanted_player_props: vec![], wanted_other_props: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), wanted_events: vec![], parse_ents: false, wanted_ticks: vec![], @@ -368,8 +363,7 @@ impl DemoParser { wanted_players: vec![], wanted_player_props: vec![], wanted_other_props: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), wanted_events: vec![], parse_ents: false, wanted_ticks: vec![], @@ -434,32 +428,19 @@ impl DemoParser { }) } - #[pyo3(signature = (event_name, *, player=None, other=None, player_states=None, other_states=None))] + #[pyo3(signature = (event_name, *, player=None, other=None))] pub fn parse_event( &self, py: Python<'_>, event_name: String, player: Option>, other: Option>, - player_states: Option>, - other_states: Option>, ) -> PyResult> { let wanted_player_props = player.unwrap_or_default(); let wanted_other_props = other.unwrap_or_default(); - let wanted_player_states: AHashMap = player_states - .unwrap_or_default() - .into_iter() - .map(|prop| (prop.prop, prop.state.0)) - .collect(); - let wanted_other_states = other_states - .unwrap_or_default() - .into_iter() - .map(|prop| (prop.prop, prop.state.0)) - .collect(); + let real_player_props = rm_user_friendly_names(&wanted_player_props); let real_other_props = rm_user_friendly_names(&wanted_other_props); - let real_wanted_player_states = rm_map_user_friendly_names(&wanted_player_states); - let real_wanted_other_states = rm_map_user_friendly_names(&wanted_other_states); let real_player_props = match real_player_props { Ok(real_props) => real_props, @@ -469,14 +450,6 @@ impl DemoParser { Ok(real_props) => real_props, Err(e) => return Err(PyValueError::new_err(format!("{e}"))), }; - let real_wanted_player_states = match real_wanted_player_states { - Ok(real_wanted_player_states) => real_wanted_player_states, - Err(e) => return Err(Exception::new_err(format!("{e}"))), - }; - let real_wanted_other_states = match real_wanted_other_states { - Ok(real_wanted_other_states) => real_wanted_other_states, - Err(e) => return Err(Exception::new_err(format!("{e}"))), - }; let mut real_name_to_og_name = AHashMap::default(); for (real_name, user_friendly_name) in real_player_props.iter().zip(&wanted_player_props) { @@ -485,18 +458,6 @@ impl DemoParser { for (real_name, user_friendly_name) in real_other_props.iter().zip(&wanted_other_props) { real_name_to_og_name.insert(real_name.clone(), user_friendly_name.clone()); } - for (real_name, user_friendly_name) in real_wanted_player_states - .keys() - .zip(wanted_player_states.keys()) - { - real_name_to_og_name.insert(real_name.clone(), user_friendly_name.clone()); - } - for (real_name, user_friendly_name) in real_wanted_other_states - .keys() - .zip(wanted_other_states.keys()) - { - real_name_to_og_name.insert(real_name.clone(), user_friendly_name.clone()); - } let settings = ParserInputs { real_name_to_og_name, @@ -504,8 +465,7 @@ impl DemoParser { wanted_player_props: real_player_props, wanted_other_props: real_other_props, wanted_events: vec![event_name], - wanted_player_prop_states: real_wanted_player_states, - wanted_other_prop_states: real_wanted_other_states, + wanted_prop_states: AHashMap::default(), parse_ents: true, wanted_ticks: vec![], parse_projectiles: false, @@ -527,32 +487,19 @@ impl DemoParser { Ok(event_series) } - #[pyo3(signature = (event_name, *, player=None, other=None, player_states=None, other_states=None))] + #[pyo3(signature = (event_name, *, player=None, other=None))] pub fn parse_events( &self, py: Python<'_>, event_name: Vec, player: Option>, other: Option>, - player_states: Option>, - other_states: Option>, ) -> PyResult> { let wanted_player_props = player.unwrap_or_default(); let wanted_other_props = other.unwrap_or_default(); - let wanted_player_states = player_states - .unwrap_or_default() - .into_iter() - .map(|prop| (prop.prop, prop.state.0)) - .collect(); - let wanted_other_states = other_states - .unwrap_or_default() - .into_iter() - .map(|prop| (prop.prop, prop.state.0)) - .collect(); + let real_player_props = rm_user_friendly_names(&wanted_player_props); let real_other_props = rm_user_friendly_names(&wanted_other_props); - let real_wanted_player_states = rm_map_user_friendly_names(&wanted_player_states); - let real_wanted_other_states = rm_map_user_friendly_names(&wanted_other_states); let real_player_props = match real_player_props { Ok(real_props) => real_props, @@ -562,14 +509,6 @@ impl DemoParser { Ok(real_props) => real_props, Err(e) => return Err(PyValueError::new_err(format!("{e}"))), }; - let real_wanted_player_states = match real_wanted_player_states { - Ok(real_wanted_player_states) => real_wanted_player_states, - Err(e) => return Err(Exception::new_err(format!("{e}"))), - }; - let real_wanted_other_states = match real_wanted_other_states { - Ok(real_wanted_other_states) => real_wanted_other_states, - Err(e) => return Err(Exception::new_err(format!("{e}"))), - }; let mut real_name_to_og_name = AHashMap::default(); for (real_name, user_friendly_name) in real_player_props.iter().zip(&wanted_player_props) { @@ -578,18 +517,6 @@ impl DemoParser { for (real_name, user_friendly_name) in real_other_props.iter().zip(&wanted_other_props) { real_name_to_og_name.insert(real_name.clone(), user_friendly_name.clone()); } - for (real_name, user_friendly_name) in real_wanted_player_states - .keys() - .zip(wanted_player_states.keys()) - { - real_name_to_og_name.insert(real_name.clone(), user_friendly_name.clone()); - } - for (real_name, user_friendly_name) in real_wanted_other_states - .keys() - .zip(wanted_other_states.keys()) - { - real_name_to_og_name.insert(real_name.clone(), user_friendly_name.clone()); - } let settings = ParserInputs { real_name_to_og_name, @@ -597,8 +524,7 @@ impl DemoParser { wanted_player_props: real_player_props, wanted_other_props: real_other_props, wanted_events: event_name, - wanted_player_prop_states: real_wanted_player_states, - wanted_other_prop_states: real_wanted_other_states, + wanted_prop_states: AHashMap::default(), parse_ents: true, wanted_ticks: vec![], parse_projectiles: false, @@ -625,8 +551,7 @@ impl DemoParser { wanted_players: vec![], wanted_player_props: vec![], wanted_other_props: vec![], - wanted_player_prop_states: AHashMap::default(), - wanted_other_prop_states: AHashMap::default(), + wanted_prop_states: AHashMap::default(), wanted_events: vec![], wanted_ticks: vec![], real_name_to_og_name: AHashMap::default(), @@ -652,42 +577,31 @@ impl DemoParser { Ok(out_hm.to_object(py)) } - #[pyo3(signature = (wanted_props, *, players=None, ticks=None, player_states=None, other_states=None))] + #[pyo3(signature = (wanted_props, *, players=None, ticks=None, prop_states=None))] pub fn parse_ticks( &self, py: Python, wanted_props: Vec, players: Option>, ticks: Option>, - player_states: Option>, - other_states: Option>, + prop_states: Option>, ) -> PyResult { let wanted_players = players.unwrap_or_default(); let wanted_ticks = ticks.unwrap_or_default(); - let wanted_player_states = player_states - .unwrap_or_default() - .into_iter() - .map(|prop| (prop.prop, prop.state.0)) - .collect(); - let wanted_other_states = other_states + let wanted_prop_states = prop_states .unwrap_or_default() .into_iter() .map(|prop| (prop.prop, prop.state.0)) .collect(); let real_props = rm_user_friendly_names(&wanted_props); - let real_wanted_player_states = rm_map_user_friendly_names(&wanted_player_states); - let real_wanted_other_states = rm_map_user_friendly_names(&wanted_other_states); + let real_wanted_prop_states = rm_map_user_friendly_names(&wanted_prop_states); let real_props = match real_props { Ok(real_props) => real_props, Err(e) => return Err(Exception::new_err(format!("{e}"))), }; - let real_wanted_player_states = match real_wanted_player_states { - Ok(real_wanted_player_states) => real_wanted_player_states, - Err(e) => return Err(Exception::new_err(format!("{e}"))), - }; - let real_wanted_other_states = match real_wanted_other_states { - Ok(real_wanted_other_states) => real_wanted_other_states, + let real_wanted_prop_states = match real_wanted_prop_states { + Ok(real_wanted_prop_states) => real_wanted_prop_states, Err(e) => return Err(Exception::new_err(format!("{e}"))), }; @@ -696,15 +610,9 @@ impl DemoParser { for (real_name, user_friendly_name) in real_props.iter().zip(&wanted_props) { real_name_to_og_name.insert(real_name.clone(), user_friendly_name.clone()); } - for (real_name, user_friendly_name) in real_wanted_player_states - .keys() - .zip(wanted_player_states.keys()) - { - real_name_to_og_name.insert(real_name.clone(), user_friendly_name.clone()); - } - for (real_name, user_friendly_name) in real_wanted_other_states + for (real_name, user_friendly_name) in real_wanted_prop_states .keys() - .zip(wanted_other_states.keys()) + .zip(wanted_prop_states.keys()) { real_name_to_og_name.insert(real_name.clone(), user_friendly_name.clone()); } @@ -715,8 +623,7 @@ impl DemoParser { wanted_player_props: real_props, wanted_other_props: vec![], wanted_events: vec![], - wanted_player_prop_states: real_wanted_player_states, - wanted_other_prop_states: real_wanted_other_states, + wanted_prop_states: real_wanted_prop_states, parse_ents: true, wanted_ticks, parse_projectiles: false, diff --git a/src/python/tests/signature_tests.py b/src/python/tests/signature_tests.py index c5a7296e..6796bbfe 100644 --- a/src/python/tests/signature_tests.py +++ b/src/python/tests/signature_tests.py @@ -66,8 +66,6 @@ def test_parse_event_signature(self): ) parser.parse_event("player_death", player=None, other=None) parser.parse_event("player_death", player=[], other=[]) - parser.parse_event("player_death", player_states=[WantedPropState("is_defusing", True)]) - parser.parse_event("player_death", other_states=[WantedPropState("is_bomb_planted", False)]) with self.assertRaises(TypeError): parser.parse_event("player_death", player=5, other=None) @@ -81,12 +79,6 @@ def test_parse_event_signature(self): with self.assertRaises(TypeError): parser.parse_event(5) - with self.assertRaises(AttributeError): - parser.parse_event("player_death", player_states=[{"prop": "is_defusing", "state": True}]) - - with self.assertRaises(AttributeError): - parser.parse_event("player_death", other_states=[{"prop": "is_bomb_planted", "state": True}]) - def test_parse_events_signature(self): parser = DemoParser(demo_path) @@ -109,8 +101,6 @@ def test_parse_events_signature(self): ) parser.parse_events(["player_death"], player=None, other=None) parser.parse_events(["player_death"], player=[], other=[]) - parser.parse_events(["player_death"], player_states=[WantedPropState("is_defusing", True)]) - parser.parse_events(["player_death"], other_states=[WantedPropState("is_bomb_planted", False)]) with self.assertRaises(TypeError): parser.parse_events(["player_death"], player=5, other=None) @@ -127,12 +117,6 @@ def test_parse_events_signature(self): with self.assertRaises(TypeError): parser.parse_events(5) - with self.assertRaises(AttributeError): - parser.parse_events(["player_death"], player_states=[{"prop": "is_defusing", "state": True}]) - - with self.assertRaises(AttributeError): - parser.parse_events(["player_death"], other_states=[{"prop": "is_bomb_planted", "state": True}]) - def test_parse_voice_signature(self): parser = DemoParser(demo_path) voice = parser.parse_voice() @@ -150,7 +134,7 @@ def test_parse_ticks_signature(self): parser.parse_ticks(["X", "Y"], players=[1, 2, 3], ticks=[1, 2, 3]) parser.parse_ticks(["X", "Y"], players=None, ticks=None) parser.parse_ticks(["X", "Y"], players=[], ticks=[]) - parser.parse_ticks(["X", "Y"], player_states=[WantedPropState("is_alive", True)], other_states=[WantedPropState("is_bomb_planted", True)]) + parser.parse_ticks(["X", "Y"], prop_states=[WantedPropState("is_alive", True), WantedPropState("is_bomb_planted", True)]) with self.assertRaises(TypeError): parser.parse_ticks(["X", "Y"], players=5, ticks=None) @@ -165,7 +149,7 @@ def test_parse_ticks_signature(self): parser.parse_ticks(5) with self.assertRaises(AttributeError): - parser.parse_ticks(["X", "Y"], player_states=[{"prop": "is_alive", "state": True}]) + parser.parse_ticks(["X", "Y"], prop_states=[{"prop": "is_alive", "state": True}]) if __name__ == "__main__":