// File created by Sixten Hilborn

#include serverapi.jss

Func Heal(PlayerIndex, PowerupID)
{

	// LOL NEGATIVE IT WUZ
	Var ID = GetPlayerEntity(PlayerIndex);
	Var Pos = GetPos(ID);

	DealDmg(-1, // -1 is the environment (which means a character is healed/damaged by the environment)
		/*PlayerIndex*/ ID, -15.0, 0);


	Var SndPos[3];
	SndPos[0] = Pos[6];
	SndPos[1] = Pos[0];
	SndPos[2] = Pos[1];
	PlaySound("pickup.wav", -1, SndPos, -1);

	return 0;
}



Func DeathPulse(PlayerIndex, PowerupID)
{
	Var Bounds[2];
	Bounds[0] = 8;
	Bounds[1] = 8;


	Var PlayerId = GetPlayerEntity(PlayerIndex);

	Var Data[3];
	Data[0] = PlayerId; // PlayerIndex
	Data[1] = 1; // Bounces - 1
	Data[2] = 10.0; // Damage - 10 hp each

	Var Pos = GetPos(PlayerId);
	// Remove acceleration
	Pos[4] = Pos[5] = 0.0;

	Pos[8] = "bullet";
	Pos[9] = 0;
	Pos[10] = 1000;

	var Bullets = 100;

	for(Var i = 0; i < Bullets; i += 1)
	{
		Var ProjId = AddProj();
		Var Id = GetProjEntity(ProjId);

		// Set velocity
		Var Angle = 6.283185 * (float(i) / float(Bullets));
		Pos[2] = cos(Angle) * 1000.0;
		Pos[3] = sin(Angle) * 1000.0;
		SetPos(Id, Pos);

		SetProjInfo(ProjId, "", "bullet:bulletimpact", Bounds);

		SetEntData(Id, Data);
	}


	Var SndPos[3];
	SndPos[0] = Pos[6];
	SndPos[1] = Pos[0];
	SndPos[2] = Pos[1];
	PlaySound("pistol_shot.wav", -1, SndPos, 128);
	return 0;
}


Func _Main()
{
}
