subtr_actor/stats/analysis_graph/nodes/
stats_timeline_events.rs1use super::*;
2use crate::stats::calculators::*;
3use crate::*;
4
5#[derive(Debug, Clone, Default)]
6pub struct StatsTimelineEventsState {
7 pub events: ReplayStatsTimelineEvents,
8}
9
10pub struct StatsTimelineEventsNode {
11 state: StatsTimelineEventsState,
12}
13
14impl StatsTimelineEventsNode {
15 pub fn new() -> Self {
16 Self {
17 state: StatsTimelineEventsState::default(),
18 }
19 }
20}
21
22impl_analysis_node! {
23 node = StatsTimelineEventsNode,
24 state = StatsTimelineEventsState,
25 name = "stats_timeline_events",
26 dependencies = [
27 match_stats_dependency(),
28 demo_dependency(),
29 backboard_dependency(),
30 ceiling_shot_dependency(),
31 double_tap_dependency(),
32 fifty_fifty_dependency(),
33 rush_dependency(),
34 speed_flip_dependency(),
35 whiff_dependency(),
36 boost_dependency(),
37 ],
38 inputs = {
39 match_stats: MatchStatsCalculator,
40 demo: DemoCalculator,
41 backboard: BackboardCalculator,
42 ceiling_shot: CeilingShotCalculator,
43 double_tap: DoubleTapCalculator,
44 fifty_fifty: FiftyFiftyCalculator,
45 rush: RushCalculator,
46 speed_flip: SpeedFlipCalculator,
47 whiff: WhiffCalculator,
48 boost: BoostCalculator,
49 },
50 evaluate = |node| {
51 let mut timeline = match_stats.timeline().to_vec();
52 timeline.extend(demo.timeline().to_vec());
53 timeline.sort_by(|left, right| left.time.total_cmp(&right.time));
54
55 node.state.events = ReplayStatsTimelineEvents {
56 timeline,
57 backboard: backboard.events().to_vec(),
58 ceiling_shot: ceiling_shot.events().to_vec(),
59 double_tap: double_tap.events().to_vec(),
60 fifty_fifty: fifty_fifty.events().to_vec(),
61 rush: rush.events().to_vec(),
62 speed_flip: speed_flip.events().to_vec(),
63 whiff: whiff.events().to_vec(),
64 boost_pickups: boost.pickup_comparison_events().to_vec(),
65 };
66 Ok(())
67 },
68 state_ref = |node| &node.state,
69}