--Command to burn Golden Shoes. idk, thought it was a funny way to get rid of the shoes.
local function BurnGoldenShoesToACrisp(p)
	if not p.lightdashenable
		CONS_Printf(p, "You can't burn what you don't have.") return --
	elseif not (p.mo and p.mo.valid and p.mo.health)
		CONS_Printf(p, "Sir? You appear to not exist.") return --
	end local s = p.mo
	if p.lddiscount == 2 //Nice, now that's a good price!
		S_StartSound(nil, sfx_bubbl2)
		print(p.name+" is making goldenshoes stew!")
		P_SpawnMobjFromMobj(s, FixedMul(80*s.scale, cos(s.angle)), FixedMul(80*s.scale, sin(s.angle)), 0, MT_HMSFLAMEREST)
	elseif p.lddiscount == 1
		S_StartSound(nil, sfx_s3k43)
		print(p.name+" just scorched their shoes alive!")
		P_SpawnMobjFromMobj(s, FixedMul(80*s.scale, cos(s.angle)), FixedMul(80*s.scale, sin(s.angle)), 0, MT_BOSSEXPLODE)
		P_SpawnMobjFromMobj(s, FixedMul(80*s.scale, cos(s.angle)), FixedMul(40*s.scale, sin(s.angle)), 0, MT_BOSSEXPLODE)
		P_SpawnMobjFromMobj(s, FixedMul(40*s.scale, cos(s.angle)), FixedMul(80*s.scale, sin(s.angle)), 0, MT_BOSSEXPLODE)
	elseif p.lddiscount == 0
		S_StartSound(nil, sfx_koopfr)
		print(p.name+" brutally murdered their boots!")
		P_SpawnMobjFromMobj(s, 0,0,0, MT_CYBRAKDEMON_VILE_EXPLOSION)
		P_SpawnMobjFromMobj(s, FixedMul(30*s.scale, cos(s.angle)), FixedMul(30*s.scale, sin(s.angle)), 0, MT_CYBRAKDEMON_VILE_EXPLOSION)
		P_SpawnMobjFromMobj(s, FixedMul(30*s.scale, cos(s.angle)), FixedMul(30*s.scale, sin(s.angle)), 0, MT_CYBRAKDEMON_VILE_EXPLOSION)
	else
		S_StartSound(nil, sfx_mario7)
		print(p.name+" burned their fancy kicks!")
		P_SpawnMobjFromMobj(s, FixedMul(10*s.scale, cos(s.angle)), FixedMul(10*s.scale, sin(s.angle)), 0, MT_CYBRAKDEMON_VILE_EXPLOSION)
	end
	p.lightdashenable = 0 --Now remove Golden Shoes property.
end
COM_AddCommand("burnsmsorders", BurnGoldenShoesToACrisp, 0)

--An old command from SMS' inception to buy Golden Shoes anywhere. I see no reason to remove it.
COM_AddCommand("smsorders", function(p, v2) if (gamestate!=GS_LEVEL) return end --
	v2 = v2 and string.lower(v2) or " "
	if v2 == "glitchydebugthrow"  --Enable debug throw, letting SMS pick up and anything.
		if (SMS_Admin(p) > 1)
			CONS_Printf(p, "\x85"+"A server admin is needed for this!") return --
		end
		if p.glitchydebugthrow
			S_StartSound(nil, sfx_thok)
			print("\x85"+"SMS' glitchy debug throw has now been turned off")
			for z in players.iterate
				z.glitchydebugthrow = nil
			end
		else
			S_StartSound(nil, sfx_thok)
			print("\x87"+"Glitchy debug throw activated. SMS can now pick up"+"\x85"+" anything with collision."+"\x84"+" Use at your own risk, expect issues!")
			for z in players.iterate
				z.glitchydebugthrow = true
			end
		end
		return --
	end
	if (p.powers[pw_carry] == CR_NIGHTSMODE) //You can't use it in NiGHTS mode, so don't buy it.
		CONS_Printf(p, "\x85"+"Not available in NiGHTS!") return --
	elseif not G_PlatformGametype() or p.mo.battlemodsms
		CONS_Printf(p, "\x85"+"Sorry, shop's closed during competitive gametypes!") return --
	elseif not p.mo or not (p.mo and p.mo.skin == "sms") or not p.mo.health
		CONS_Printf(p, "\x85"+"You can only buy Golden Shoes if you're SMS and alive.") return --
	elseif (p.rings < 25)
		CONS_Printf(p, "\x85"+"You'll need at 25 rings to buy Golden Shoes!") return --
	end

	if v2 == "goldenshoes"
		if p.lightdashenable
			CONS_Printf(p, "\x88"+"You already have Golden Shoes!") return --
		end
		if (p.lddiscount < 3)
			P_GivePlayerRings(p, -25)
			S_StartSound(nil, sfx_nxitem)
			print(p.name+" just bought lightdash shoes!")
		elseif (p.lddiscount > 2) --Discount! Lucky you!
			P_GivePlayerRings(p, -15)
			S_StartSound(nil, sfx_nxdone)
			print(p.name+" just got a great deal on some lightdash sneakers!")
		end
		p.lightdashenable = 1
		CONS_Printf(p, "\x82You unlocked the lightdash!(Custom1) You can also charge the lightspeed attack!")
	end
end)

