-- this is the code where we deeesh
COM_AddCommand("pallette2", function(p)
p.conklerstable.pallette = 2
end)

COM_AddCommand("pallette3", function(p)
p.conklerstable.pallette = 3
end)

COM_AddCommand("pallette10", function(p)
p.conklerstable.pallette = 10
end)

local skin = "sonic"
COM_AddCommand("skintest", function(p,name)
	skin = name
end)

local function btntic(p,tic,enum)
	local btn = p.cmd.buttons
	if btn & enum
		tic = $+1
	else
		tic = 0
	end
	return tic
end

local function conklersafterimage(p)
	local afti = P_SpawnGhostMobj(p.mo)
	afti.colorized = true
	afti.fuse = 999
	afti.tics = 5
	if p.conklerstable.pallette == 1 then
	afti.color = L_Choose(SKINCOLOR_CONKLERSAIVLOO,SKINCOLOR_CONKLERSAIGED,SKINCOLOR_CONKLERSAIJELLOW,SKINCOLOR_CONKLERSAIVREEN,SKINCOLOR_CONKLERSAIERANGE,SKINCOLOR_CONKLERSAILURPLE)
	elseif p.conklerstable.pallette == 2 then
	afti.color = L_Choose(SKINCOLOR_CONKLERSAIWHITE,SKINCOLOR_CONKLERSAIBRAUN,SKINCOLOR_CONKLERSAIPANK)
	elseif p.conklerstable.pallette == 3 then
	afti.color = L_Choose(SKINCOLOR_CAIANTONLIME,SKINCOLOR_CAIANTONRED,SKINCOLOR_CAIANTONBLUE)
	elseif p.conklerstable.pallette == 10 then
	afti.color = p.mo.skincolor
	end
	if p.conklerstable.pallette == 3 or p.conklerstable.pallette == 3
	end
	afti.blendmode = AST_ADD
	afti.frame = TR_TRANS10|p.mo.frame|FF_SEMIBRIGHT
	afti.scale = p.mo.scale
end

addHook("PlayerThink",function(p)
if srb2p return end
	if not (p.mo and p.mo.valid) then return end
	local me = p.mo
	if p.conklerstable.transform == 1 then return end
	if (me.skin == CONK_SKIN)
		p.charability2 = CA2_NONE
		p.spindown = btntic(p,$,BT_USE)
		p.afterimagetime = $ or 0
		p.dashincrease = $ or 0
		local grounded = P_IsObjectOnGround(me)
		local inpain = P_PlayerInPain(p)
		local speed = FixedDiv(abs(FixedHypot(p.rmomx,p.rmomy)), me.scale)
		
		if (p.spindown)
			local cando = true
			if (not grounded)
			and (not p.afterimagetime)
				cando = false
			end
			
			if cando
				p.cmd.forwardmove = max($,40)
				
				P_MovePlayer(p)
				speed = FixedDiv(abs(FixedHypot(p.rmomx,p.rmomy)), me.scale)
				if p.powers[pw_shield] == SH_STAR
				P_Thrust(me,p.drawangle,1*FRACUNIT)
				A_Sparkling(p.mo,MT_STAR_STAR)
				elseif speed < skins[me.skin].runspeed
				and grounded
					P_Thrust(me,p.drawangle,skins[me.skin].normalspeed-(speed/2))
				end
				p.skidtime = 0
				
				p.drawangle = me.angle
				if me.state ~= S_PLAY_DASH
					me.state = S_PLAY_DASH
				end
				
				p.powers[pw_strong] = $|(STR_ANIM|STR_PUNCH|STR_WALL|STR_STOMP|STR_SPIKE)
				
				p.afterimagetime = max(1,$)
				if grounded
					if p.dashincrease < 10*(20*TICRATE)
						p.dashincrease = $+10
						p.normalspeed = $+p.dashincrease
					end
				end
			end
		else
			if grounded
			or inpain
				if p.afterimagetime
				or p.dashincrease
					p.afterimagetime = 0
					p.dashincrease = 0
					p.normalspeed = skins[me.skin].normalspeed
					if me.state == S_PLAY_DASH
						me.state = S_PLAY_WALK
						P_MovePlayer(p)
					end
				end
			end
		end
		
		if (p.afterimagetime)
			p.afterimagetime = $+1
			if not (leveltime % 2)
				conklersafterimage(p)
			end
		end
	end
	
end)