addHook("PlayerThink", function(player)
// only Gargoyle gets to shoot fire!
if (player.mo and player.mo.health and player.mo.skin == "gargoyle") then
//Initialize the burst-fire variable
if not (player.mo.burstfire) then
	player.mo.burstfire = 0
end
//check if "use" (aka spin) is pressed
if (player.cmd.buttons & BT_CUSTOM1)
and not (((player.cmd.buttons & BT_ATTACK) or (player.cmd.buttons & BT_FIRENORMAL)) and (player.pflags & PF_ATTACKDOWN)) //noope, no firing rings at the same time :E
and not (player.weapondelay) //no shooting when weapondelay hasn't gone back to 0 yet
and not (player.powers[pw_carry] & CR_NIGHTSMODE) //no shooting when NiGHTS Super Sonic!
and not (player.powers[pw_carry] & CR_ROPEHANG) //rope hangs use spin for letting go
and not (player.powers[pw_carry] & CR_MACESPIN) //control chains use spin for shifting angle I think?
and not (player.pflags & PF_TAGIT) //no shooting when tagged
and not (player.pflags & PF_STASIS) //no shooting when in stasis in tag mode either
and not (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT) //no shooting when following a zoomtube
and not (player.pflags & PF_SPINNING) //no shooting when ...spinning?
and not (player.mo.burstfire >= 5) then //Can't fire more that five flames in a row
	// fire away!
	local th = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z + player.mo.height/2, MT_DEMONFIRE)
	// missiles can't hurt their targets, note
	th.target = player.mo

	local an = player.mo.angle
	local slope = player.aiming
	local speed = th.info.speed
	if player.powers[pw_super] != 0 then
		speed = FixedMul($1, 3*FRACUNIT)
	end

	if player.mo.eflags & MFE_VERTICALFLIP
		th.flags2 = $1|MF2_OBJECTFLIP // flip gravity!
		th.z = $1 - th.height // remove your own height so this matches normal gravity setup
	end
	th.angle = an
	th.momx = FixedMul(speed, cos(an))
	th.momy = FixedMul(speed, sin(an))

	th.momx = FixedMul(th.momx, cos(slope))
	th.momy = FixedMul(th.momy, cos(slope))

	th.momz = FixedMul(speed, sin(slope))
	//Increment burstfire timer by 1
	player.mo.burstfire = $1 + 1
	//If player is not trying to fire, reset the burstfire timer
elseif player.mo.burstfire > 0 then
	player.mo.burstfire = 0
	player.weapondelay = TICRATE
	elseif player.powers[pw_super]
		player.weapondelay = 0
	end
end
end)
