Skip to main content

subtr_actor/stats/export/
ceiling_shot.rs

1use crate::*;
2
3use super::*;
4
5impl StatFieldProvider for CeilingShotStats {
6    fn visit_stat_fields(&self, visitor: &mut dyn FnMut(ExportedStat)) {
7        visitor(ExportedStat::unsigned(
8            "ceiling_shot",
9            "count",
10            StatUnit::Count,
11            self.count,
12        ));
13        visitor(ExportedStat::unsigned(
14            "ceiling_shot",
15            "high_confidence_count",
16            StatUnit::Count,
17            self.high_confidence_count,
18        ));
19        visitor(ExportedStat::unsigned(
20            "ceiling_shot",
21            "is_last_ceiling_shot",
22            StatUnit::Count,
23            u32::from(self.is_last_ceiling_shot),
24        ));
25        if let Some(value) = self.last_ceiling_shot_time {
26            visitor(ExportedStat::float(
27                "ceiling_shot",
28                "last_ceiling_shot_time",
29                StatUnit::Seconds,
30                value,
31            ));
32        }
33        if let Some(value) = self.last_ceiling_shot_frame {
34            visitor(ExportedStat::unsigned(
35                "ceiling_shot",
36                "last_ceiling_shot_frame",
37                StatUnit::Count,
38                u32::try_from(value).unwrap_or(u32::MAX),
39            ));
40        }
41        if let Some(value) = self.time_since_last_ceiling_shot {
42            visitor(ExportedStat::float(
43                "ceiling_shot",
44                "time_since_last_ceiling_shot",
45                StatUnit::Seconds,
46                value,
47            ));
48        }
49        if let Some(value) = self.frames_since_last_ceiling_shot {
50            visitor(ExportedStat::unsigned(
51                "ceiling_shot",
52                "frames_since_last_ceiling_shot",
53                StatUnit::Count,
54                u32::try_from(value).unwrap_or(u32::MAX),
55            ));
56        }
57        if let Some(value) = self.last_confidence {
58            visitor(ExportedStat::float(
59                "ceiling_shot",
60                "last_confidence",
61                StatUnit::Percent,
62                value * 100.0,
63            ));
64        }
65        visitor(ExportedStat::float(
66            "ceiling_shot",
67            "average_confidence",
68            StatUnit::Percent,
69            self.average_confidence() * 100.0,
70        ));
71        visitor(ExportedStat::float(
72            "ceiling_shot",
73            "best_confidence",
74            StatUnit::Percent,
75            self.best_confidence * 100.0,
76        ));
77    }
78}