Skip to main content

subtr_actor/stats/export/
positioning.rs

1use crate::*;
2
3use super::*;
4
5impl StatFieldProvider for PositioningStats {
6    fn visit_stat_fields(&self, visitor: &mut dyn FnMut(ExportedStat)) {
7        visitor(ExportedStat::float(
8            "positioning",
9            "active_game_time",
10            StatUnit::Seconds,
11            self.active_game_time,
12        ));
13        visitor(ExportedStat::float(
14            "positioning",
15            "avg_distance_to_ball",
16            StatUnit::UnrealUnits,
17            self.average_distance_to_ball(),
18        ));
19        visitor(ExportedStat::float(
20            "positioning",
21            "avg_distance_to_ball_possession",
22            StatUnit::UnrealUnits,
23            self.average_distance_to_ball_has_possession(),
24        ));
25        visitor(ExportedStat::float(
26            "positioning",
27            "avg_distance_to_ball_no_possession",
28            StatUnit::UnrealUnits,
29            self.average_distance_to_ball_no_possession(),
30        ));
31        visitor(ExportedStat::float(
32            "positioning",
33            "avg_distance_to_mates",
34            StatUnit::UnrealUnits,
35            self.average_distance_to_teammates(),
36        ));
37        visitor(ExportedStat::float(
38            "positioning",
39            "time_defensive_third",
40            StatUnit::Seconds,
41            self.time_defensive_zone,
42        ));
43        visitor(ExportedStat::float(
44            "positioning",
45            "time_neutral_third",
46            StatUnit::Seconds,
47            self.time_neutral_zone,
48        ));
49        visitor(ExportedStat::float(
50            "positioning",
51            "time_offensive_third",
52            StatUnit::Seconds,
53            self.time_offensive_zone,
54        ));
55        visitor(ExportedStat::float(
56            "positioning",
57            "time_defensive_half",
58            StatUnit::Seconds,
59            self.time_defensive_half,
60        ));
61        visitor(ExportedStat::float(
62            "positioning",
63            "time_offensive_half",
64            StatUnit::Seconds,
65            self.time_offensive_half,
66        ));
67        visitor(ExportedStat::float(
68            "positioning",
69            "time_behind_ball",
70            StatUnit::Seconds,
71            self.time_behind_ball,
72        ));
73        visitor(ExportedStat::float(
74            "positioning",
75            "time_level_with_ball",
76            StatUnit::Seconds,
77            self.time_level_with_ball,
78        ));
79        visitor(ExportedStat::float(
80            "positioning",
81            "time_in_front_of_ball",
82            StatUnit::Seconds,
83            self.time_in_front_of_ball,
84        ));
85        visitor(ExportedStat::float(
86            "positioning",
87            "time_demolished",
88            StatUnit::Seconds,
89            self.time_demolished,
90        ));
91        visitor(ExportedStat::float(
92            "positioning",
93            "time_no_teammates",
94            StatUnit::Seconds,
95            self.time_no_teammates,
96        ));
97        visitor(ExportedStat::float(
98            "positioning",
99            "time_most_back",
100            StatUnit::Seconds,
101            self.time_most_back,
102        ));
103        visitor(ExportedStat::float(
104            "positioning",
105            "time_most_forward",
106            StatUnit::Seconds,
107            self.time_most_forward,
108        ));
109        visitor(ExportedStat::float(
110            "positioning",
111            "time_mid_role",
112            StatUnit::Seconds,
113            self.time_mid_role,
114        ));
115        visitor(ExportedStat::float(
116            "positioning",
117            "time_other_role",
118            StatUnit::Seconds,
119            self.time_other_role,
120        ));
121        visitor(ExportedStat::float(
122            "positioning",
123            "time_closest_to_ball_team",
124            StatUnit::Seconds,
125            self.time_closest_to_ball_team,
126        ));
127        visitor(ExportedStat::float(
128            "positioning",
129            "time_closest_to_ball_absolute",
130            StatUnit::Seconds,
131            self.time_closest_to_ball_absolute,
132        ));
133        visitor(ExportedStat::float(
134            "positioning",
135            "time_farthest_from_ball",
136            StatUnit::Seconds,
137            self.time_farthest_from_ball,
138        ));
139        visitor(ExportedStat::float(
140            "positioning",
141            "percent_defensive_third",
142            StatUnit::Percent,
143            self.defensive_third_pct(),
144        ));
145        visitor(ExportedStat::float(
146            "positioning",
147            "percent_neutral_third",
148            StatUnit::Percent,
149            self.neutral_third_pct(),
150        ));
151        visitor(ExportedStat::float(
152            "positioning",
153            "percent_offensive_third",
154            StatUnit::Percent,
155            self.offensive_third_pct(),
156        ));
157        visitor(ExportedStat::float(
158            "positioning",
159            "percent_defensive_half",
160            StatUnit::Percent,
161            self.defensive_half_pct(),
162        ));
163        visitor(ExportedStat::float(
164            "positioning",
165            "percent_offensive_half",
166            StatUnit::Percent,
167            self.offensive_half_pct(),
168        ));
169        visitor(ExportedStat::float(
170            "positioning",
171            "percent_behind_ball",
172            StatUnit::Percent,
173            self.behind_ball_pct(),
174        ));
175        visitor(ExportedStat::float(
176            "positioning",
177            "percent_level_with_ball",
178            StatUnit::Percent,
179            self.level_with_ball_pct(),
180        ));
181        visitor(ExportedStat::float(
182            "positioning",
183            "percent_in_front_of_ball",
184            StatUnit::Percent,
185            self.in_front_of_ball_pct(),
186        ));
187        visitor(ExportedStat::float(
188            "positioning",
189            "percent_most_back",
190            StatUnit::Percent,
191            self.most_back_pct(),
192        ));
193        visitor(ExportedStat::float(
194            "positioning",
195            "percent_most_forward",
196            StatUnit::Percent,
197            self.most_forward_pct(),
198        ));
199        visitor(ExportedStat::float(
200            "positioning",
201            "percent_mid_role",
202            StatUnit::Percent,
203            self.mid_role_pct(),
204        ));
205        visitor(ExportedStat::float(
206            "positioning",
207            "percent_other_role",
208            StatUnit::Percent,
209            self.other_role_pct(),
210        ));
211        visitor(ExportedStat::float(
212            "positioning",
213            "percent_closest_to_ball_team",
214            StatUnit::Percent,
215            self.closest_to_ball_team_pct(),
216        ));
217        visitor(ExportedStat::float(
218            "positioning",
219            "percent_closest_to_ball_absolute",
220            StatUnit::Percent,
221            self.closest_to_ball_absolute_pct(),
222        ));
223        visitor(ExportedStat::float(
224            "positioning",
225            "percent_farthest_from_ball",
226            StatUnit::Percent,
227            self.farthest_from_ball_pct(),
228        ));
229    }
230}
231
232impl StatFieldProvider for PositioningTeamStats {
233    fn visit_stat_fields(&self, visitor: &mut dyn FnMut(ExportedStat)) {
234        visitor(ExportedStat::float(
235            "positioning",
236            "tracked_time",
237            StatUnit::Seconds,
238            self.tracked_time,
239        ));
240        visitor(ExportedStat::float(
241            "positioning",
242            "time_closest_to_ball_team",
243            StatUnit::Seconds,
244            self.time_closest_to_ball_team,
245        ));
246        visitor(ExportedStat::float(
247            "positioning",
248            "time_closest_to_ball_absolute",
249            StatUnit::Seconds,
250            self.time_closest_to_ball_absolute,
251        ));
252        visitor(ExportedStat::float(
253            "positioning",
254            "percent_closest_to_ball_team",
255            StatUnit::Percent,
256            self.closest_to_ball_team_pct(),
257        ));
258        visitor(ExportedStat::float(
259            "positioning",
260            "percent_closest_to_ball_absolute",
261            StatUnit::Percent,
262            self.closest_to_ball_absolute_pct(),
263        ));
264    }
265}