freeslot( 
"SKINCOLOR_SUPER_GREEN_1",
"SKINCOLOR_SUPER_GREEN_2",
"SKINCOLOR_SUPER_GREEN_3",
"SKINCOLOR_SUPER_GREEN_4",
"SKINCOLOR_SUPER_GREEN_5"
)


skincolors[SKINCOLOR_SUPER_GREEN_1] = {
    name = "Super Green 1",
    ramp = {96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
},
    invcolor = SKINCOLOR_ORANGE,
    invshade = 9,
    chatcolor = V_BLUEMAP,
    accessible = false
}
skincolors[SKINCOLOR_SUPER_GREEN_2] = {
    name = "Super Green 2",
    ramp = {96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
},
    invcolor = SKINCOLOR_ORANGE,
    invshade = 9,
    chatcolor = V_BLUEMAP,
    accessible = false
}
skincolors[SKINCOLOR_SUPER_GREEN_3] = {
    name = "Super Green 3",
    ramp = {96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
},
    invcolor = SKINCOLOR_ORANGE,
    invshade = 9,
    chatcolor = V_BLUEMAP,
    accessible = false
}
skincolors[SKINCOLOR_SUPER_GREEN_4] = {
    name = "Super Green 4",
    ramp = {96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
},
    invcolor = SKINCOLOR_ORANGE,
    invshade = 9,
    chatcolor = V_BLUEMAP,
    accessible = false
}
skincolors[SKINCOLOR_SUPER_GREEN_5] = {
    name = "Super Green 5",
    ramp = {96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
},
    invcolor = SKINCOLOR_ORANGE,
    invshade = 9,
    chatcolor = V_BLUEMAP,
    accessible = false
}

