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

class BPHealthPickup : ScriptObject
{
    kActor @self;
	float turnSpeed = Math::Deg2Rad(1);
	//------------------------------------------------------------------------------------------------------------------------
    BPHealthPickup(kActor @actor) {
        @self = actor;
    }
	//------------------------------------------------------------------------------------------------------------------------
    void OnTick(void) {
		self.Yaw() += turnSpeed;
		if (InRadius(self.Origin(), 75.0f)) {
			Game.PlaySound("sounds/shaders/health_pickup_1.ksnd");
			Game.PrintLine("$str_137", 0);
			int healthdif = Math::Max(100 - Player.Actor().Health(), 0);
			Player.Actor().Health() += healthdif < 25 ? healthdif : 25;
			self.Remove();
		}
    }
	//------------------------------------------------------------------------------------------------------------------------
    void OnSpawn(void) {
    }
	//------------------------------------------------------------------------------------------------------------------------
}
