
addHook("PlayerThink", function(player)
	if player.mo.skin == "jimmyharold" then
		if not (player.cmd.buttons & BT_CUSTOM2) then
			player.emotapready = true
			player.emotapping = false
		elseif player.emotapready then
			player.emotapping = true
			player.emotapready = false
		else
			player.emotapping = false
		end

		if player.mo.skin == "jimmyharold" 
		and player.emotapping 
		and not player.dothing 
		and not player.exiting then
			player.dothing = true
		elseif player.mo.skin == "jimmyharold" 
		and player.emotapping 
		and player.dothing 
		and not player.exiting then
			P_RestoreMusic(player)
			player.dothing = false
			player.mo.state = S_PLAY_STND
		elseif player.dothing then
			player.pflags = $ |PF_FULLSTASIS
			if player.mo.state != S_PLAY_RSTRSONT then
				player.mo.state = S_PLAY_RSTRSONT
			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.mo.skin == "jimmyharold" and player and mo
		if player.dothing then
			if bot.mo.state != S_PLAY_RSTRSONT then
				bot.mo.state = S_PLAY_RSTRSONT
			elseif bot.mo.state == S_PLAY_RSTRSONT then
				bot.pflags = $ |PF_FULLSTASIS
			end
		elseif bot.mo.state == S_PLAY_RSTRSONT then
			bot.mo.state = S_PLAY_WALK
		end
	end
end)