COM_AddCommand("hms", function(p, onoff) if (gamestate!=GS_LEVEL) return end --
	if (SMS_Admin(p) < 2)
		CONS_Printf(p, "You won't be able to access this one without admin powers.") return --
	end
	if onoff and string.lower(onoff) != nil
	local onoff = string.lower(onoff)
		if onoff == "on"
		or onoff == "yes"
		or onoff == "1"
		or onoff == "true"
			S_StartSound(nil, sfx_gravch)
			for z in players.iterate
				z.hmstransformdisable = 0
				CONS_Printf(z, "The Hyper Mystic transformation has been enabled.")
			end
		elseif onoff == "off"
		or onoff == "no"
		or onoff == "0"
		or onoff == "false"
			S_StartSound(nil, sfx_ngskid)
			for z in players.iterate
				z.hmstransformdisable = 1
				CONS_Printf(z, "The Hyper Mystic transformation has been disabled.")
			end
		end
	else
		CONS_Printf(p, "HMS ON/OFF. Manual Hyper Mystic transformations can be disabled!")
	end
end)

COM_AddCommand("smsrace", function(p, onoff) if (gamestate!=GS_LEVEL) return end --
	if (SMS_Admin(p) < 2)
		CONS_Printf(p, "\x85"+"You won't be able to access this one without admin powers.") return --
	end
	if onoff and string.lower(onoff) != nil
	local onoff = string.lower(onoff)
		if onoff == "on"
		or onoff == "yes"
		or onoff == "1"
		or onoff == "true"
			for sbr in players.iterate
				sbr.smsnoracegame = 0
				S_StartSound(nil, sfx_sarb)
				CONS_Printf(sbr, "SMS has been enabled in race.")
			end
		elseif onoff == "off"
		or onoff == "no"
		or onoff == "0"
		or onoff == "false"
			for sbr in players.iterate
				sbr.smsnoracegame = 1
				CONS_Printf(sbr, "SMS has been disabled in race.(and tag)")
				if (sbr.mo and sbr.mo.skin == "sms")
					S_StartSound(sbr.mo, sfx_altdi2)
				end
			end
		elseif onoff == "super"
		or onoff == "all"
		or onoff == "transform"
		or onoff == "mysticsuper"
			for sbr in players.iterate
				sbr.smsnoracegame = 2
				S_StartSound(nil, sfx_s3k9f)
				CONS_Printf(sbr, "Let's step up the pace! Now EVERYONE can transform at the startline!")
			end
		end
	else
		CONS_Printf(p, "SMSRACE\x82 ON/OFF/SUPER\x80 ! Allow SMS in race mode? The SUPER option makes everyone transform in race!")
	end
end)

COM_AddCommand("nosmsquakes", function(p) if (gamestate!=GS_LEVEL) return end --
	if not p.nosmsquakespls
		p.nosmsquakespls = true
		CONS_Printf(p, "\x89"+"Most of the SMS quake effects generated are now turned off.")
	else
		if p.mo
			p.mo.smsqtime = 0
		end
		p.nosmsquakespls = nil
		CONS_Printf(p, "\x83"+"All of the SMS quake effects generated are now restored!")
	end
end)

