Esempio n. 1
0
 //Returns whether it already existed or not.
 public static bool CreateKey(FVRInteractiveObject obj)
 {
     if (objExt.ContainsKey(obj))
     {
         return(true);
     }
     objExt.Add(obj, new ObjectExtention());
     objExt[obj].naturalReliability = GenerateNatReliability();
     return(false);
 }
Esempio n. 2
0
 public void DeleteObjectFromHand()
 {
     foreach (FVRViveHand hand in GM.CurrentMovementManager.Hands)
     {
         if (hand.CurrentInteractable != null)
         {
             FVRInteractiveObject FVRIntObj = hand.CurrentInteractable;
             FVRIntObj.ForceBreakInteraction();
             Destroy(FVRIntObj.gameObject);
         }
     }
 }
Esempio n. 3
0
        public static float GetMultForRoundsUsed(FVRInteractiveObject obj)
        {
            CreateKey(obj);
            float mult = 1;
            var   r    = objExt[obj].roundsUsed;

            if (obj is FVRFireArm)
            {
                //TODO: MAKE THIS OPTIONS!!!!
                mult += (0.0001f * (r - 400f));
                mult  = Mathf.Clamp(mult, 1f, 1.1f);
            }

            return(mult);
        }
        static bool GeneralPatch_FailureToExtract(FVRInteractiveObject __instance)
        {
            //these firearms will break if an FTE is caused
            if (__instance is BoltActionRifle || __instance is LeverActionFirearm)
            {
                return(false);
            }
            if (!Meatyceiver.enableFirearmFailures.Value)
            {
                return(true);
            }
            float             chance = Meatyceiver.FTERate.Value * Meatyceiver.generalMult.Value;
            FVRPhysicalObject obj    = null;

            if (__instance is ClosedBolt)
            {
                obj = (__instance as ClosedBolt).Weapon;
            }
            if (__instance is HandgunSlide)
            {
                obj = (__instance as HandgunSlide).Handgun;
            }
            if (__instance is OpenBoltReceiverBolt)
            {
                obj = (__instance as OpenBoltReceiverBolt).Receiver;
            }
            if (Meatyceiver.CalcFail(chance, obj))
            {
                __instance.RotationInterpSpeed = 2;
                return(false);
            }
//			rand = (float)randomVar.Next(0, 10001) / 100;
//			chance = stovepipeRate.Value * generalMult.Value;
//			consoleDebugging(0, FTEfailureName, rand, chance);
//			if (rand <= chance)
//			{
//				consoleDebugging(1, FTEfailureName, rand, chance);
//				return false;
//			}
            return(true);
        }
Esempio n. 5
0
 public static bool HasFlag(FVRInteractiveObject obj, states state)
 {
     CreateKey(obj); return(objExt[obj].state.HasFlag(state));
 }
Esempio n. 6
0
 public static void RemoveFlag(FVRInteractiveObject obj, states state)
 {
     CreateKey(obj); objExt[obj].state &= ~state;
 }
Esempio n. 7
0
 public static void AddFlag(FVRInteractiveObject obj, states state)
 {
     CreateKey(obj); objExt[obj].state |= state;
 }
Esempio n. 8
0
 public static void IncRoundsUsed(FVRInteractiveObject obj)
 {
     CreateKey(obj);
     objExt[obj].roundsUsed++;
 }