addHook('JumpSpecial', function(player)
	    if player.mo and player.mo.valid
			if player.mo.skin == "eggette"
               if (player.powers[pw_tailsfly] > 0) and (player.cmd.buttons & BT_JUMP) //holdfly for eggette
                player.fly1 = 1
				end
			end
		end
end)

addHook('ThinkFrame', do
	for player in players.iterate
	    if player.mo and player.mo.valid
			if player.mo.skin == "eggette"
				
				//Flight TImer
				if player.charability == CA_FLY
					if (player.powers[pw_tailsfly]) and not (player.tailsfly == 1) and not player.powers[pw_super]
					player.powers[pw_tailsfly] = 8*TICRATE
					player.tailsfly = 1
					player.pflags = $|PF_JUMPED
					end
					if (player.powers[pw_tailsfly]) and not (player.tailsfly == 1) and player.powers[pw_super]
					player.powers[pw_tailsfly] = 99999*TICRATE
					player.tailsfly = 1
					player.pflags = $|PF_JUMPED
					end
					if not (player.tailsfly == 0)
					and P_IsObjectOnGround(player.mo)
					player.tailsfly = 0
					end
				end
				
				if not ((player.pflags & PF_JUMPED) or (player.pflags & PF_THOKKED))
				player.charability = CA_GLIDEANDCLIMB
				else player.charability = CA_FLY
				end
				
				if player.speed <= FixedMul(4*FRACUNIT+FRACUNIT/2, player.mo.scale)
				and not (player.pflags & PF_SPINNING)
					player.charability2 = CA2_NONE
				else
					player.charability2 = CA2_SPINDASH
				end
				if player.pflags & PF_STARTDASH
					player.pflags = $1 & ~PF_SPINNING
					player.pflags = $1 & ~PF_STARTDASH
					player.mo.state = S_PLAY_STND
				end
			end
		end
	end
end)