private static void Prefix(QuickSlots __instance)
        {
            if (!Input.GetKeyDown(KeyCode.I) || uGUI_PDA.main.tabOpen != PDATab.None || DevConsole.instance.state || timeCheck != 0)
            {
                return;
            }
            var item     = __instance.heldItem;
            var techType = item?.item?.GetTechType() ?? TechType.None;
            var tool     = item?.item?.gameObject.GetComponent <PlayerTool>();

            if (GameOptions.GetVrAnimationMode() || tool == null || !tool.hasFirstUseAnimation)
            {
                return;
            }
            if (Player.main.usedTools.Contains(techType))
            {
                Player.main.usedTools.Remove(techType);
            }

            var slot = __instance.GetSlotByItem(item);

            if (slot == -1)
            {
                return;
            }
            __instance.SelectImmediate(slot);
            timeCheck = Time.time + tool.holsterTime;
            CoroutineHost.StartCoroutine(SelectDelay(__instance, slot));
        }
예제 #2
0
        public static bool Prefix(QuickSlots __instance)
        {
            if ((__instance._heldItem == null) || !DeathRun.config.firstAidQuickSlot)
            {
                return(true);
            }

            Pickupable item = __instance._heldItem.item;

            if (item.GetTechType() != TechType.FirstAidKit)
            {
                return(true);
            }

            Survival component = Player.main.GetComponent <Survival>();

            if (component != null)
            {
                if (component.Use(item.gameObject))
                {
                    __instance.refillTechType = item.GetTechType();
                    __instance.refillSlot     = __instance.GetSlotByItem(__instance._heldItem);
                    __instance.desiredSlot    = __instance.refillSlot;

                    UnityEngine.Object.Destroy(item.gameObject);
                    return(false);
                }
            }

            return(false);
        }
예제 #3
0
        static void Prefix(QuickSlots __instance)
        {
            if (Input.GetKeyDown(KeyCode.I) && timeCheck == 0)
            {
                InventoryItem item     = __instance.heldItem;
                TechType      techType = item?.item?.GetTechType() ?? TechType.None;
                PlayerTool    tool     = item?.item?.gameObject?.GetComponent <PlayerTool>();
                if (!GameOptions.GetVrAnimationMode() && tool != null && tool.hasFirstUseAnimation)
                {
                    if (Player.main.usedTools.Contains(techType))
                    {
                        Player.main.usedTools.Remove(techType);
                    }

                    int slot = __instance.GetSlotByItem(item);
                    if (slot != -1)
                    {
                        __instance.SelectImmediate(slot);
                        timeCheck = Time.time + tool.holsterTime;
                        CoroutineHost.StartCoroutine(SelectDelay(__instance, slot));
                    }
                }
            }
        }