Skip to main content

subtr_actor/stats/analysis_graph/nodes/
boost.rs

1use super::*;
2use crate::stats::calculators::*;
3use crate::*;
4
5/// Tracks per-player boost usage and pickups, accumulating boost stats from frame/event state.
6pub struct BoostNode {
7    calculator: BoostCalculator,
8}
9
10impl BoostNode {
11    pub fn new() -> Self {
12        Self::with_config(BoostCalculatorConfig::default())
13    }
14
15    pub fn with_config(config: BoostCalculatorConfig) -> Self {
16        Self {
17            calculator: BoostCalculator::with_config(config),
18        }
19    }
20}
21
22impl_analysis_node! {
23    node = BoostNode,
24    state = BoostCalculator,
25    name = "boost",
26    emitted_events = crate::stats::calculators::BOOST_EMITTED_EVENTS,
27    dependencies = [
28        frame_info_dependency(),
29        gameplay_state_dependency(),
30        player_frame_state_dependency(),
31        frame_events_state_dependency(),
32        player_vertical_state_dependency(),
33        live_play_dependency(),
34    ],
35    inputs = {
36        frame_info: FrameInfo,
37        gameplay_state: GameplayState,
38        player_frame_state: PlayerFrameState,
39        frame_events_state: FrameEventsState,
40        player_vertical_state: PlayerVerticalState,
41        live_play_state: LivePlayState,
42    },
43    evaluate = |node| {
44        node.calculator.update_parts(
45            frame_info,
46            gameplay_state,
47            player_frame_state,
48            frame_events_state,
49            player_vertical_state,
50            live_play_state,
51        )
52    },
53    finish = |node| {
54        node.calculator.finish_calculation()
55    },
56    state_ref = |node| &node.calculator,
57}