private static void InitializeEquippableComponent(EquippableModComponent equippable, ProxyObject dict, string inheritanceName) { InitializeBaseComponent(equippable, dict, inheritanceName); equippable.EquippedModelPrefabName = dict[inheritanceName]["EquippedModelPrefab"]; equippable.ImplementationType = dict[inheritanceName]["ImplementationType"]; equippable.EquippingAudio = dict[inheritanceName]["EquippingAudio"]; }
internal static void Prefix(PlayerManager __instance, GearItem gi) { EquippableModComponent equippable = ModUtils.GetEquippableModComponent(__instance.m_ItemInHands); if (equippable != null) { __instance.UnequipItemInHands(); } }
public static void Unequip(EquippableModComponent modComponent) { if (modComponent == null) { return; } GameManager.GetPlayerManagerComponent().UnequipItemInHandsSkipAnimation(); }
internal static void Postfix(PlayerManager __instance, PlayerControlMode mode) { if (mode == lastMode) { return; } lastMode = mode; EquippableModComponent equippable = ComponentUtils.GetEquippableModComponent(__instance.m_ItemInHands); equippable?.OnControlModeChangedWhileEquipped?.Invoke(); }
private static void Postfix(GearItem gi, ref bool __result) { if (__result || gi is null) { return; } EquippableModComponent equippable = ComponentUtils.GetEquippableModComponent(gi); if (equippable != null) { __result = true; } }
private static void ConfigureEquippable(ModComponent modComponent) { EquippableModComponent equippableModComponent = modComponent as EquippableModComponent; if (equippableModComponent == null) { return; } if (string.IsNullOrEmpty(equippableModComponent.InventoryActionLocalizationId) && !string.IsNullOrEmpty(equippableModComponent.ImplementationType)) { equippableModComponent.InventoryActionLocalizationId = "GAMEPLAY_Equip"; } }
internal static void Configure(ModComponent modComponent) { EquippableModComponent equippableModComponent = modComponent.TryCast <EquippableModComponent>(); if (equippableModComponent is null) { return; } if (string.IsNullOrEmpty(equippableModComponent.InventoryActionLocalizationId) && !string.IsNullOrEmpty(equippableModComponent.ImplementationType) && !string.IsNullOrEmpty(equippableModComponent.EquippedModelPrefabName)) { equippableModComponent.InventoryActionLocalizationId = "GAMEPLAY_Equip"; } }
internal static void OnUnequipped(EquippableModComponent modComponent) { if (modComponent is null) { return; } if (modComponent.EquippedModel != null) { Object.Destroy(modComponent.EquippedModel); modComponent.EquippedModel = null; } modComponent.OnUnequipped?.Invoke(); ModComponentUtils.ModUtils.PlayAudio(modComponent.StowAudio); }
public static void Equip(EquippableModComponent equippable) { if (equippable == null) { return; } if (equippable.EquippedModelPrefab != null) { equippable.EquippedModel = Object.Instantiate(equippable.EquippedModelPrefab, GameManager.GetWeaponCamera().transform); equippable.EquippedModel.layer = vp_Layer.Weapon; } equippable.OnEquipped?.Invoke(); InterfaceManager.QuitCurrentScreens(); ModUtils.PlayAudio(equippable.EquippingAudio); }
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); }
public static void Equip(EquippableModComponent equippable) { if (equippable is null) { return; } GameObject equippedModelPrefab = Resources.Load(equippable.EquippedModelPrefabName)?.Cast <GameObject>(); if (equippedModelPrefab != null) { equippable.EquippedModel = Object.Instantiate(equippedModelPrefab, GameManager.GetWeaponCamera().transform); equippable.EquippedModel.layer = vp_Layer.Weapon; } else { Logger.Log("The equippedModelPrefab for '{0}' was null.", equippable.EquippedModelPrefabName); } equippable.OnEquipped?.Invoke(); InterfaceManager.QuitCurrentScreens(); ModComponentUtils.ModUtils.PlayAudio(equippable.EquippingAudio); }