public void OnHandHover(GUIHand hand) { if (constructable == null) { constructable = gameObject.GetComponent <Constructable>(); } if (constructable.constructed) { if (spin.transform.position.y > Ocean.main.GetOceanLevel() + 1f) { if (NeedsMaintenance) { HandReticle.main.SetInteractText("Wind Turbine: " + Mathf.RoundToInt(this.GetRechargeScalar() * 100f * WindyMultiplier(new Vector3(transform.position.x, transform.position.z))) + "% efficiency, " + Mathf.RoundToInt(this.powerSource.GetPower()).ToString() + "/" + Mathf.RoundToInt(this.powerSource.GetMaxPower()) + " power", "Needs maintenance (use repair tool)", false, false, HandReticle.Hand.None); HandReticle.main.SetIcon(HandReticle.IconType.Info, 1.5f); } else { HandReticle.main.SetInteractText("Wind Turbine: " + Mathf.RoundToInt(this.GetRechargeScalar() * 100f * WindyMultiplier(new Vector3(transform.position.x, transform.position.z))) + "% efficiency, " + Mathf.RoundToInt(this.powerSource.GetPower()).ToString() + "/" + Mathf.RoundToInt(this.powerSource.GetMaxPower()) + " power", false, HandReticle.Hand.None); HandReticle.main.SetIcon(HandReticle.IconType.Info, 1f); } } else { HandReticle.main.SetInteractText("Wind Turbine: 0% efficiency", "Notice: Blades are submerged, please relocate", false, false, HandReticle.Hand.None); HandReticle.main.SetIcon(HandReticle.IconType.HandDeny, 1f); } } }
public void OnHandClick(GUIHand hand) { if (!base.enabled) { return; } if (Input.GetKey(KeyCode.E)) { GameObject model = this.gameObject; if (model == null) { return; } BoxCollider collider = this.gameObject.GetComponent <BoxCollider>(); if (model.transform.localScale.y > 10.0f) { model.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); collider.size = new Vector3(0.1650754f, 0.2141044f, 0.2005115f); } else { model.transform.localScale *= 1.25f; collider.size *= 0.5f; } } }
void UpdateActiveTarget(Vehicle vehicle) { // Get the GameObject we're looking at var activeTarget = default(GameObject); Targeting.GetTarget(vehicle.gameObject, 6f, out activeTarget, out float dist, null); // Check if not null if (activeTarget != null) { // Get the root object, or the hit object if root is null var root = UWE.Utils.GetEntityRoot(activeTarget) ?? activeTarget; if (root.GetComponentProfiled <Pickupable>()) { activeTarget = root; } else { root = null; } } // Get the GUIHand component var guiHand = Player.main.GetComponent <GUIHand>(); if (activeTarget) { // Send the Hover message to the GameObject we're looking at. GUIHand.Send(activeTarget, HandTargetEventType.Hover, guiHand); } }
private static bool Prefix(Bed __instance, GUIHand hand) { if (hand.player.GetComponent <Survival>().food <= 25 || Player.main.GetComponent <Survival>().water <= 25) { if (hand.player.GetComponent <Survival>().food <= 25 && hand.player.GetComponent <Survival>().water <= 25) { ErrorMessage.AddWarning("You can't sleep now because you are too hungry and thirsty! Drink and eat something before you go to bed."); } else if (hand.player.GetComponent <Survival>().food <= 25 || !(hand.player.GetComponent <Survival>().water <= 25)) { ErrorMessage.AddWarning("You can't sleep now because you are too hungry! Go eat something before you go to bed."); } else if (!(hand.player.GetComponent <Survival>().food <= 25) || hand.player.GetComponent <Survival>().water <= 25) { ErrorMessage.AddWarning("You can't sleep now because you are too thirsty! Drink something before you go to bed."); } else { ErrorMessage.AddWarning("You can't sleep now! Try to drink and eat something and try again!"); } return(false); } return(true); }
public void OnHandClick(GUIHand hand) { if (isOn) { GetComponentInParent <SubRoot>().ForceLightingState(false); foreach (Component comp in GetComponentsInChildren <Component>()) { if (comp.name == "Starship_wall_monitor_01_03(Clone)") { comp.GetComponent <Renderer>().materials[1].SetTexture("_MainTex", lightoff); } } } else { GetComponentInParent <SubRoot>().ForceLightingState(true); foreach (Component comp in GetComponentsInChildren <Component>()) { if (comp.name == "Starship_wall_monitor_01_03(Clone)") { comp.GetComponent <Renderer>().materials[1].SetTexture("_MainTex", lighton); } } } isOn = !isOn; }
public void OnHandHover(GUIHand hand) { if (constructable == null) { constructable = gameObject.GetComponent <Constructable>(); } if (constructable.constructed) { if (spin.transform.position.y > GetOceanLevel() + 1f) { string text1 = ""; string text2 = ""; float displayTime = 0f; if (NeedsMaintenance) { text1 = "Wind Turbine: " + Mathf.RoundToInt(this.GetRechargeScalar() * 100f * WindyMultiplier(new Vector3(transform.position.x, transform.position.z))) + "% efficiency, " + Mathf.RoundToInt(this.powerSource.GetPower()).ToString() + "/" + Mathf.RoundToInt(this.powerSource.GetMaxPower()) + " power"; text2 = "Needs maintenance (use repair tool)"; displayTime = 1.5f; } else { text1 = "Wind Turbine: " + Mathf.RoundToInt(this.GetRechargeScalar() * 100f * WindyMultiplier(new Vector3(transform.position.x, transform.position.z))) + "% efficiency, " + Mathf.RoundToInt(this.powerSource.GetPower()).ToString() + "/" + Mathf.RoundToInt(this.powerSource.GetMaxPower()) + " power"; displayTime = 1f; text2 = $"Generation: {this.generationRate.ToString("0.00")}/s"; } SetInteractText(text1, false, text2, false); HandReticle.main.SetIcon(HandReticle.IconType.Info, displayTime); } else { SetInteractText("Wind Turbine: 0% efficiency", false, "Notice: Blades are submerged, please relocate", false); HandReticle.main.SetIcon(HandReticle.IconType.HandDeny, 1f); } } }
public static bool Prefix(DockedVehicleHandTarget __instance, GUIHand hand) { Vehicle vehicle = __instance.dockingBay.GetDockedVehicle(); if (skipPrefix || vehicle == null) { return(true); } SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); NitroxId id = NitroxEntity.GetId(vehicle.gameObject); if (simulationOwnership.HasExclusiveLock(id)) { Log.Debug($"Already have an exclusive lock on this vehicle: {id}"); return(true); } HandInteraction <DockedVehicleHandTarget> context = new HandInteraction <DockedVehicleHandTarget>(__instance, hand); LockRequest <HandInteraction <DockedVehicleHandTarget> > lockRequest = new LockRequest <HandInteraction <DockedVehicleHandTarget> >(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse, context); simulationOwnership.RequestSimulationLock(lockRequest); return(false); }
public void OnHandHover(GUIHand hand) { if (!hand.IsTool()) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Max Power {(int)powerRelay.GetEndpoint().GetMaxPower()}, Current Power: {(int)powerRelay.GetEndpoint().GetPower()}"); stringBuilder.Append($"MainConnections: {!powerRelay.dontConnectToRelays}, "); stringBuilder.Append($"Other Connections: {!otherConnectionsDisabled}"); StringBuilder stringBuilder2 = new StringBuilder(); stringBuilder2.AppendLine("LeftHand: Full Enable/Disable"); stringBuilder2.AppendLine("Deconstruct Key (Q): Other Connections (Green)"); #if SN1 HandReticle.main.SetInteractText(stringBuilder.ToString(), stringBuilder2.ToString(), false, false, HandReticle.Hand.None); #elif BZ HandReticle.main.SetText(HandReticle.TextType.Hand, stringBuilder.ToString(), false); HandReticle.main.SetText(HandReticle.TextType.HandSubscript, stringBuilder2.ToString(), false); #endif if (GameInput.GetButtonDown(GameInput.Button.Deconstruct) && !powerRelay.dontConnectToRelays) { otherConnectionsDisabled = !otherConnectionsDisabled; otherConnectionRelays.ForEach((x) => { x.dontConnectToRelays = otherConnectionsDisabled; x.DisconnectFromRelay(); }); PowerRelay.MarkRelaySystemDirty(); } } }
public void OnHandClick(GUIHand hand) { if (!enabled) { return; } if (Input.GetKey(KeyCode.E)) { GameObject model = this.gameObject.FindChild("forklift"); if (model == null) { return; } BoxCollider collider = this.gameObject.GetComponent <BoxCollider>(); if (model.transform.localScale.y > 10.0f) { model.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); collider.size = new Vector3(0.05f, 0.064f, 0.04f); } else { model.transform.localScale *= 1.25f; collider.size *= 1.25f; } } }
public static bool Prefix(PilotingChair __instance, GUIHand hand) { if (skipPrefix) { return(true); } pilotingChair = __instance; guiHand = hand; SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); SubRoot subRoot = __instance.GetComponentInParent <SubRoot>(); Validate.NotNull(subRoot, "PilotingChair cannot find it's corresponding SubRoot!"); string guid = GuidHelper.GetGuid(subRoot.gameObject); if (simulationOwnership.HasExclusiveLock(guid)) { Log.Debug($"Already have an exclusive lock on the piloting chair: {guid}"); return(true); } simulationOwnership.RequestSimulationLock(guid, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse); return(false); }
public void OnHandClick(GUIHand hand) { if (!hand.IsTool()) { powerRelay.dontConnectToRelays = !powerRelay.dontConnectToRelays; if (powerRelay.dontConnectToRelays) { baseInboundRelay.dontConnectToRelays = powerRelay.dontConnectToRelays; baseInboundRelay.DisconnectFromRelay(); otherConnectionRelays.ForEach((x) => { x.dontConnectToRelays = powerRelay.dontConnectToRelays; x.DisconnectFromRelay(); }); } else { baseInboundRelay.dontConnectToRelays = baseConnectionsDisabled; baseInboundRelay.DisconnectFromRelay(); otherConnectionRelays.ForEach((x) => { x.dontConnectToRelays = otherConnectionsDisabled; x.DisconnectFromRelay(); }); } powerRelay.DisconnectFromRelay(); PowerRelay.MarkRelaySystemDirty(); } }
public void OnHandHover(GUIHand hand) { var main = HandReticle.main; main.SetInteractText($"Open label", false, HandReticle.Hand.Left); main.SetIcon(HandReticle.IconType.Hand); }
public void OnHandHover(GUIHand hand) { HandReticle reticle = HandReticle.main; if (!reticle) { return; } EnergyMixin mixin = shark.energyInterface.sources[0]; if (mixin.HasItem()) { if (mixin.charge > 0f) { isValidHandTarget = false; reticle.SetInteractText("Ion Cube", $"{Mathf.Round(mixin.charge / mixin.capacity * 100f)}% Remaining", false, false, HandReticle.Hand.None); } else { isValidHandTarget = true; reticle.SetInteractText("Ion Cube", $"Click to remove", false, false, HandReticle.Hand.Left); } } else { isValidHandTarget = true; reticle.SetInteractText("Insert Ion Cube", false, HandReticle.Hand.Left); } }
public void OnHandClick(GUIHand hand) { EnergyMixin mixin = shark.energyInterface.sources[0]; if (mixin.HasItem() && mixin.charge == 0f) { InventoryItem item = mixin.batterySlot.storedItem; mixin.batterySlot.RemoveItem(); Destroy(item.item.gameObject); Pickupable ionCube = CraftData.InstantiateFromPrefab(Shark.depletedIonCube).GetComponent <Pickupable>(); ionCube.transform.position = transform.position + transform.up; if (Player.main.HasInventoryRoom(ionCube)) { Inventory.main.Pickup(ionCube); } } if (!mixin.HasItem()) { if (Inventory.main.GetPickupCount(TechType.PrecursorIonCrystal) >= 1) { Inventory.main.container.RemoveItem(TechType.PrecursorIonCrystal); Pickupable battery = CraftData.InstantiateFromPrefab(Shark.internalBattery).GetComponent <Pickupable>(); InventoryItem item = mixin.batterySlot.AddItem(battery); mixin.NotifyHasBattery(item); } } }
public override void OnHandClick(GUIHand hand) { if (isPiloting == false && IsValidHandTarget(hand)) { StartPiloting(); } }
public void OnHandHover(GUIHand hand) { if (_mono == null) { return; } var state = _mono.PowerManager.GetPowerState(); HandReticle main = HandReticle.main; #if DEBUG main.SetInteractText(SeaCookerBuildable.NoPowerAvailable()); #endif //QuickLogger.Debug($"PowerState: {state}"); if (state == FCSPowerStates.Unpowered) { main.SetIcon(HandReticle.IconType.Default); #if SUBNAUTICA main.SetInteractText(SeaCookerBuildable.NoPowerAvailable()); #elif BELOWZERO main.SetText(HandReticle.TextType.Hand, SeaCookerBuildable.NoPowerAvailable(), false); #endif } }
public void OnHandHover(GUIHand hand) { #if SUBNAUTICA if (!IsOperational()) { HandReticle.main.SetInteractText(DisplayLanguagePatching.NotOperational(), false); HandReticle.main.SetIcon(HandReticle.IconType.Default); } else { HandReticle.main.SetInteractText(GetTurbinePowerData(), false); HandReticle.main.SetIcon(HandReticle.IconType.Default); } #elif BELOWZERO if (!IsOperational()) { HandReticle.main.SetText(HandReticle.TextType.Hand, DisplayLanguagePatching.NotOperational(), false); HandReticle.main.SetIcon(HandReticle.IconType.Default); } else { HandReticle.main.SetText(HandReticle.TextType.Hand, GetTurbinePowerData(), false); HandReticle.main.SetIcon(HandReticle.IconType.Default); } #endif }
public static bool PreHandHover(StorageContainer __instance, GUIHand hand) { if (!__instance.enabled) { return(false); } // I've tried to order these checks in order from least-expensive to most-expensive, as I'm not sure whether this method is executed just once, when the hand first hovers over the planter, // or every frame. if (__instance.container == null) { return(true); } if (__instance.container.HasRoomFor(1, 1)) { return(true); } Constructable component = __instance.gameObject.GetComponent <Constructable>(); if (!component || component.constructed) { if (__instance.gameObject.GetComponent <Planter>() == null) { return(true); } HandReticle.main.SetInteractText(__instance.hoverText, string.Empty); HandReticle.main.SetIcon(HandReticle.IconType.HandDeny, 1f); } return(false); }
public void OnHandHover(GUIHand hand) { HandReticle main = HandReticle.main; main.SetInteractText(SubnauticaDeathMarker.InteractText); main.SetIcon(HandReticle.IconType.Hand); }
public static bool Prefix(DockedVehicleHandTarget __instance, GUIHand hand) { vehicleDockingBay = __instance.dockingBay; Vehicle vehicle = vehicleDockingBay.GetDockedVehicle(); if (skipPrefix || vehicle == null) { return(true); } dockedVehicle = __instance; guiHand = hand; SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); NitroxId id = NitroxEntity.GetId(vehicle.gameObject); if (simulationOwnership.HasExclusiveLock(id)) { Log.Debug($"Already have an exclusive lock on this vehicle: {id}"); return(true); } simulationOwnership.RequestSimulationLock(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse); return(false); }
public static bool Prefix(PilotingChair __instance, GUIHand hand) { if (skipPrefix) { return(true); } SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); SubRoot subRoot = __instance.GetComponentInParent <SubRoot>(); Validate.NotNull(subRoot, "PilotingChair cannot find it's corresponding SubRoot!"); NitroxId id = NitroxEntity.GetId(subRoot.gameObject); if (simulationOwnership.HasExclusiveLock(id)) { Log.Debug($"Already have an exclusive lock on the piloting chair: {id}"); return(true); } HandInteraction <PilotingChair> context = new HandInteraction <PilotingChair>(__instance, hand); LockRequest <HandInteraction <PilotingChair> > lockRequest = new LockRequest <HandInteraction <PilotingChair> >(id, SimulationLockType.EXCLUSIVE, ReceivedSimulationLockResponse, context); simulationOwnership.RequestSimulationLock(lockRequest); return(false); }
public void OnHandClick(GUIHand hand) { if (!enabled) { return; } GameObject model = this.gameObject.FindChild("Model"); if (model == null) { return; } GameObject extras = model.FindChild("Submersible_SeaMoth_extras"); GameObject extra = extras.FindChild("Submersible_seaMoth_geo 1").FindChild("seaMoth_storage_01_L_geo"); Renderer rend = extra.GetComponent <Renderer>(); Renderer[] renderers = extras.GetAllComponentsInChildren <Renderer>(); if (rend.enabled) { foreach (Renderer renderer in renderers) { renderer.enabled = false; } } else { foreach (Renderer renderer in renderers) { renderer.enabled = true; } } }
void UpdateActiveTarget() { if (GetLastDockedOnMapRoom().storageContainer.container.GetCount(Main.pickupModule.TechType) > 0) { Targeting.GetTarget(gameObject, 7f, out GameObject target, out float distance, null); var root = UWE.Utils.GetEntityRoot(target); root = root != null ? root : target; if (root.GetComponentProfiled <Pickupable>() is not null && CraftData.GetTechType(root) != TechType.MapRoomCamera) { target = root; } else { target = null; } _activeTarget = target; var guiHand = Player.main.GetComponent <GUIHand>(); if (_activeTarget is not null) { GUIHand.Send(_activeTarget, HandTargetEventType.Hover, guiHand); } }
private void UpdateActiveTarget(bool canPickup, bool canDrill) { GameObject targetObject = null; ObjectType objectType = ObjectType.None; if (canPickup || canDrill) { Targeting.GetTarget(gameObject, 4.8f, out targetObject, out float num); } if (targetObject) { GameObject rootObject = UWE.Utils.GetEntityRoot(targetObject); rootObject = (!(rootObject != null)) ? targetObject : rootObject; if (rootObject.GetComponentProfiled <Pickupable>()) { if (rootObject.GetComponent <Pickupable>().isPickupable) { targetObject = rootObject; objectType = ObjectType.Pickupable; } else { targetObject = null; } } else if (rootObject.GetComponentProfiled <Drillable>()) { targetObject = rootObject; objectType = ObjectType.Drillable; } else { targetObject = null; } } activeTarget = targetObject; if (activeTarget && currentSelectedArm != SeaTruckArm.None) { if (canDrill && objectType == ObjectType.Drillable && GetSelectedArmTechType() == SeaTruckDrillArm_Prefab.TechTypeID) { GUIHand component = Player.main.GetComponent <GUIHand>(); GUIHand.Send(activeTarget, HandTargetEventType.Hover, component); } else if (canPickup && objectType == ObjectType.Pickupable && GetSelectedArmTechType() == SeaTruckClawArm_Prefab.TechTypeID) { Pickupable pickupable = activeTarget.GetComponent <Pickupable>(); TechType techType = pickupable.GetTechType(); HandReticle.main.SetText(HandReticle.TextType.Hand, LanguageCache.GetPickupText(techType), false, GameInput.Button.LeftHand); HandReticle.main.SetIcon(HandReticle.IconType.Hand, 1f); } } }
public static bool Prefix(ref Knife __instance, GUIHand hand) { if (!Config.NONVIOLENT.Equals(DeathRun.config.nonViolent)) { return(true); } Vector3 position = default(Vector3); GameObject gameObject = null; UWE.Utils.TraceFPSTargetPosition(Player.main.gameObject, __instance.attackDist, ref gameObject, ref position, true); if (gameObject == null) { InteractionVolumeUser component = Player.main.gameObject.GetComponent <InteractionVolumeUser>(); if (component != null && component.GetMostRecent() != null) { gameObject = component.GetMostRecent().gameObject; } } if (gameObject) { LiveMixin liveMixin = gameObject.FindAncestor <LiveMixin>(); if (Knife.IsValidTarget(liveMixin)) { if (liveMixin) { bool wasAlive = liveMixin.IsAlive(); TechType t = CraftData.GetTechType(gameObject); if ((t == TechType.GenericJeweledDisk) || (t == TechType.BlueJeweledDisk) || (t == TechType.GreenJeweledDisk) || (t == TechType.PurpleJeweledDisk) || (t == TechType.RedJeweledDisk)) { liveMixin.TakeDamage(__instance.damage, position, __instance.damageType, null); } __instance.GiveResourceOnDamage(gameObject, liveMixin.IsAlive(), wasAlive); } global::Utils.PlayFMODAsset(__instance.attackSound, __instance.transform, 20f); //VFXSurface component2 = gameObject.GetComponent<VFXSurface>(); //Vector3 euler = MainCameraControl.main.transform.eulerAngles + new Vector3(300f, 90f, 0f); //VFXSurfaceTypeManager.main.Play(component2, __instance.vfxEventType, position, Quaternion.Euler(euler), Player.main.transform); } else { gameObject = null; } } if (gameObject == null && hand.GetActiveTarget() == null) { if (Player.main.IsUnderwater()) { global::Utils.PlayFMODAsset(__instance.underwaterMissSound, __instance.transform, 20f); return(false); } global::Utils.PlayFMODAsset(__instance.surfaceMissSound, __instance.transform, 20f); } return(false); }
public void OnHandClick(GUIHand hand) { if (techLight.constructable.constructed) { isOn = !isOn; SetLightsActiveMethod.Invoke(techLight, new object[] { isOn }); } }
public void OnHandClick(GUIHand hand) { if (Player.main == null || !IsConstructed) { return; } OpenStorage(); }
public void OnHandHover(GUIHand hand) { HandReticle main = HandReticle.main; main.SetText(HandReticle.TextType.Hand, "OpenStorage", true, GameInput.Button.LeftHand); //main.SetText(HandReticle.TextType.HandSubscript, string.Empty, false, GameInput.Button.None); main.SetText(HandReticle.TextType.HandSubscript, IsEmpty() ? "Empty" : string.Empty, true, GameInput.Button.None); HandReticle.main.SetIcon(HandReticle.IconType.Hand, 1f); }
public void OnHandClick(GUIHand hand) { if (!base.enabled || this._storageContainer == null) { return; } this._storageContainer.OnHandClick(hand); }
public void OnHandHover(GUIHand hand) { if (techLight.constructable.constructed) { var handReticle = HandReticle.main; handReticle.SetIcon(HandReticle.IconType.Hand); handReticle.SetInteractText("Toggle Floodlight"); } }