addHook("MobjThinker", function(sonic)
	if (sonic and sonic.skin == "goosonic") //if you're sonic..
	and sonic.player.playerstate == PST_LIVE //you alive bruh?
		if sonic.player.bounceattack == nil //if the variable doesnt exist
			sonic.player.bounceattack = 0 //create variable
		end
		if sonic.player.bouncenumber == nil //if the variable doesnt exist
			sonic.player.bouncenumber = 0 //create variable
			sonic.player.justchangedbouncenumber = 0 //create variable
		end
		if P_IsObjectOnGround(sonic) //are you on the ground?
		and sonic.player.bounceattack == 0 //the player isnt bouncing
			sonic.player.bouncenumber = 0 //set it to zero!
		end
		if sonic.player.usedown == nil //if the variable doesnt exist
		or not (sonic.player.cmd.buttons & BT_USE) //not pressing the spin button?
			sonic.player.usedown = 0 //create variable
			sonic.player.justchangedbouncenumber = 0 //create variable
		end
		if P_IsObjectOnGround(sonic) //Is the player on the ground?
		and (sonic.player.cmd.buttons & BT_USE) //Is the player holding the spin button?
			sonic.player.usedown = 1 //Set it to one!
		end
		if sonic.player.pflags & PF_JUMPED //if the player has jumped
		and not (P_IsObjectOnGround(sonic)) //and you arent on the ground.
		and sonic.player.cmd.buttons & BT_USE //pressing custom2?
		and sonic.player.bounceattack == 0 //checking if the custom variable it set to 0
		and sonic.player.usedown == 0 //make sure you arent holding the spin button.
		and not (sonic.player.exiting) //not...exiting the level?
		and sonic.health //you're alive?
		and not (P_PlayerInPain(sonic.player)) //not hurt are you?
			sonic.player.bounceattack = 1 //set it to one!
			P_SetObjectMomZ(sonic, -45*FRACUNIT) //make the player "shoot" downward
			//P_SetObjectMomZ(sonic, FixedMul(-55*FRACUNIT, sonic.scale)) //make the player shoot downwards 
			sonic.player.pflags = $1|PF_THOKKED //force the player into a "thokked" state
		end

		if (sonic.eflags & MFE_JUSTHITFLOOR) //you're on the ground.
		and not (sonic.player.pflags & PF_SPINNING) //you arent spinning....somehow
		and not (sonic.player.pflags & PF_STARTDASH) //you arent doing a spindash
		and not (sonic.tracer and sonic.tracer.type == MT_TUBEWAYPOINT) //not in a...zoomtube?
		and sonic.player.bounceattack == 1 //our custom variable is one right...?
		and sonic.health //is the player alive..?
		and not (P_PlayerInPain(sonic.player)) //not hurt are you?
			if sonic.player.bouncenumber == 0 //if he hasnt bounced yet
			and sonic.player.justchangedbouncenumber == 0 //if he hasnt left the ground yet
				sonic.player.justchangedbouncenumber = 1 //now he has!
				sonic.player.bouncenumber = 1 //Set this to one!
				sonic.player.pflags = $1|PF_JUMPED //forcing the player into a jumping state.
				P_SetObjectMomZ(sonic, 12*FRACUNIT)
				if not (sonic.player.panim == PA_ROLL) //checking if the players animation is it's spinning anim.
					sonic.state = S_PLAY_ROLL //force the player into a spinning state.
				end
			end
			if sonic.player.bouncenumber == 1 //if it's currently on his first bounce
			and sonic.player.justchangedbouncenumber == 0 //if he hasnt left the ground yet
			and not (P_PlayerInPain(sonic.player)) //not hurt are you?
				sonic.player.justchangedbouncenumber = 1 //now he has!
				sonic.player.bouncenumber = 1 //set this to two!
				sonic.player.pflags = $1|PF_JUMPED //forcing the player into a jumping state.
				P_SetObjectMomZ(sonic, 13*FRACUNIT)
				if not (sonic.player.panim == PA_ROLL) //checking if the players animation is it's spinning anim.
					sonic.state = S_PLAY_ROLL //force the player into a spinning state.
				end
			end
			if sonic.player.bouncenumber == 2 //if it's currently on his second bounce
			and sonic.player.justchangedbouncenumber == 0 //if he hasnt left the ground yet
			and not (P_PlayerInPain(sonic.player)) //not hurt are you?
				sonic.player.justchangedbouncenumber = 1 //now he has!
				sonic.player.bouncenumber = 0 //set it back to zero
				sonic.state = S_PLAY_SPRING //change to spring frame, like is SLW!
				P_SetObjectMomZ(sonic, 17*FRACUNIT) //send the player upwards
				sonic.player.pflags = $1 & ~PF_JUMPED // No longer jumping. Don't land on an enemy!
			end
			sonic.player.bounceattack = 0 //set it back to zero.
			sonic.player.usedown = 1 //set it to one.

			S_StartSound(sonic, sfx_s3k77) //play a sound c:			
			
		end
		//some quick checks
		
		if sonic.player.bounceattack == 1 //checking our variable.
		and sonic.health //and you're alive
		and not (P_PlayerInPain(sonic.player)) //not hurt are you?
			P_SpawnThokMobj(sonic.player) //spawn the players thok object
			if not (sonic.player.panim == PA_ROLL) //checking if the players animation is it's spinning anim.
				sonic.state = S_PLAY_ROLL //force the player into a spinning state.
			end
			if (sonic.momz > (9000*P_MobjFlip(sonic))) // the player is going up...?  
				P_SetObjectMomZ(sonic, FixedMul(-55*FRACUNIT, sonic.scale)) //not anymore >.>
			end
		else 
			sonic.player.bounceattack = 0 //set it to 0
		end
		if sonic.player.bounceattack == 1 //checking if hes bouncing
			sonic.player.pflags = $1 & ~PF_SPINNING // you're no longer "spinning" if you were before
		end
		if not (sonic.player.pflags & PF_JUMPED) // if you are not actuallly jumping
			sonic.player.bounceattack = 0 //set this back to zero to be safe
		end
		
		if sonic.eflags & MFE_GOOWATER //is the player in THZ goop?
		or sonic.player.powers[pw_carry] //is the player being carried?
		//or sonic.player.pflags & PF_ROPEHANG //is the player on a ACZ ropehang?
			sonic.player.bounceattack = 0 //set to zero!
		end
		if not (sonic.player.pflags & PF_JUMPED) //if the player hasnt jumped
			sonic.player.bounceattack = 0 //set this to zero
		end
	end
end, MT_PLAYER)

addHook("PlayerThink", function(player)
if player.mo.skin == "goosonic" and player.mo.eflags & MFE_UNDERWATER
		player.powers[pw_underwater] = -1
	end
end)

