#include "weapon_pickup.hpp"
#include "car_player.hpp"
#include "godot_cpp/classes/random_number_generator.hpp"
#include "utils/godot_macros.h"

namespace godot {
void WeaponPickup::_bind_methods() {
#define CLASSNAME WeaponPickup
}

void WeaponPickup::_enter_tree() { GDGAMEONLY();
    this->connect("body_entered", callable_mp(this, &WeaponPickup::body_entered));
}

void WeaponPickup::body_entered(Node3D *node) {
    CarPlayer *player = Object::cast_to<CarPlayer>(node);
    if(!player) return;
    switch(rng.randi() % 3) {
    case 0:
        player->activate_beacon();
        break;
    case 1:
        player->activate_shield();
        break;
    case 2:
        player->activate_turret();
    }
    this->queue_free();
}
}
