addHook("ThinkFrame", function()
	for player in players.iterate do
		if player.mo.skin ~= "m.jimmyharold" then
			continue
		end

		if player.powers [pw_super] then
			P_SpawnGhostMobj(player.mo)
		elseif All7Emeralds(emeralds)and gamemap == 27 and not player.powers [pw_super] and not player.exiting then
			P_GivePlayerRings(player, 200)
			P_DoSuperTransformation(player, false)
		end
	end
end)

addHook("PlayerThink", function(player)
	if player.mo.skin == "m.jimmyharold" then
		if player.powers [pw_super] then
			if not P_IsObjectOnGround(player.mo)
			and player.speed <= 5*FRACUNIT 
			and player.speed >= 0 - 5*FRACUNIT 
			and player.mo.state == S_PLAY_FALL then
				player.mo.state = S_PLAY_WALK
			end
		end
	end
end)

addHook("PlayerThink", function(player)
	if player.mo.skin == "m.jimmyharold" then
		if player.powers [pw_super] then
			if not P_IsObjectOnGround(player.mo)
			and player.speed <= 0 - 30*FRACUNIT 
			and player.mo.state == S_PLAY_FALL
			or not P_IsObjectOnGround(player.mo)
			and player.speed >= 30*FRACUNIT 
			and player.mo.state == S_PLAY_FALL then
				player.mo.state = S_PLAY_WALK
			end
		end
	end
end)

addHook("BotTiccmd", function(bot)
	local player = players[0]
	local mo = players[0].mo
	if player.exiting then 
		return
	end
	if bot.mo and player and mo then
		if player.mo.skin == "m.jimmyharold" then
			if player.powers [pw_super] and bot.mo then
				bot.followitem = MT_JIMSAURA
			else
				bot.followitem = skins[bot.mo.skin].followitem
			end
		end
	end
end)

addHook("PlayerThink", function(player)
	if player.mo and player.mo.valid then
		if player.mo.skin == "m.jimmyharold" then
			if player.powers [pw_super] or player.powers[pw_invulnerability] then
				player.followitem = MT_JIMSAURA
			else
				player.followitem = skins[player.mo.skin].followitem
			end
		end
	end
end)

addHook("MobjThinker", function(jo)
	if mo and mo.valid then
		local player = players[0]
		local mo = players[0].mo
		if player.mo.state == S_PLAY_ROLL 
		or player.mo.state == S_PLAY_JUMP 
		or player.mo.state == S_PLAY_PAIN
		or player.mo.state == S_PLAY_CROUCH
		or player.mo.state == S_PLAY_SLIDE then
			P_TeleportMove(jo, jo.x, jo.y, player.mo.z - (player.mo.height/4))
		else
			P_TeleportMove(jo, jo.x, jo.y, player.mo.z - (player.mo.height/2))
		end
	end
end, MT_JIMSAURA)

addHook("MobjThinker", function(mo)
	if mo and mo.valid then
		local player = players[0]
		if player.powers [pw_super] then
			if mo.state != S_JIMSUPERAURAS
			and mo.state != S_JIMSUPERAURA then
				mo.state = S_JIMSUPERAURAS
			end
		else
			if mo.state != S_JIMSUPERAURA then
				mo.state = S_JIMSUPERAURA
			end
		end
	end
end, MT_JIMSAURA)

addHook("MobjThinker", function(mo)
	if mo and mo.valid then
		mo.rollangle = $ + 45*ANG1
	end
end, MT_JIMSAURA)

addHook("PlayerThink", function(player)
	if player.mo.skin == "m.jimmyharold" then
		if player.mo.state == S_PLAY_SUPER_TRANS1 then
			player.camerascale = (skins[player.mo.skin].camerascale/12)*11
		elseif player.mo.state == S_PLAY_SUPER_TRANS2 then
			player.camerascale = (skins[player.mo.skin].camerascale/12)*10
		elseif player.mo.state == S_PLAY_SUPER_TRANS3 then
			player.camerascale = (skins[player.mo.skin].camerascale/12)*9
		elseif player.mo.state == S_PLAY_SUPER_TRANS4 then
			player.camerascale = (skins[player.mo.skin].camerascale/12)*8
		elseif player.mo.state == S_PLAY_SUPER_TRANS5 then
			player.camerascale = (skins[player.mo.skin].camerascale/12)*7
		else
			player.camerascale = (skins[player.mo.skin].camerascale)
		end
	end
end)
	
	
	
	
	
	
	
	
