static void Postfix(Player __instance, ShipControlls ___m_shipControl) { if (__instance != Player.m_localPlayer || !VHVRConfig.UseVrControls()) { return; } var useAction = VRControls.instance.useLeftHandAction; if (useAction == null) { LogWarning("Left Hand Use Action not initialized."); return; } if (!useAction.GetStateDown(SteamVR_Input_Sources.LeftHand)) { if (useAction.GetState(SteamVR_Input_Sources.LeftHand) && leftHover) { Player_Interact_ReversePatch.Run(__instance, leftHover, true); } } else if (leftHover) { Player_Interact_ReversePatch.Run(__instance, leftHover, false); } else if (___m_shipControl) { __instance.StopShipControl(); } }
static void Prefix(ShipControlls shipControl) { Ship playerShip = shipControl.GetShip(); Player.m_localPlayer.RaiseSkill(SailingType, 1f); // Raise the player skill so that they at least have the skill. float sailFactor = Player.m_localPlayer.GetSkillFactor(SailingType); // This is the skill level from 0-1 (1 meaning the skill is level 100) playerShip.m_sailForceFactor *= (1 + sailFactor); // Change the sail force factor so that a player with skill level 100 will have double the sail force }
static bool Player_SetControls_Prefix(ShipControlls ___m_shipControl) { AirshipControlls airshipControlls = ___m_shipControl as AirshipControlls; if (airshipControlls != null) { return(true); } return(true); }
static void Prefix(ShipControlls ___m_shipControl) { if (___m_shipControl != null) // Ensure we are actually steering a ship currently { if ((bool)___m_shipControl) { Ship playerShip = ___m_shipControl.GetShip(); // Get the ship we are steering playerShip.m_sailForceFactor = 0.1f; // Revert this to the original value } } }
private void UpdatePrefabs() { try { var stoneGolemTrophyPrefab = PrefabManager.Instance.GetPrefab("TrophySGolem"); var surtlingCorePrefab = PrefabManager.Instance.GetPrefab("SurtlingCore"); var raftPrefab = PrefabManager.Instance.GetPrefab("Raft"); Ship raftShip = raftPrefab.GetComponent <Ship>(); ShipControlls raftShipControlls = raftPrefab.GetComponentInChildren <ShipControlls>(); GameObject onBoardTrigger = Object.Instantiate(new GameObject(), airshipPiece.PiecePrefab.transform); onBoardTrigger.name = "OnBoardTrigger"; BoxCollider onBoardCollider = onBoardTrigger.AddComponent <BoxCollider>(); onBoardCollider.isTrigger = true; onBoardTrigger.layer = characterTriggerLayer; onBoardTrigger.transform.localPosition = new Vector3(0, 1, 0); onBoardTrigger.transform.localScale = Vector3.one * 2; GameObject attachPoint = Object.Instantiate(new GameObject(), airshipPiece.PiecePrefab.transform); attachPoint.name = "attachpoint"; attachPoint.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); GameObject shipObject = Object.Instantiate(new GameObject(), airshipPiece.PiecePrefab.transform); shipObject.name = "ship"; GameObject collidersObject = Object.Instantiate(new GameObject(), shipObject.transform); collidersObject.name = "colliders"; collidersObject.layer = vehicleLayer; var colliderObject = airshipPiece.PiecePrefab.transform.Find("collider").gameObject; colliderObject.transform.SetParent(collidersObject.transform); colliderObject.name = "Cube"; colliderObject.layer = vehicleLayer; BoxCollider boxCollider = colliderObject.GetComponent <BoxCollider>(); boxCollider.material = raftPrefab.transform.Find("ship/colliders/Cube").GetComponent <BoxCollider>().material; WearNTear wearNTear = airshipPiece.Piece.GetComponent <WearNTear>(); wearNTear.m_noSupportWear = false; wearNTear.m_supports = true; airshipPiece.Piece.m_icon = stoneGolemTrophyPrefab.GetComponent <ItemDrop>().m_itemData.m_shared.m_icons[0]; airshipPiece.PiecePrefab.AddComponent <AirshipBase>(); Airship airship = airshipPiece.PiecePrefab.AddComponent <Airship>(); airship.m_controlGuiPos = raftShip.m_controlGuiPos; AddVisualPiece(stoneGolemTrophyPrefab, "crystal1", new Vector3(1f, 0f, -1f), Quaternion.Euler(0f, 0f, 0f), new Vector3(0.5f, 0.5f, 0.5f)); var surtlingCore = AddVisualPiece(surtlingCorePrefab, "surtlingCore", new Vector3(1f, 1f, 0f), Quaternion.Euler(0f, 0f, 0f), Vector3.one); AirshipControlls airshipControlls = surtlingCore.AddComponent <AirshipControlls>(); airshipControlls.m_attachAnimation = raftShipControlls.m_attachAnimation; airshipControlls.m_maxUseRange = raftShipControlls.m_maxUseRange; AddVisualPiece(stoneGolemTrophyPrefab, "crystal2", new Vector3(1f, 0f, 1f), Quaternion.Euler(0f, 180f, 0f), new Vector3(0.5f, 0.5f, 0.5f)); } finally { PieceManager.OnPiecesRegistered -= UpdatePrefabs; } }
internal static bool ShipControllsInteract(On.ShipControlls.orig_Interact orig, ShipControlls self, Humanoid character, bool repeat) { PulleyControlls pulleyControlls = self as PulleyControlls; if (pulleyControlls && !pulleyControlls.m_ship) { character.Message(MessageHud.MessageType.Center, "$msg_pulley_is_not_connected"); return(false); } return(orig(self, character, repeat)); }
static void Postfix(ShipControlls shipControl) { // Debug.Log("*** Static Sailing Camera: Started sailing ***"); Configuration.isSailing = true; }