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 boost_dependency(),
36 ],
37 inputs = {
38 match_stats: MatchStatsCalculator,
39 demo: DemoCalculator,
40 backboard: BackboardCalculator,
41 ceiling_shot: CeilingShotCalculator,
42 double_tap: DoubleTapCalculator,
43 fifty_fifty: FiftyFiftyCalculator,
44 rush: RushCalculator,
45 speed_flip: SpeedFlipCalculator,
46 boost: BoostCalculator,
47 },
48 evaluate = |node| {
49 let mut timeline = match_stats.timeline().to_vec();
50 timeline.extend(demo.timeline().to_vec());
51 timeline.sort_by(|left, right| left.time.total_cmp(&right.time));
52
53 node.state.events = ReplayStatsTimelineEvents {
54 timeline,
55 backboard: backboard.events().to_vec(),
56 ceiling_shot: ceiling_shot.events().to_vec(),
57 double_tap: double_tap.events().to_vec(),
58 fifty_fifty: fifty_fifty.events().to_vec(),
59 rush: rush.events().to_vec(),
60 speed_flip: speed_flip.events().to_vec(),
61 boost_pickups: boost.pickup_comparison_events().to_vec(),
62 };
63 Ok(())
64 },
65 state_ref = |node| &node.state,
66}