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

class BP_PickupSpecial : BP_Pickup
{
	//------------------------------------------------------------------------------------------------------------------------
    BP_PickupSpecial(kActor @actor)
	{
        super(@actor);
		radius = 10000.0f;
    }
	//------------------------------------------------------------------------------------------------------------------------
    void OnTick() override
	{
		FacePlayer(self);
		if (IsPlayerInRadius(self.Origin(), radius))
		{
			OnPickup();
		}
    }
	//------------------------------------------------------------------------------------------------------------------------
	void OnPickup() override
	{
		kDictMem@ def = self.Definition();
		if (def !is null)
		{
			kStr soundPath;
			int id;
			def.GetString("Sound", soundPath);
			def.GetInt("ID", id);
			SetSpecialPickups(id, true);
			Game.PlaySound(soundPath);
			
			int count = SpecialPickupCount();
			if (count >= 4)
			{
				Game.PrintLine(Game.GetLocalizedText(LTKey(8)) + " " + Game.GetLocalizedText(LTKey(9)), 0);
			}
			else
			{
				Game.PrintLine(LTKey(9), 0);
				Game.PrintLine("" + count + " " + Game.GetLocalizedText(LTKey(7)) + " 4", 1);
			}
		}
		self.MarkPersistentBit(false);
		self.Remove();
	}
	//------------------------------------------------------------------------------------------------------------------------
}
