Skip to content

Commit

Permalink
fix interaction bug with velo and coord
Browse files Browse the repository at this point in the history
  • Loading branch information
LaihoE committed Nov 29, 2023
1 parent 190d89b commit ed625d5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/parser/src/sendtables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,14 @@ impl<'a> Parser<'a> {
map: AHashMap::default(),
};
if needs_velocity(&self.wanted_player_props) {
self.wanted_player_props
.extend(vec!["X".to_string(), "Y".to_string(), "Z".to_string()]);
self.added_temp_props
.extend(vec!["X".to_string(), "Y".to_string(), "Z".to_string()]);
let new_props = vec!["X".to_string(), "Y".to_string(), "Z".to_string()];

for prop in new_props {
if !self.wanted_player_props.contains(&prop) {
self.added_temp_props.push(prop.to_string());
self.wanted_player_props.push(prop.to_string());
}
}
}

// let mut fields: HashMap<i32, Field> = HashMap::default();
Expand Down
27 changes: 26 additions & 1 deletion src/python/tests/gen_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ def gen_prop_test(prop):
print(' assert_frame_equal(df, df_correct)')
print()

def gen_prop_interaction_test(props):
name = "_".join(props)
parser = DemoParser("tests/data/test.dem")
df = parser.parse_ticks(props, ticks=[x for x in range(100000) if x % 100 == 0])
df.to_parquet(f"tests/data/per_prop/{name}.parquet")


print(f'def test_{name}(self):')
print(' parser = DemoParser("tests/data/test.dem")')
print(f' df = parser.parse_ticks(["{props}"], ticks=[x for x in range(100000) if x % 100 == 0])')
print(f' df_correct = pd.read_parquet("tests/data/per_prop/{name}.parquet")')
print(' assert_frame_equal(df, df_correct)')
print()



def gen_event_test(event_name):
parser = DemoParser("tests/data/test.dem")
df = parser.parse_event(event_name)
Expand Down Expand Up @@ -53,8 +69,17 @@ def gen_event_with_prop_tests():
wanted_prop = "is_alive"
gen_prop_test(wanted_prop)"""

wanted_props = ["inventory"]
"""wanted_props = ["inventory"]
for prop in wanted_props:
gen_prop_test(prop)
gen_event_with_prop_tests()"""

"""props = ["X", "velocity_X"]
gen_prop_interaction_test(props)
"""

wanted_props = ["inventory"]
for prop in wanted_props:
gen_prop_test(prop)
gen_event_with_prop_tests()

0 comments on commit ed625d5

Please sign in to comment.