A_FireBlasterPL1

From ZDoom Wiki
Jump to navigation Jump to search

A_FireBlasterPL1
(no parameter)

Fires one hitscan attack dealing 4d8 damage using a BlasterPuff, and plays the sound "weapons/blastershoot" on the WEAPON channel. When holding fire, the first shot is accurate but the following have a random horizontal spread of up to 5.625°.

If vertical bullet spread for weapons is enabled, the function applies a random vertical spread of up to 3.549° in addition to the horizontal one.

This codepointer is restricted to Blaster and derived classes.

ZScript definition

Note: The ZScript definition below is for reference and may be different in the current version of UZDoom. The most up-to-date version of this code can be found on UZDoom GitHub.
action void A_FireBlasterPL1()
	{
		if (player == null)
		{return;}

		Weapon weapon = player.ReadyWeapon;
		if (weapon != null)
		{
			if (!weapon.DepleteAmmo (weapon.bAltFire))
				return;
		}
		double pitch = BulletSlope();
		int damage = random[FireBlaster](1, 8) * 4;
		double ang = angle;
		if (player.refire)
		{
			ang += Random2[FireBlaster]() * (5.625 / 256);
			if (GetCVar ("vertspread") && !sv_novertspread)
			{
				pitch += Random2[FireBlaster]() * (3.549 / 256);
			}
		}
		LineAttack (ang, PLAYERMISSILERANGE, pitch, damage, 'Hitscan', "BlasterPuff");
		A_StartSound ("weapons/blastershoot", CHAN_WEAPON);
	}