COM_AddCommand("smsstats", function(p) if (gamestate!=GS_LEVEL) return end --
	if not p.smsboostmeter
		p.smsboostmeter = true
		CONS_Printf(p, "\x83"+"Check out some useful stats!")
		S_StartSound(nil, sfx_smach, p)
	else
		p.smsboostmeter = false
		CONS_Printf(p, "\x85"+"SMS stats screen deactivated.")
		S_StartSound(nil, sfx_skid, p)
	end
end)

COM_AddCommand("smscontrols", function(p, onoff) if (gamestate!=GS_LEVEL) return end --
	if onoff == "lightdash" or onoff == "Lightdash" or onoff == "LIGHTDASH" //Extra feature for Motdspork I didn't want to clog the SMSreborn menu with.
		S_StartSound(nil, sfx_appear, p)
		if not p.smsldtf
			p.smsldtf = true
			CONS_Printf(p, "\x84"+"The Lightdash is now restricted to Toss-Flag") return --
		else
			p.smsldtf = false
			CONS_Printf(p, "\x83"+"The Lightdash is now available to Toss-Flag and Custom1") return --
		end
	end
	if not p.smstutorial
		p.smstutorial = true
		CONS_Printf(p, "\x82SMS control-aid is now active.")
	else
		p.smstutorial = false
		CONS_Printf(p, "\x83The training wheels are off!")
	end
	S_StartSound(nil, sfx_appear, p)
end)

COM_AddCommand("smsmenu", function(p) if (gamestate!=GS_LEVEL) return end --
	if p.sms_intoship
		CONS_Printf(p, "\x85"+"You're already in the menu!") return --
	end
	if not (p.mo and p.mo.valid and p.mo.health)
		CONS_Printf(p, "You need to have spawned first.") return --
	end local s = p.mo
	if p.panim == PA_IDLE and not SMS_Locked(s, p, true) and P_IsObjectOnGround(s) and not (p.pflags & (PF_SPINNING|PF_STARTDASH))
	or s.SMS_lemmego
	or s.iampickedupbysmshelp --Let people escape SMS' grasp with the menu.
		p.sms_shipready = 2
		p.sms_intoship = 35
		p.firstsmsshipin = true return true --
	else
		CONS_Printf(p, "\x81"+"Find somewhere to stand still.")
	end
end)

/*
SMSRC,SMSPRC = {},{}
SMSPRC = {
playerstate = PST_LIVE,
aiming = p.aiming,
drawangle = p.drawangle,
rings = p.rings,
panim = p.panim,
pflags = p.pflags,
powers = p.powers,
skin = "sms",
skincolor = p.skincolor,
charability = p.charability,
charability2 = p.charability2,
charflags = p.charflags,
runspeed = p.runspeed,
thrustfactor = p.thrustfactor,
accelstart = p.accelstart,
acceleration = p.acceleration,
actionspd = p.actionspd,
mindash = p.mindash,
maxdash = p.maxdash,
jumpfactor = p.jumpfactor,
height = p.height,
spinheight = p.spinheight,
lives = p.lives,
continues = p.continues,
hypermysticsonic = p.hypermysticsonic
}
						
SMSRC = {
health = s.health,
state = s.state,
skin = "sms",
renderflags = s.renderflags,
blendmode = s.blendmode,
rollangle = 0,
sprite = s.sprite,
sprite2 = s.sprite2,
frame = s.frame,
tics = s.tics,
anim_duration = s.anim_duration,
color = s.color,
colorized = s.colorized,
angle = s.angle,
flags = s.flags,
flags2 = s.flags2,
eflags = s.eflags,
momx = s.momx,
momy = s.momy,
momz = s.momz,
friction = s.friction,
scale = s.scale,
destscale = s.destscale,
scalespeed = s.scalespeed,
radius = s.radius,
height = s.height,
mirrored = s.mirrored,
shadowscale = s.shadowscale,
reactiontime = s.reactiontime,
movefactor = s.movefactor,
tracer = s.tracer,
target = s.target
}
*/