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
        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));
                    }
                }
            }
        }