<commit_before>using System;
using UnityEngine;
using InControl;
using Assets.Topher;
using System.Collections;

namespace TerribleMorningPerson
{

	public class Player : MonoBehaviour
	{
		public ArmActions Actions { get; set; }
		public float wristExtendSpeed;
		public float wristRotateSpeed;
		public float elbowExtendSpeed;
		public GameObject elbow;
		public GameObject shoulder;
		public GameObject wrist;
        public GameObject rudeFinger;
        public GameObject indexFinger;
        public GameObject pinkyFinger;
        public GameObject itemHeld;
        public bool pickupTimeoutEnabled;
		Renderer cachedRenderer;


		void OnDisable()
		{
			if (Actions != null)
			{
				Actions.Destroy();
			}
		}


		void Start()
		{
			cachedRenderer = GetComponent<Renderer>();
		}

        
        void FixedUpdate()
        {
            if (Actions == null)
            {
                // If no controller exists for this cube, just make it translucent.
                //cachedRenderer.material.color = new Color( 1.0f, 1.0f, 1.0f, 0.2f );
            }
            else
            {

                Rigidbody wristRigidbody = (Rigidbody)wrist.GetComponent("Rigidbody");
                Rigidbody elbowRigidbody = (Rigidbody)elbow.GetComponent("Rigidbody");

				wristRigidbody.AddRelativeTorque((Vector3.back * Actions.WristRotateAxis * wristRotateSpeed), ForceMode.VelocityChange);
				wristRigidbody.AddRelativeTorque((Vector3.right * Actions.WristExtendAxis * wristExtendSpeed), ForceMode.VelocityChange);

				elbowRigidbody.AddRelativeTorque((Vector3.down * Actions.ElbowExtendAxis * elbowExtendSpeed), ForceMode.VelocityChange);

                if (Actions.Grab.IsPressed && pickupTimeoutEnabled==false) 
                {
                    if (itemHeld != null)
                    {
                        if (itemHeld.GetComponent<Rigidbody>() != null)
                        {
                            itemHeld.GetComponent<Rigidbody>().transform.SetParent(null);
                            itemHeld.GetComponent<Rigidbody>().AddForce(Vector3.back * 400);

                        }
                        itemHeld = null;
                        pickupTimeoutEnabled = true;
                        StartCoroutine(PickupTimer(0.5f));

                    }
                }

            }

        } 
        void isGrabButtonPressed(messageData data)
        {

            if (Actions.Grab.IsPressed && pickupTimeoutEnabled == false && itemHeld == null)
            {
                data.isButtonPressed = true;
                itemHeld = data.itemToBeHeld;
                pickupTimeoutEnabled = true;
                StartCoroutine(PickupTimer(0.5f));
            }
        }

        IEnumerator PickupTimer(float time)<commit_msg>ungrabbing fix<commit_after>using System;
using UnityEngine;
using InControl;
using Assets.Topher;
using System.Collections;

namespace TerribleMorningPerson
{

	public class Player : MonoBehaviour
	{
		public ArmActions Actions { get; set; }
		public float wristExtendSpeed;
		public float wristRotateSpeed;
		public float elbowExtendSpeed;
		public GameObject elbow;
		public GameObject shoulder;
		public GameObject wrist;
        public GameObject rudeFinger;
        public GameObject indexFinger;
        public GameObject pinkyFinger;
        public GameObject itemHeld;
        public bool pickupTimeoutEnabled;
		Renderer cachedRenderer;


		void OnDisable()
		{
			if (Actions != null)
			{
				Actions.Destroy();
			}
		}


		void Start()
		{
			cachedRenderer = GetComponent<Renderer>();
		}

        
        void FixedUpdate()
        {
            if (Actions == null)
            {
                // If no controller exists for this cube, just make it translucent.
                //cachedRenderer.material.color = new Color( 1.0f, 1.0f, 1.0f, 0.2f );
            }
            else
            {

                Rigidbody wristRigidbody = (Rigidbody)wrist.GetComponent("Rigidbody");
                Rigidbody elbowRigidbody = (Rigidbody)elbow.GetComponent("Rigidbody");

				wristRigidbody.AddRelativeTorque((Vector3.back * Actions.WristRotateAxis * wristRotateSpeed), ForceMode.VelocityChange);
				wristRigidbody.AddRelativeTorque((Vector3.right * Actions.WristExtendAxis * wristExtendSpeed), ForceMode.VelocityChange);

				elbowRigidbody.AddRelativeTorque((Vector3.down * Actions.ElbowExtendAxis * elbowExtendSpeed), ForceMode.VelocityChange);

                if (Actions.Grab.IsPressed && pickupTimeoutEnabled==false) 
                {
                    if (itemHeld != null)
                    {
                        if (itemHeld.GetComponent<Rigidbody>() != null)
                        {
                            itemHeld.GetComponent<Rigidbody>().transform.SetParent(null);
                            itemHeld.GetComponent<Rigidbody>().AddForce(Vector3.up * 400);

                        }
                        itemHeld = null;
                        pickupTimeoutEnabled = true;
                        StartCoroutine(PickupTimer(0.5f));

                    }
                }

            }

        } 
        void isGrabButtonPressed(messageData data)
        {

            if (Actions.Grab.IsPressed && pickupTimeoutEnabled == false && itemHeld == null)
            {
                data.isButtonPressed = true;
                itemHeld = data.itemToBeHeld;
                pickupTimeoutEnabled = true;
                StartCoroutine(PickupTimer(0.5f));
            }
        }

        IEnumerator PickupTimer(float time)
{'fraction_non_alphanumeric': 0.08280828082808281, 'fraction_numerical': 0.006840684068406841, 'mean_word_length': 1.8728024819027922, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '480556', 'n_tokens_mistral': 1673, 'n_tokens_neox': 1496, 'n_words': 288}