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

//(2) Health -32768..32767 (volocity z)

class BP_Jumppad : ScriptObject
{
    kActor @self;
	float radius = 5625.0f;
	//------------------------------------------------------------------------------------------------------------------------
    BP_Jumppad(kActor @actor)
	{
        @self = actor;
		if (GetPlayerCharacter() != PLAYER_CHAR_HUMMER)
		{
			self.Remove();
		}
		self.Pitch() = Math::Deg2Rad(180.0f);
		self.Origin().z += 10.24f;
    }
	//------------------------------------------------------------------------------------------------------------------------
    void OnTick()
	{
		//and has power from picking up rope arrows
		if (IsPlayerInRadius(self.Origin(), radius))
		{
			kActor@ pActor = Player.Actor().CastToActor();
			if (pActor.OnGround())
			{
				float velZ = float(self.SpawnParams(2)) / 10.0f;
				pActor.Velocity().z += velZ;
			}
		}
    }
	//------------------------------------------------------------------------------------------------------------------------
    void OnSpawn()
	{
    }
	//------------------------------------------------------------------------------------------------------------------------
}
