freeslot(
	"MT_ROLLER"
)

addHook("TouchSpecial", function(mo, pmo)
    if ((mo.state == S_ROLL_SPINDASH1) or (mo.state == S_ROLL_SPINDASH2) or (mo.state == S_ROLL_SPINDASH3) or (mo.state == S_ROLL_SPINDASH4) or (mo.state == S_ROLL_SPINDASH) or (mo.state == S_ROLL_SPINCOLOR) or (mo.state == S_ROLL_SPINSOUND) or (mo.state == S_ROLL_JUMP1) or (mo.state == S_ROLL_JUMP2) or (mo.state == S_ROLL_DASH1) or (mo.state == S_ROLL_DASH2) or (mo.state == S_ROLL_DASH3) or (mo.state == S_ROLL_DASH4))
    and not (pmo.player.powers[pw_invulnerability])
    and not (pmo.player.powers[pw_super])
	and not ((pmo.player.powers[pw_carry] == CR_NIGHTSMODE) and (pmo.player.pflags & PF_DRILLING))
        P_DamageMobj(pmo, mo, mo)
        return true
    end
end, MT_ROLLER)

//ITrying to make it spawn dust lol
addHook("MobjThinker", function(mo)
	if mo and mo.valid
		if P_IsObjectOnGround(mo)
			if ((mo.state == S_ROLL_SPINDASH1) or (mo.state == S_ROLL_SPINDASH2) or (mo.state == S_ROLL_SPINDASH3) or (mo.state == S_ROLL_SPINDASH4) or (mo.state == S_ROLL_SPINDASH) or (mo.state == S_ROLL_SPINCOLOR) or (mo.state == S_ROLL_SPINSOUND) or (mo.state == S_ROLL_DASH1) or (mo.state == S_ROLL_DASH2) or (mo.state == S_ROLL_DASH3) or (mo.state == S_ROLL_DASH4))
			P_SpawnMobj(mo.x-24*FRACUNIT, mo.y, mo.z, MT_DUST)
			end
		end
	end
end, MT_ROLLER)

addHook("MobjThinker", function(mo)
	if mo and mo.valid
		if P_IsObjectOnGround(mo) and ((mo.state == S_ROLL_JUMP3) or (mo.state == S_ROLL_JUMP2))
			P_SetMobjStateNF(mo, S_ROLL_PAUSE)
		end
	end
end, MT_ROLLER)