//Thank you so much Zipper, I literally couldn't do this without you.
local function allSpin(p)
     if p.spectator then return end
	 if (p.speed > 5*FRACUNIT and p.pflags & PF_STARTDASH) then return true end
	   
	   p.mindash = 75*FRACUNIT
	   p.maxdash = 50*FRACUNIT
	
	  if P_IsObjectOnGround(p.mo) and p.mo.state != S_PLAY_SPINDASH and p.charability2 ==
 CA2_SPINDASH and not (p.pflags & (PF_USEDOWN|PF_SPINNING)) then
        
        p.cmomx = 5 * cos(p.mo.angle)
	    p.cmomy = 5 * sin(p.mo.angle)
	    p.mo.cmomx = p.cmomx
	    p.mo.cmomy = p.cmomy
	    p.dashspeed = p.mindash
	    p.mo.state = S_PLAY_SPINDASH
	    p.pflags = $ | (PF_USEDOWN|PF_STARTDASH|PF_SPINNING)
	    S_StartSound(p.mo, sfx_spndsh)
	    return true
    end
    if P_IsObjectOnGround(p.mo) and p.pflags & PF_SPINNING and p.mo.state == S_PLAY_ROLL and
not (p.pflags & (PF_USEDOWN|PF_STARTDASH)) then
        p.mo.state = S_PLAY_RUN
		p.pflags = ($ & ~PF_SPINNING) | PF_USEDOWN
		return true
    end
end	
	
addHook("SpinSpecial", allSpin)
