コード例 #1
0
        private static bool OnRemove(Consumable __instance, InventorySystem.Items.Pickups.ItemPickupBase pickup)
        {
            try
            {
                if (__instance.ActivationReady && UsableUsingCompletePatch.ExecuteFinalizingEvent(__instance))
                {
                    __instance.ActivateEffects();
                }

                if (__instance._alreadyActivated && pickup != null)
                {
                    pickup.DestroySelf();
                }

                if (NetworkServer.active)
                {
                    UsableItemsController.GetHandler(__instance.Owner).CurrentUsable = CurrentlyUsedItem.None;
                }

                return(false);
            }
            catch (Exception ex)
            {
                Logger.Get.Error($"Synapse-Event: PlayerItemUseEvent Finalizing Remove failed!!\n{ex}");
                return(true);
            }
        }
コード例 #2
0
 private static bool CompletePatch(Consumable __instance)
 {
     try
     {
         return(UsableUsingCompletePatch.ExecuteFinalizingEvent(__instance));
     }
     catch (Exception e)
     {
         Logger.Get.Error($"Synapse-Event: PlayerItemUseEvent Finalizing failed!!\n{e}");
         return(true);
     }
 }
コード例 #3
0
 private static bool OnEquip(Consumable __instance)
 {
     try
     {
         if (__instance.ActivationReady)
         {
             if (UsableUsingCompletePatch.ExecuteFinalizingEvent(__instance))
             {
                 __instance.ActivateEffects();
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         Logger.Get.Error($"Synapse-Event: PlayerItemUseEvent Finalizing Equip failed!!\n{ex}");
         return(true);
     }
 }