Exemple #1
0
 private void GenericPickupController_OnTriggerStay(On.RoR2.GenericPickupController.orig_OnTriggerStay orig, GenericPickupController self, Collider other)
 {
     if (NetworkServer.active)
     {
         if (other)
         {
             bool result    = true;
             var  character = other.GetComponent <CharacterBody>();
             if (character)
             {
                 if (self != null && self.pickupIndex != null)
                 {
                     var charactername = character.baseNameToken;
                     dropping.TryGetValue(self.pickupIndex.itemIndex, out Dictionary <string, bool> characterdic);
                     if (characterdic != null)
                     {
                         characterdic.TryGetValue(charactername, out result);
                     }
                 }
             }
             if (result)
             {
                 orig(self, other);
             }
         }
     }
 }
Exemple #2
0
 private void PreventBulletAutoPickup(On.RoR2.GenericPickupController.orig_OnTriggerStay orig, GenericPickupController self, Collider other)
 {
     if (self.pickupIndex != PickupCatalog.FindPickupIndex(PastKillingBullet.instance.ItemDef.itemIndex))
     {
         orig(self, other);
     }
     else
     {
         orig(self, null);
     }
 }
        private void GenericPickupController_OnTriggerStay(On.RoR2.GenericPickupController.orig_OnTriggerStay orig, GenericPickupController self, Collider other)
        {
            if (!ArtifactEnabled)
            {
                orig(self, other);
                return;
            }

            if (NetworkServer.active && self.waitStartTime.timeSince >= self.waitDuration && !self.consumed)
            {
                CharacterBody component = other.GetComponent <CharacterBody>();
                if (component)
                {
                    PickupDef pickupDef = PickupCatalog.GetPickupDef(self.pickupIndex);
                    ItemIndex itemIndex = (pickupDef != null) ? pickupDef.itemIndex : ItemIndex.None;
                    if (itemIndex != ItemIndex.None && ItemCatalog.GetItemDef(itemIndex).tier == ItemTier.Lunar && component.isPlayerControlled)
                    {
                        return;
                    }
                    EquipmentIndex equipmentIndex = (pickupDef != null) ? pickupDef.equipmentIndex : EquipmentIndex.None;
                    if (equipmentIndex != EquipmentIndex.None)
                    {
                        if (EquipmentCatalog.GetEquipmentDef(equipmentIndex).isLunar)
                        {
                            return;
                        }
                        if (component.inventory && component.inventory.currentEquipmentIndex != EquipmentIndex.None)
                        {
                            return;
                        }
                    }
                    if (pickupDef != null && pickupDef.coinValue != 0U && component.isPlayerControlled)
                    {
                        return;
                    }
                    if (GenericPickupController.BodyHasPickupPermission(component))
                    {
                        self.AttemptGrant(component);
                    }
                }
            }
        }
Exemple #4
0
 private void GenericPickupController_OnTriggerStay(On.RoR2.GenericPickupController.orig_OnTriggerStay orig, RoR2.GenericPickupController self, Collider other)
 {
 }