addHook("PlayerThink", function(player)
	for player in players.iterate do
		if player.mo and (player.mo.skin == "trii")
		and player.powers[pw_super] 
		and not player.hyper
		and not player.hasSuperMusic
			S_ChangeMusic("SUPERT", true, player)
		end
	end
end)

addHook("AbilitySpecial", function(player)
	if player.mo.skin == "trii"
		if not (player.pflags & PF_THOKKED)
			player.charability = CA_DOUBLEJUMP
	        player.pflags = $1 & ~PF_JUMPED
			P_SetObjectMomZ(player.mo, 10*FRACUNIT)
			P_Thrust(player.mo, player.mo.angle, 20*FRACUNIT)
			S_StartSound(player.mo, sfx_zoom)
			local thok = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_THOK)
			thok.color = player.mo.color
			player.mo.state = S_PLAY_SPRING
			player.pflags = $1|PF_THOKKED|PF_SPINNING
		end
	end
end)

addHook("ThinkFrame", do
	for player in players.iterate
	if player.mo and (player.mo.skin == "trii")
			and not(player.mo.eflags & MFE_UNDERWATER)
			and (player.pflags & PF_THOKKED)
			local fire = P_SpawnMobjFromMobj(player.realmo, P_RandomRange(-10, 10) * FRACUNIT, P_RandomRange(-10, 10) * FRACUNIT, 0, MT_FIREBALLTRAIL)				
            fire.momx = P_RandomRange(-4, 4)*FRACUNIT
			fire.momy = P_RandomRange(-4, 4)*FRACUNIT
			fire.momz = P_RandomRange(0, 4)*FRACUNIT
			local dashimage = P_SpawnGhostMobj(player.mo)
			dashimage.colorized = true
			dashimage.fuse = 10
			elseif (player.mo.eflags & MFE_UNDERWATER)
			and (player.pflags & PF_THOKKED)
			local fire = P_SpawnMobjFromMobj(player.realmo, P_RandomRange(-10, 10) * FRACUNIT, P_RandomRange(-10, 10) * FRACUNIT, 0, MT_SMALLBUBBLE)				
            fire.momx = P_RandomRange(-4, 4)*FRACUNIT
			fire.momy = P_RandomRange(-4, 4)*FRACUNIT
			fire.momz = P_RandomRange(0, 4)*FRACUNIT
			local dashimage = P_SpawnGhostMobj(player.mo)
			dashimage.colorized = false
			dashimage.fuse = 10
		end
	end
end)

// hello, im am just here to tell you that this is reusable use it for whatever you want
// just replace the skin name with your charater
// also you can add a new start thrust and so hight that you can get
// play around with the numbers see what you can make out of this
// like setting the "SetObjectMomZ" to i higher vaule to make a jump thok