//original addon by luigi budd

rawset(_G, "PTAIinit", function(p)
	p.ptaiinit = 1
	p.ptaiframewait = 0
	p.ptaicolor = 1
//	p.ptaistyle = 1,
//	p.ptaispeed = 0,
	
	CONS_Printf(p, "Adding the funny Pizza Tower Variabls")
	CONS_Printf(p, "\x82"+"Check out"+"\x86"+" ptafterimageshelp"+"\x82 "+"for options!")

	return true
end)

//pretty much just soap_cos_speedometer
COM_AddCommand("ptafterimageshelp", function(p)
	if not p or not p.ptaiinit or not p.valid
        CONS_Printf(p, "\x85"+"You aren't valid or the Pizza Tower Variables aren't!")
        return
	end
	
	CONS_Printf(p, "PT Afterframes has 2 options you can choose, which are saved automatically.")
	CONS_Printf(p, "\x86ptafterimagesstyle -\x82 Sets the style of the afterimages.")
	CONS_Printf(p, "\x86ptafterimagesactive -\x82 Sets the activation method of the afterimages.")
	
end)

COM_AddCommand("sonkiafterimagesstyle", function(p, arg)
	if not p or not p.valid
        CONS_Printf(p, "\x85"+"You don't exist yet!")
        return
	end
	
	local prevstyle
	local argV
	
	if arg
		argV = tonumber(arg)
		prevstyle = p.ptaistyle
		p.ptaistyle = argV
		if not argV
		or argV > 2
		or argV < 1
			p.ptaistyle = prevstyle
			CONS_Printf(p, "\x85"+"Value is too low! Choose either 1 or 2.")
			return
		end
		if io and p == consoleplayer
			local file = io.openlocal("client/pizzatowerai/sonkistyle.dat", "w+")
			file:write(argV)
			file:close()
		end

		CONS_Printf(p, "Style set to "+"\x82"+arg+"\x80"+".")
	else
		CONS_Printf(p, "Changes the colors of the Pizza Tower Afterimages.")
		CONS_Printf(p, "This has 2 styles available:")
		CONS_Printf(p, "1: Sonki Blue") 
		CONS_Printf(p, "2: Luigi Budd!?!?!?")
		CONS_Printf(p, "Current style is \x82" + p.ptaistyle+"\x80"+".") 
	end
end)

COM_AddCommand("ptafterimagesactive", function(p, arg)
	if not p  or not p.valid
        CONS_Printf(p, "\x85"+"You don't exist yet!")
        return
	end
	
	local prevstyle
	local argV
	
	if arg
		argV = tonumber(arg)
		prevstyle = p.ptaispeed
		p.ptaispeed = argV
		if not argV
		or argV > 1
		or argV < 0
			p.ptaispeed = prevstyle
			CONS_Printf(p, "\x85"+"Value is too low! Choose either 0 or 1.")
			return
		end
		if io and p == consoleplayer
			local file = io.openlocal("client/pizzatowerai/activation.dat", "w+")
			file:write(argV)
			file:close()
		end

		CONS_Printf(p, "Style set to "+"\x82"+argV+"\x80"+".")
	else
		CONS_Printf(p, "Sets what makes afterimages.")
		CONS_Printf(p, "This has 2 styles available:")
		CONS_Printf(p, "0: Default (Shoes and Dashmode only)") 
		CONS_Printf(p, "1: Speed (Shoes, Dashmode and speed)")
		CONS_Printf(p, "Current style is \x82" + p.ptaispeed+"\x80"+".") 
	end
end)


freeslot("SKINCOLOR_AIREALLYRED")
freeslot("SKINCOLOR_AIREALLYGREEN")
freeslot("SKINCOLOR_AIREALLYBLUE")
freeslot("SKINCOLOR_AIREALLYPURP")

skincolors[SKINCOLOR_AIREALLYRED] = {
    name = "Really Red",
    ramp = {35,35,35,35,35,35,35,35,35,35,35,41,41,41,41,41},
    invcolor = SKINCOLOR_AIREALLYGREEN,
    invshade = 0,
    chatcolor = V_REDMAP,
    accessible = true
}
//freeslot("SKINCOLOR_SOAPAIREALLYGREEN")

skincolors[SKINCOLOR_AIREALLYGREEN] = {
    name = "Really Green",
    ramp = {100,100,100,100,100,100,100,100,100,100,100,191,191,191,191,191},
    invcolor = SKINCOLOR_AIREALLYRED,
    invshade = 0,
    chatcolor = V_GREENMAP,
    accessible = true
}

skincolors[SKINCOLOR_AIREALLYBLUE] = {
    name = "Really Blue",
    ramp = {136,136,136,136,136,136,136,136,136,136,136,138,138,138,138,138},
    invcolor = SKINCOLOR_AIREALLYPURP,
    invshade = 0,
    chatcolor = V_SKYMAP,
    accessible = true
}

skincolors[SKINCOLOR_AIREALLYPURP] = {
    name = "Really Pink",
    ramp = {163,163,163,163,163,163,163,163,163,163,163,186,186,186,186,186},
    invcolor = SKINCOLOR_AIREALLYBLUE,
    invshade = 0,
    chatcolor = V_ROSYMAP,
    accessible = true
}