public void OnPickup() { SeamothArmManager control = ThisSeamoth.GetComponent <SeamothArmManager>(); GameObject activeTarget = control.GetActiveTarget(); if (activeTarget) { Pickupable pickupable = activeTarget.GetComponent <Pickupable>(); PickPrefab component = activeTarget.GetComponent <PickPrefab>(); ItemsContainer container = control.GetRoomForItem(pickupable); if (pickupable != null && pickupable.isPickupable && container != null) { pickupable = pickupable.Initialize(); InventoryItem item = new InventoryItem(pickupable); container.UnsafeAdd(item); Utils.PlayFMODAsset(pickupSound, front, 5f); } else if (component != null && component.AddToContainer(container)) { component.SetPickedUp(); } } }
public void HoverDrillable() { SeamothArmManager control = Player.main.GetComponentInParent <SeamothArmManager>(); if (control && control.HasDrill()) { HandReticle.main.SetInteractText(Language.main.GetFormat("DrillResource", Language.main.Get(drillable.primaryTooltip)), drillable.secondaryTooltip, false, true, HandReticle.Hand.Left); HandReticle.main.SetIcon(HandReticle.IconType.Drill, 1f); } else { HandReticle.main.SetInteractText(drillable.primaryTooltip, "NeedExoToMine"); } }
public static bool Prefix(Vehicle __instance) { if (__instance.GetType() == typeof(SeaMoth)) { SeamothArmManager control = __instance.gameObject.GetComponent <SeamothArmManager>().Instance; if (control.IsArmSlotSelected) { control.SlotArmUp(); return(false); } } return(true); }
private bool TryUse(out float cooldownDuration) { if (Time.time - timeUsed >= cooldownTime) { SeamothArmManager control = ThisSeamoth.GetComponent <SeamothArmManager>(); Pickupable pickupable = null; PickPrefab x = null; GameObject activeTarget = control.GetActiveTarget(); if (activeTarget) { pickupable = activeTarget.GetComponent <Pickupable>(); x = activeTarget.GetComponent <PickPrefab>(); } if (pickupable != null && pickupable.isPickupable) { if (control.GetRoomForItem(pickupable) != null) { animator.SetTrigger("use_tool"); cooldownTime = (cooldownDuration = cooldownPickup); shownNoRoomNotification = false; return(true); } if (!shownNoRoomNotification) { ErrorMessage.AddMessage(Language.main.Get("ContainerCantFit")); shownNoRoomNotification = true; } } else { if (x != null) { animator.SetTrigger("use_tool"); cooldownTime = (cooldownDuration = cooldownPickup); return(true); } animator.SetTrigger("bash"); cooldownTime = (cooldownDuration = cooldownPunch); fxControl.Play(0); return(true); } } cooldownDuration = 0f; return(false); }
internal static void Postfix(SeaMoth __instance, bool docked, Vehicle.DockType dockType) { SeamothArmManager control = null; try { control = __instance.gameObject.GetComponent <SeamothArmManager>().Instance; } catch { SNLogger.Log("[SeamothArms] OnDockedChanged Patch Warning! Seamoth Arm Manager is not ready!"); return; } if (control != null && control.onDockedChanged != null) { control.onDockedChanged.Trigger(docked); } }
public void ManagedUpdate() { if (timeLastDrilled + 0.5f > Time.time) { drillable.modelRoot.transform.position = transform.position + new Vector3(Mathf.Sin(Time.time * 60f), Mathf.Cos(Time.time * 58f + 0.5f), Mathf.Cos(Time.time * 64f + 2f)) * 0.011f; } if (lootPinataObjects.Count > 0 && drillingMoth) { List <GameObject> list = new List <GameObject>(); foreach (GameObject gameObject in lootPinataObjects) { if (gameObject == null) { list.Add(gameObject); } else { Vector3 b = drillingMoth.transform.position + new Vector3(0f, 0.8f, 0f); gameObject.transform.position = Vector3.Lerp(gameObject.transform.position, b, Time.deltaTime * 5f); float num = Vector3.Distance(gameObject.transform.position, b); if (num < 3f) { Pickupable pickupable = gameObject.GetComponentInChildren <Pickupable>(); if (pickupable) { SeamothArmManager control = drillingMoth.GetComponent <SeamothArmManager>(); if (!control.HasRoomForItem(pickupable)) { if (Player.main.GetVehicle() == drillingMoth) { ErrorMessage.AddMessage(Language.main.Get("ContainerCantFit")); } } else { string arg = Language.main.Get(pickupable.GetTechName()); ErrorMessage.AddMessage(Language.main.GetFormat("VehicleAddedToStorage", arg)); uGUI_IconNotifier.main.Play(pickupable.GetTechType(), uGUI_IconNotifier.AnimationType.From, null); pickupable = pickupable.Initialize(); InventoryItem item = new InventoryItem(pickupable); control.GetRoomForItem(pickupable).UnsafeAdd(item); pickupable.PlayPickupSound(); } list.Add(gameObject); } } } } if (list.Count > 0) { foreach (GameObject item2 in list) { lootPinataObjects.Remove(item2); } } } }