コード例 #1
0
        internal static bool Prefix(PlayerManager __instance, GearItem gi)
        {
            if (ModUtils.GetComponent <FirstPersonItem>(gi) != null)
            {
                return(true);
            }

            if (ModUtils.GetEquippableModComponent(gi) == null)
            {
                return(true);
            }

            var currentGi = __instance.m_ItemInHands;

            if (currentGi != null)
            {
                __instance.UnequipItemInHands();
            }

            if (gi != currentGi)
            {
                __instance.EquipItem(gi, false);
            }

            return(false);
        }
コード例 #2
0
        internal static void Prefix(PlayerManager __instance, GearItem gi)
        {
            EquippableModComponent equippable = ModUtils.GetEquippableModComponent(__instance.m_ItemInHands);

            if (equippable != null)
            {
                __instance.UnequipItemInHands();
            }
        }
コード例 #3
0
        internal static void Postfix(PlayerManager __instance, PlayerControlMode mode)
        {
            if (mode == lastMode)
            {
                return;
            }

            lastMode = mode;

            EquippableModComponent equippable = ModUtils.GetEquippableModComponent(__instance.m_ItemInHands);

            if (equippable != null)
            {
                equippable.OnControlModeChangedWhileEquipped?.Invoke();
            }
        }
コード例 #4
0
        public static bool Prefix()
        {
            PlayerManager playerManager = GameManager.GetPlayerManagerComponent();

            if (playerManager == null || InterfaceManager.IsOverlayActive() || playerManager.InPlaceMeshMode() || playerManager.ItemInHandsPlaceable())
            {
                return(true);
            }

            EquippableModComponent equippable = ModUtils.GetEquippableModComponent(playerManager.m_ItemInHands);

            if (equippable == null)
            {
                return(true);
            }

            equippable.OnSecondaryAction?.Invoke();
            return(false);
        }
コード例 #5
0
        public static bool Prefix(MonoBehaviour context)
        {
            PlayerManager playerManager = GameManager.GetPlayerManagerComponent();

            if (playerManager == null || GameManager.ControlsLocked() || InterfaceManager.IsOverlayActive() || !InputManager.GetFirePressed(context) || InputManager.GetFireReleased(context))
            {
                return(true);
            }

            EquippableModComponent equippable = ModUtils.GetEquippableModComponent(playerManager.m_ItemInHands);

            if (equippable == null || equippable.Implementation == null)
            {
                return(true);
            }

            equippable.OnPrimaryAction?.Invoke();
            return(false);
        }
コード例 #6
0
 internal static void Postfix(PlayerManager __instance)
 {
     GearEquipper.Equip(ModUtils.GetEquippableModComponent(__instance.m_ItemInHands));
 }