local function BetterSonic(player)
if player.mo.skin ~= "sonic" then
return
end

player.charability = CA_JUMPTHOK
player.normalspeed = 45*FRACUNIT
player.maxspeed = 70*FRACUNIT
player.actionspd = player.speed + 15*FRACUNIT
end

local function BetterTails(player)
if player.mo.skin ~= "tails" then
return
end

if player.mo.state == S_PLAY_FLY and (player.cmd.buttons & BT_SPIN) or player.mo.state == S_PLAY_SWIM and (player.cmd.buttons & BT_SPIN) then
player.mo.state = S_PLAY_JUMP
player.pflags = $ + PF_SPINNING
end
end

local function BetterMetal(player)
if player.mo.skin ~= "metalsonic" then
return
end

player.charability = CA_SLOWFALL
player.normalspeed = 45*FRACUNIT
player.maxdash = 60*FRACUNIT
if player.pressedcustom1 == nil then
player.pressedcustom1 = false
end
if not player.pressedcustom1 and not P_PlayerInPain(player) and not (player.exiting) and (player.cmd.buttons & BT_CUSTOM1) then
P_Thrust(player.mo, player.mo.angle, 40*FRACUNIT)
player.pressedcustom1 = true
player.cooldown = 20
end
if not player.cooldown == 0 then
player.cooldown = $ - 1
end
if player.pressedcustom1 and not (player.cmd.buttons & BT_CUSTOM1) then
player.pressedcustom1 = false
end
end
local function BetterAmy(player)
if player.mo.skin ~= "amy" then
return
end

player.charability = CA_TWINSPIN
player.charability2 = CA2_SPINDASH
player.normalspeed = 37*FRACUNIT
player.maxdash = 45*FRACUNIT
player.mindash = 32*FACUNIT
end

local function BetterFang(player)
if player.mo.skin ~= "fang" then
return
end
if (player.cmd.buttons & BT_CUSTOM1)
	    and (P_IsObjectOnGround(player.mo))
		and (player.mo.state == S_PLAY_STND or player.mo.state == S_PLAY_WAIT or player.speed > 6*FRACUNIT)
		and not (player.speed > 9*FRACUNIT)
		and not (player.mo.state == S_PLAY_PAIN)
		and not (player.mo.state == S_PLAY_DEAD)
		and not (player.mo.state == S_PLAY_DRWN)
		player.charging = true
		player.mo.state = S_PLAY_ROLL
		S_StartSound(player.mo, sfx_spndsh)
	end	
	if (player.mo.state == S_PLAY_ROLL)
	and player.mo.skin == "fang"
	and not (player.cmd.buttons & BT_CUSTOM1)
	and not (player.pflags & PF_SPINNING)
		player.charging = false
		player.mo.state = S_PLAY_ROLL
		player.pflags = $ | PF_SPINNING
		P_Thrust(player.mo, player.mo.angle, 45*FRACUNIT)
		S_StartSound(player.mo, sfx_zoom)
	end
player.normalspeed = 34*FRACUNIT
end
local function FangSpindashNoMoving(player)
if (player.cmd.buttons & BT_CUSTOM1)
	    and (P_IsObjectOnGround(player.mo))
		and (player.mo.state == S_PLAY_STND or player.mo.state == S_PLAY_WAIT or player.speed > 6*FRACUNIT)
		and not (player.speed > 9*FRACUNIT)
		and not (player.mo.state == S_PLAY_PAIN)
		and not (player.mo.state == S_PLAY_DEAD)
		and not (player.mo.state == S_PLAY_DRWN)
		P_InstaThrust(player.mo, player.mo.angle, 0)
		end
		end
local function BetterKnux(player)
if player.mo.skin ~= "knuckles" then
return
end
if player.oldspeed == nil then
player.oldspeed = player.speed
end
if player.mo.state == S_PLAY_GLIDE then
player.oldspeed = player.speed
end
if player.mo.state == S_PLAY_GLIDE_LANDING then
player.mo.state = S_PLAY_RUN
P_InstaThrust(player.mo, player.mo.angle, player.oldspeed)
end
end
addHook("PlayerThink", BetterSonic)
addHook("PlayerThink", BetterTails)
addHook("PlayerThink", BetterMetal)
addHook("PlayerThink", BetterKnux)
addHook("PlayerThink", BetterAmy)
addHook("PlayerThink", BetterFang)
addHook("PlayerThink", FangSpindashNoMoving)