#include "features/aimbot/AimbotFeature.h"

namespace ta::features::aimbot
{
    void AimbotFeature::initialize()
    {
        settings_cache_.refresh(settings_);
    }

    void AimbotFeature::on_application_tick()
    {
        AimbotSettings next = settings_.read();
        if (input_.poll_toggle(next.hotkey))
        {
            settings_.set_magic_bullet(!next.magic_bullet);
            next = settings_.read();
        }

        settings_cache_.publish_if_changed(next);
        gateway_.application_tick(next);
    }

    void AimbotFeature::on_game_tick()
    {
        gateway_.game_tick(current_settings());
    }

    void AimbotFeature::reset_session() noexcept
    {
        input_.reset();
        gateway_.reset_session();
    }

    AimbotSettings AimbotFeature::current_settings() const
    {
        return settings_cache_.current_or_default();
    }

}
