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); }
internal static void Prefix(PlayerManager __instance, GearItem gi) { EquippableModComponent equippable = ModUtils.GetEquippableModComponent(__instance.m_ItemInHands); if (equippable != null) { __instance.UnequipItemInHands(); } }
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(); } }
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); }
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); }
internal static void Postfix(PlayerManager __instance) { GearEquipper.Equip(ModUtils.GetEquippableModComponent(__instance.m_ItemInHands)); }