subtr_actor/stats/analysis_graph/nodes/
wall_aerial_shot.rs1use super::*;
2use crate::stats::calculators::*;
3use crate::*;
4
5pub struct WallAerialShotNode {
6 calculator: WallAerialShotCalculator,
7}
8
9impl WallAerialShotNode {
10 pub fn new() -> Self {
11 Self {
12 calculator: WallAerialShotCalculator::new(),
13 }
14 }
15}
16
17impl Default for WallAerialShotNode {
18 fn default() -> Self {
19 Self::new()
20 }
21}
22
23impl AnalysisNode for WallAerialShotNode {
24 type State = WallAerialShotCalculator;
25
26 fn name(&self) -> &'static str {
27 "wall_aerial_shot"
28 }
29
30 fn dependencies(&self) -> NodeDependencies {
31 vec![
32 frame_info_dependency(),
33 player_frame_state_dependency(),
34 frame_events_state_dependency(),
35 live_play_dependency(),
36 ]
37 }
38
39 fn evaluate(&mut self, ctx: &AnalysisStateContext<'_>) -> SubtrActorResult<()> {
40 let frame = ctx.get::<FrameInfo>()?;
41 let players = ctx.get::<PlayerFrameState>()?;
42 let frame_events = ctx.get::<FrameEventsState>()?;
43 let live_play_state = ctx.get::<LivePlayState>()?;
44 self.calculator
45 .update(frame, players, frame_events, live_play_state.is_live_play)
46 }
47
48 fn state(&self) -> &Self::State {
49 &self.calculator
50 }
51}
52
53pub(crate) fn boxed_default() -> Box<dyn AnalysisNodeDyn> {
54 Box::new(WallAerialShotNode::new())
55}