if GS_RAILS_SKINS==nil rawset(_G,"GS_RAILS_SKINS",{}) end  --Make sure your own lump has this line too!

local RAIL = GS_RAILS if RAIL and RAIL.blockload return end --Don't include this part in your own file
if GS_RAILS_SKINS["fang"] return end

--Fang is a bouncy boy, but sucks at balancing.
GS_RAILS_SKINS["fang"] = {}
local SKIN = GS_RAILS_SKINS["fang"]

SKIN["S_SKIN"] = {
SIDEHOP = 11, --Painfully slow...
SIDEHOPARC = 33, --...but look at that AIR he's catching!
SIDEHOPTIME = 22,
SIDEFLIP = SPR2_BNCE, --Has a fancy bounce-sideflip for his sidehop..

CROUCH = false, 
AUTOBALANCE = false,
MUSTBALANCE = true, --Balance well or ELSE.
HEROESTWIST = 25, --The best Twist Drive.
MAXSPEED = 155, --Fang's max speed is the second slowest.

NOSIDEHOPGFX = 3,
}

--Fang bounces way high off rails instead of jumping.
SKIN["CustomJump"] = function(p, s, GS)
	if GS_RAILS.GrindState(s, "hang")
	or GS.walljump and GS.walljump.timer
	or GS.JumpRamp and GS.JumpRamp.timer
	or GS.LTAB and GS.LTAB.snappedtofloor==true
		return --
	end
	local ZFLIP = P_MobjFlip(s) or 1
	GS_RAILS.ExitRail(s, true, "jump")
	
	for i = 1,5 P_SpawnSkidDust(p, 64<<16) end
	s.momx,s.momy = $*3/4,$*3/4 --Fang trades speed for more height here.
	s.momz = $+(9*s.scale*ZFLIP)
	if (s.momz*ZFLIP < 18*s.scale)
		s.momz = 18*s.scale*ZFLIP
	end	
	s.state = S_PLAY_BOUNCE
	S_StartSound(s, sfx_boingf) --Play bounce sound instead of rail hop.
	p.pflags = $|PF_JUMPDOWN|PF_NOJUMPDAMAGE|PF_THOKKED|PF_BOUNCING & ~(PF_SHIELDABILITY|PF_JUMPED|PF_SPINNING)
	
	s.rollangle,s.spriteyoffset,s.spritexoffset = 0,-4<<16,0 --Bouncy effect.
	s.spritexscale,s.spriteyscale = 30000,105500
	GS.stretch = {timer = 8, Xspeed = 3950, Yspeed = 5000}	
	
	GS.justtouchedrailthing = 9
	GS.cannotgrind = 9
	
	return true --This returns true, so completely overrides the regular jump!
end

SKIN["CustomSideHop"] = function(p, s, GS,rail, SIDEJUMP)
	if GS_RAILS.GrindState(s, "hang") return end
	S_StopSoundByID(s, sfx_gsral9)
	S_StartSound(s, sfx_boingf) --Play bounce sound instead of rail hop.
	
	s.rollangle,s.spriteyoffset,s.spritexoffset = 0,-4<<16,0 --Bouncy effect.
	s.spritexscale,s.spriteyscale = 30000,105500
	GS.stretch = {timer = 8, Xspeed = 3950, Yspeed = 5000}	
	
	return "nostretch"
end

SKIN["PlayerThink"] = function(p, s, GS,rail)
	if GS.railswitching and not GS.grinding
		if (GS.railswitching >= 18)
			GS.forcesprite = (GS.railswitching==18) and SPR2_BNCE or SPR2_LAND
		end
		p.cmd.sidemove = 0
	end
end