#include "scripts/bp_common.txt"
#include "scripts/common.txt"

class BPCellPickup : ScriptObject
{
    kActor @self;
	float turnSpeed = Math::Deg2Rad(1);
	//------------------------------------------------------------------------------------------------------------------------
    BPCellPickup(kActor @actor) {
        @self = actor;
    }
	//------------------------------------------------------------------------------------------------------------------------
    void OnTick(void) {
		self.Yaw() += turnSpeed;
		if (InRadius(self.Origin(), 75.0f)) {
			Game.PlaySound("sounds/shaders/generic_3_energy_pickup.ksnd");
			Game.PrintLine("$str_132", 0);
			if (Player.HasWeapon(TW_WEAPON_PULSERIFLE)) {
				Player.GiveWeapon(TW_WEAPON_PULSERIFLE, 50);
			} else if (Player.HasWeapon(TW_WEAPON_LASERRIFLE)) {
				Player.GiveWeapon(TW_WEAPON_LASERRIFLE, 50);
			} else if (Player.HasWeapon(TW_WEAPON_ACCELERATOR)) {
				Player.GiveWeapon(TW_WEAPON_ACCELERATOR, 50);
			}
			self.Remove();
		}
    }
	//------------------------------------------------------------------------------------------------------------------------
    void OnSpawn(void) {
    }
	//------------------------------------------------------------------------------------------------------------------------
}