addHook("PlayerThink", function(player)
	if player.mo.skin == "goosonic"
	local piss = P_SpawnMobjFromMobj(player.realmo, P_RandomRange(-20, 20) * FRACUNIT, P_RandomRange(-20, 20) * FRACUNIT, P_RandomRange(0, 50) * FRACUNIT, MT_GOOBUBBLE)
	piss.color = player.mo.color
	piss.colorized = true
	end
end)


local function allSpin(p)
  if p.mo and p.mo.skin == "goosonic" and not p.spectator and P_IsObjectOnGround(p.mo)--p.mo.skin check goes AFTER we've defined what p is, which is the player by default in this hook.
  
	//   p.mindash = 75*FRACUNIT --Why did you put mindash higher than the maxdash???
	//   p.maxdash = 50*FRACUNIT --Whatever, uncomment this if you want your old system back!
	
	 if not p.powers[pw_carry] and not p.powers[pw_nocontrol] and p.mo.state != S_PLAY_SPINDASH
	 and p.charability2 == CA2_SPINDASH and not (p.pflags & (PF_SPINDOWN|PF_SPINNING|PF_STARTDASH))
	 
		if (p.speed < 28*FRACUNIT) --Remove this part if you want the old system back.
		p.mindash = 28*FRACUNIT
		else
		//p.mindash = p.speed --Hey, let's just make this dependant on the player's speed instead
		p.mindash = p.speed + 10*FRACUNIT -- this one makes the mindash be boosted a bit
		end  
		
        P_InstaThrust(p.mo, p.mo.angle, 2*FRACUNIT)
	    p.mo.state = S_PLAY_SPINDASH
	    p.pflags = $ | (PF_SPINDOWN|PF_STARTDASH|PF_SPINNING)
	    S_StartSound(p.mo, sfx_spndsh)
		//p.mo.ghs = P_SpawnGhostMobj(p.mo) -- i don't like this ghost thing, it's kinda useless
		//p.mo.ghs.scale = (p.mo.scale*(p.mindash/FRACUNIT))/20
		//p.mo.ghs.destscale = p.mo.scale
		//p.mo.ghs.scalespeed = $*2
		//p.mo.ghs.flags = $|MF_NOCLIPHEIGHT|MF_NOCLIP & ~MF_SOLID
		//p.mo.ghs.z = p.mo.z-p.mo.ghs.scale*10
	    return true
    elseif (p.pflags & PF_SPINNING) and p.mo.state == S_PLAY_ROLL and
    not (p.pflags & (PF_SPINDOWN|PF_STARTDASH))
        p.mo.state = S_PLAY_RUN
		p.pflags = ($ & ~PF_SPINNING) | PF_SPINDOWN
	    //S_StartSound(p.mo, sfx_zoom) -- this sound is kinda weird so i'll just remove it
		P_Thrust(p.mo, p.mo.angle, 12*FRACUNIT)
		//P_SpawnGhostMobj(p.mo) -- this ghost is kinda useless too
		return true
    end
 end
end		
addHook("SpinSpecial", allSpin)

//Normal stuff
addHook("MobjCollide", function(mobj, playermobj)
	if playermobj.skin == "goosonic" and playermobj.player.dashmode >= 3*TICRATE and mobj.flags & MF_ENEMY then
		P_KillMobj(mobj, playermobj, playermobj)
	end
end)

addHook("MobjCollide", function(mobj, playermobj)
	if playermobj.skin == "goosonic" and playermobj.player.dashmode >= 3*TICRATE and mobj.flags & MF_MONITOR then
		P_KillMobj(mobj, playermobj, playermobj)
	end
end)

//Spikes
addHook("MobjCollide", function(mobj, playermobj)
	if playermobj.skin == "goosonic" and playermobj.player.dashmode >= 3*TICRATE  then
		P_KillMobj(mobj, playermobj, playermobj)
	end
end, MT_SPIKE)

addHook("MobjCollide", function(mobj, playermobj)
	if playermobj.skin == "goosonic" and playermobj.player.dashmode >= 3*TICRATE  then
		P_KillMobj(mobj, playermobj, playermobj)
	end
end, MT_WALLSPIKE)