private static void HitResource_Patch_Postfix(BreakableResource __instance)
 {
     //as this is Postfix first check if player already hit it down so we do not call the break twice
     if (__instance.hitsToBreak > 0)
     {
         //check if user force fastbreak OR has one of the Glove's
         if (MetalHands.Config.Config_fastbreak == true | (MetalHands.Config.Config_ModEnable == true && ((Inventory.main.equipment.GetTechTypeInSlot("Gloves") == MetalHands.MetalHandsMK1TechType) | (Inventory.main.equipment.GetTechTypeInSlot("Gloves") == MetalHands.MetalHandsMK2TechType))))
         {
             __instance.hitsToBreak = 0;
             __instance.BreakIntoResources();
         }
     }
 }
コード例 #2
0
        public void OnCollisionEnter(Collision col)
        {
            LiveMixin mixin = col.collider.GetComponent <LiveMixin>();

            if (mixin && mixin != Player.main.liveMixin)
            {
                mixin.TakeDamage(500f);
                transform.GetChild(0).parent = null;
                Destroy(gameObject);
                return;
            }
            BreakableResource res = col.collider.GetComponent <BreakableResource>();

            if (res)
            {
                res.BreakIntoResources();
                transform.GetChild(0).parent = null;
                Destroy(gameObject);
                return;
            }
        }