subtr-actor 0.6.0

Rocket League replay transformer
Documentation
use crate::*;

use super::*;

impl StatFieldProvider for CorePlayerStats {
    fn visit_stat_fields(&self, visitor: &mut dyn FnMut(ExportedStat)) {
        visitor(ExportedStat::signed(
            "core",
            "score",
            StatUnit::Count,
            self.score,
        ));
        visitor(ExportedStat::signed(
            "core",
            "goals",
            StatUnit::Count,
            self.goals,
        ));
        visitor(ExportedStat::signed(
            "core",
            "assists",
            StatUnit::Count,
            self.assists,
        ));
        visitor(ExportedStat::signed(
            "core",
            "saves",
            StatUnit::Count,
            self.saves,
        ));
        visitor(ExportedStat::signed(
            "core",
            "shots",
            StatUnit::Count,
            self.shots,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "goals_conceded_while_last_defender",
            StatUnit::Count,
            self.scoring_context.goals_conceded_while_last_defender,
        ));
        visitor(ExportedStat::float(
            "core",
            "average_goal_time_after_kickoff",
            StatUnit::Seconds,
            self.average_goal_time_after_kickoff(),
        ));
        visitor(ExportedStat::float(
            "core",
            "median_goal_time_after_kickoff",
            StatUnit::Seconds,
            self.median_goal_time_after_kickoff(),
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "kickoff_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_after_kickoff.kickoff_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "short_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_after_kickoff.short_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "medium_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_after_kickoff.medium_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "long_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_after_kickoff.long_goal_count,
        ));
        visitor(ExportedStat::float(
            "core",
            "shooting_percentage",
            StatUnit::Percent,
            self.shooting_percentage(),
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "counter_attack_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_buildup.counter_attack_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "sustained_pressure_goal_count",
            StatUnit::Count,
            self.scoring_context
                .goal_buildup
                .sustained_pressure_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "other_buildup_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_buildup.other_buildup_goal_count,
        ));
    }
}

impl StatFieldProvider for CoreTeamStats {
    fn visit_stat_fields(&self, visitor: &mut dyn FnMut(ExportedStat)) {
        visitor(ExportedStat::signed(
            "core",
            "score",
            StatUnit::Count,
            self.score,
        ));
        visitor(ExportedStat::signed(
            "core",
            "goals",
            StatUnit::Count,
            self.goals,
        ));
        visitor(ExportedStat::signed(
            "core",
            "assists",
            StatUnit::Count,
            self.assists,
        ));
        visitor(ExportedStat::signed(
            "core",
            "saves",
            StatUnit::Count,
            self.saves,
        ));
        visitor(ExportedStat::signed(
            "core",
            "shots",
            StatUnit::Count,
            self.shots,
        ));
        visitor(ExportedStat::float(
            "core",
            "average_goal_time_after_kickoff",
            StatUnit::Seconds,
            self.average_goal_time_after_kickoff(),
        ));
        visitor(ExportedStat::float(
            "core",
            "median_goal_time_after_kickoff",
            StatUnit::Seconds,
            self.median_goal_time_after_kickoff(),
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "kickoff_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_after_kickoff.kickoff_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "short_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_after_kickoff.short_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "medium_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_after_kickoff.medium_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "long_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_after_kickoff.long_goal_count,
        ));
        visitor(ExportedStat::float(
            "core",
            "shooting_percentage",
            StatUnit::Percent,
            self.shooting_percentage(),
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "counter_attack_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_buildup.counter_attack_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "sustained_pressure_goal_count",
            StatUnit::Count,
            self.scoring_context
                .goal_buildup
                .sustained_pressure_goal_count,
        ));
        visitor(ExportedStat::unsigned(
            "core",
            "other_buildup_goal_count",
            StatUnit::Count,
            self.scoring_context.goal_buildup.other_buildup_goal_count,
        ));
    }
}