Пример #1
0
 public void Update()
 {
     if (ExtraSettingsAPI_Loaded && camera != null)
     {
         if (persistence.zoomMinimapIn != null && MyInput.GetButton(persistence.zoomMinimapIn))
         {
             ZoomMinimapIn();
         }
         if (persistence.zoomMinimapOut != null && MyInput.GetButton(persistence.zoomMinimapOut))
         {
             ZoomMinimapOut();
         }
         if (persistence.minimapDrag != null && MyInput.GetButtonDown(persistence.minimapDrag))
         {
             InitMinimapDrag(true);
         }
         if (persistence.minimapDrag != null && MyInput.GetButton(persistence.minimapDrag))
         {
             OnMinimapDrag();
         }
         if (persistence.minimapDrag != null && MyInput.GetButtonUp(persistence.minimapDrag))
         {
             InitMinimapDrag(false);
         }
         if (persistence.caveMode && camera != null)
         {
             var playerY = camera.transform.parent.position.y;
             camera.nearClipPlane = 300 - (playerY + CAVE_MODE_CLIP_TOP);
             camera.farClipPlane  = 300 + (-playerY + CAVE_MODE_CLIP_BOTTOM);
         }
     }
 }
Пример #2
0
    public override void Update(GunController gun)
    {
        m_currPlayingFire = gun.m_gunAnimator.GetCurrentAnimatorStateInfo(0).IsName("fire");

        // To aim state.
        if (MyInput.GetButtonDown("Fire2"))
        {
            if (gun.IsSecondaryState(this))
            {
                gun.ChangeState(new GunStateAim());
            }
            else
            {
                gun.AddSecondaryState(new GunStateAim());
            }
        }

        // End fire.
        if (
            ((gun.m_fireMode != FireMode.Launcher) && MyInput.GetButtonUp("Fire1")) ||
            ((gun.m_fireMode == FireMode.Launcher) && m_prevPlayingFire && !m_currPlayingFire)
            )
        {
            if (gun.IsSecondaryState(this))
            {
                gun.RemoveSecondaryState();
            }
            else
            {
                gun.ChangeState(new GunStateIdle());
            }
        }

        m_prevPlayingFire = m_currPlayingFire;
    }
Пример #3
0
    static void Postfix(PersonController __instance, ref Network_Player ___playerNetwork, ref Vector3 ___moveDirection)
    {
        if (sprintByDefault && !__instance.crouching && !isCrouching)
        {
            __instance.normalSpeed = defaultSprintSpeed;
            __instance.sprintSpeed = defaultNormalSpeed;
        }
        else
        {
            __instance.normalSpeed = defaultNormalSpeed;
            __instance.sprintSpeed = defaultSprintSpeed;
        }

        if (crouchIsToggle)
        {
            if (MyInput.GetButtonUp("Crouch"))
            {
                isCrouching = !isCrouching;
            }
            __instance.crouching = isCrouching;
            ___playerNetwork.Animator.anim.SetBool("Crouching", isCrouching);
            if (!MyInput.GetButton("Crouch") && isCrouching)
            {
                float speed = MyInput.GetButton("Sprint") ? __instance.sprintSpeed : __instance.normalSpeed;
                ___moveDirection /= speed * Stat_WellBeing.groundSpeedMultiplier;
            }
        }
    }
Пример #4
0
    public override void Update(GunController gun)
    {
        // To fire state.
        if (MyInput.GetButtonDown("Fire1"))
        {
            if (gun.NBullets > 0)
            {
                gun.AddSecondaryState(new GunStateFire());
            }
            else
            {
                GameStats._MessageNotifier.PushFloatMessage("Out of bullet");
                GameStats._GunsManager.GetComponent <AudioSource>().PlayOneShot(gun.m_emptyFireSound);
            }
        }

        // End aim.
        if (MyInput.GetButtonUp("Fire2"))
        {
            if (gun.IsSecondaryState(this))
            {
                gun.RemoveSecondaryState();
            }
            else
            {
                gun.ChangeState(new GunStateIdle());
            }
        }
    }
Пример #5
0
 public void Update(FPSMovement movement)
 {
     // Change to walk state.
     if (MyInput.GetButtonUp("Sprint"))
     {
         movement.ChangeState(new FPSCharacterStateWalk());
     }
 }
Пример #6
0
    public void Update()
    {
        if (Semih_Network.InLobbyScene)
        {
            return;
        }
        if (MyInput.GetButtonDown("Sprint"))
        {
            sprinted = !sprinted;
            if (sprinted)
            {
                if (RAPI.GetLocalPlayer().PersonController.controllerType != ControllerType.Water)
                {
                    return;
                }

                float sS = 1f;
                sS *= (RAPI.GetLocalPlayer().PlayerEquipment.GetEquipedIndexes().Contains(63) ? 1.4f : 1f);
                if (sS == 1f)
                {
                    sS = 0f;
                }
                theSpeed = RAPI.GetLocalPlayer().PersonController.swimSpeed;
                if (RAPI.GetLocalPlayer().PersonController.swimSpeed > 10)
                {
                    FindObjectOfType <HNotify>().AddNotification(HNotify.NotificationType.normal, "Swim Sprint : You can't actually Sprint when your swimming speed is more than the sprint itself ;-;", 2, HNotify.ErrorSprite).SetCloseDelay(2).SetTextColor(Color.red);
                    return;
                }
                else if (RAPI.GetLocalPlayer().PersonController.swimSpeed > 2 && RAPI.GetLocalPlayer().PersonController.swimSpeed < 10)
                {
                    RAPI.GetLocalPlayer().PersonController.swimSpeed = 10 + sS;
                    RAPI.GetLocalPlayer().PersonController.swimSpeed = (2 * 5) + sS;
                    GameModeValueManager.GetCurrentGameModeValue().nourishmentVariables.foodDecrementRateMultiplier = 1.2f;
                    GameModeValueManager.GetCurrentGameModeValue().nourishmentVariables.thirstDecrementRateMultiplier = 1.2f;
                    RAPI.GetLocalPlayer().Stats.stat_oxygen.SetOxygenLostPerSecond(1.25f);
                    return;
                }
                RAPI.GetLocalPlayer().PersonController.swimSpeed = 10 + sS;
                GameModeValueManager.GetCurrentGameModeValue().nourishmentVariables.foodDecrementRateMultiplier = 1.3f;
                GameModeValueManager.GetCurrentGameModeValue().nourishmentVariables.thirstDecrementRateMultiplier = 1.3f;
                RAPI.GetLocalPlayer().Stats.stat_oxygen.SetOxygenLostPerSecond(1.5f);
            }
        }
        else if (MyInput.GetButtonUp("Sprint"))
        {
            sprinted = !sprinted;
            if (theSpeed < 2)
            {
                theSpeed = 2;
            }
            RAPI.GetLocalPlayer().PersonController.swimSpeed = theSpeed;
            GameModeValueManager.GetCurrentGameModeValue().nourishmentVariables.foodDecrementRateMultiplier = 1f;
            GameModeValueManager.GetCurrentGameModeValue().nourishmentVariables.thirstDecrementRateMultiplier = 1f;
            RAPI.GetLocalPlayer().Stats.stat_oxygen.SetOxygenLostPerSecond(1f);
        }
    }
Пример #7
0
    private static bool Prefix
    (
        SteeringWheel __instance,
        ref bool ___hasBeenPlaced,
        ref bool ___isDisplayingText,
        DisplayTextManager ___displayText,
        ref Network_Player ___localPlayer,
        ref Semih_Network ___network
    )
    {
        if (!___hasBeenPlaced)
        {
            return(true);
        }
        if (MyInput.GetButton("Sprint"))
        {
            ___isDisplayingText = true;
            ___displayText.ShowText("Toggle Engines", MyInput.Keybinds["Interact"].MainKey, 1, "Toggle Engine Direction", MyInput.Keybinds["Rotate"].MainKey, 2);

            if (MyInput.GetButtonDown("Interact"))
            {
                MoreSailsMoreSpeed.ToggleAllEngines();
            }
            if (MyInput.GetButtonDown("Rotate"))
            {
                MoreSailsMoreSpeed.ToggleAllEnginesDir();
            }
        }
        else
        {
            ___isDisplayingText = true;
            ___displayText.ShowText("Hold for more options", MyInput.Keybinds["Sprint"].MainKey, 1, Helper.GetTerm("Game/RotateSmooth2", false), MyInput.Keybinds["Rotate"].MainKey, 2);
            if (MyInput.GetButtonDown("Rotate"))
            {
                ___localPlayer.PlayerScript.SetMouseLookScripts(false);
            }
            if (MyInput.GetButtonUp("Rotate"))
            {
                ___localPlayer.PlayerScript.SetMouseLookScripts(true);
            }
            if (MyInput.GetButton("Rotate"))
            {
                float axis = Input.GetAxis("Mouse X");
                Message_SteeringWheel_Rotate message = new Message_SteeringWheel_Rotate(Messages.SteeringWheelRotate, ___network.NetworkIDManager, __instance.ObjectIndex, axis);
                if (Semih_Network.IsHost)
                {
                    AccessTools.Method("SteeringWheel:Rotate").Invoke(__instance, new object[] { axis });
                    return(false);
                }
                ___network.SendP2P(___network.HostID, message, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game);
            }
        }
        return(false);
    }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        if (MyInput.GetButtonDown("Fire1"))
        {
            CmdBeginShoot();
        }
        if (MyInput.GetButtonUp("Fire1"))
        {
            CmdEndShoot();
        }
    }
Пример #9
0
    static bool Prefix(Sail __instance, ref CanvasHelper ___canvas, ref Network_Player ___localPlayer)
    {
        if (!MyInput.GetButton("Sprint"))
        {
            return(true);
        }
        if (Helper.LocalPlayerIsWithinDistance(__instance.transform.position, Player.UseDistance) && CanvasHelper.ActiveMenu == MenuType.None)
        {
            if (MyInput.GetButtonDown("Interact"))
            {
                if (Semih_Network.IsHost)
                {
                    if (__instance.open)
                    {
                        MoreSailsMoreSpeedMod.SailsClose();
                    }
                    else
                    {
                        MoreSailsMoreSpeedMod.SailsOpen();
                    }
                }
            }

            if (MyInput.GetButton("Rotate"))
            {
                if (___localPlayer.PlayerScript.MouseLookIsActive())
                {
                    ___localPlayer.PlayerScript.SetMouseLookScripts(false);
                }
                MoreSailsMoreSpeedMod.SailsRotate(Input.GetAxis("Mouse X"), __instance);
            }
            else if (MyInput.GetButtonUp("Rotate"))
            {
                ___localPlayer.PlayerScript.SetMouseLookScripts(true);
            }
            return(false);
        }
        else
        {
            ___canvas.displayTextManager.HideDisplayTexts();
        }
        return(false);
    }
Пример #10
0
    private static bool Prefix
    (
        Sail __instance,
        ref bool ___blockPlaced,
        ref Network_Player ___localPlayer,
        ref CanvasHelper ___canvas,
        ref bool ___isRotating,
        ref GameObject ___paintCollider,
        ref Semih_Network ___network
    )
    {
        if (!___blockPlaced)
        {
            return(false);
        }
        if (___canvas == null || ___canvas.displayTextManager == null || ___localPlayer == null)
        {
            return(false);
        }
        if (Helper.LocalPlayerIsWithinDistance(__instance.transform.position, Player.UseDistance) && CanvasHelper.ActiveMenu == MenuType.None)
        {
            bool mod = MyInput.GetButton("Sprint");
            if (!__instance.open)
            {
                if (mod)
                {
                    ___canvas.displayTextManager.ShowText("Open Sails", MyInput.Keybinds["Interact"].MainKey, 1, "Rotate Sails", MyInput.Keybinds["Rotate"].MainKey, 2);
                }
                else
                {
                    ___canvas.displayTextManager.ShowText("Hold for more options", MyInput.Keybinds["Sprint"].MainKey, 1, "Open", MyInput.Keybinds["Interact"].MainKey, 2, 0, true);
                    ___canvas.displayTextManager.ShowText("Rotate", MyInput.Keybinds["Rotate"].MainKey, 3, 0, false);
                }
            }
            else
            {
                if (mod)
                {
                    ___canvas.displayTextManager.ShowText("Close Sails", MyInput.Keybinds["Interact"].MainKey, 1, "Rotate Sails", MyInput.Keybinds["Rotate"].MainKey, 2);
                }
                else
                {
                    ___canvas.displayTextManager.ShowText("Hold for more options", MyInput.Keybinds["Sprint"].MainKey, 1, "Close", MyInput.Keybinds["Interact"].MainKey, 2, 0, true);
                    ___canvas.displayTextManager.ShowText("Rotate", MyInput.Keybinds["Rotate"].MainKey, 3, 0, false);
                }
            }

            if (MyInput.GetButtonDown("Interact"))
            {
                Message_NetworkBehaviour message = new Message_NetworkBehaviour(__instance.open ? Messages.Sail_Close : Messages.Sail_Open, __instance);
                if (Semih_Network.IsHost)
                {
                    if (__instance.open)
                    {
                        if (mod)
                        {
                            MoreSailsMoreSpeed.SailsClose();
                        }
                        else
                        {
                            AccessTools.Method("Sail:Close").Invoke(__instance, null);
                        }
                    }
                    else
                    {
                        if (mod)
                        {
                            MoreSailsMoreSpeed.SailsOpen();
                        }
                        else
                        {
                            AccessTools.Method("Sail:Open").Invoke(__instance, null);
                        }
                    }
                    ___network.RPC(message, Target.Other, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game);
                }
                else
                {
                    ___network.SendP2P(___network.HostID, message, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game);
                }
            }

            if (MyInput.GetButton("Rotate"))
            {
                ___localPlayer.PlayerScript.SetMouseLookScripts(false);
                ___isRotating = true;
            }
            else if (MyInput.GetButtonUp("Rotate"))
            {
                if (mod)
                {
                    MoreSailsMoreSpeed.RotateSailsTo(__instance);
                }
                ___localPlayer.PlayerScript.SetMouseLookScripts(true);
                ___isRotating = false;
            }
            if (MyInput.GetButtonUp("Sprint") && ___isRotating)
            {
                MoreSailsMoreSpeed.RotateSailsTo(__instance);
                ___localPlayer.PlayerScript.SetMouseLookScripts(true);
                ___isRotating = false;
                return(false);
            }

            bool button = MyInput.GetButton("Rotate");
            if (button)
            {
                float axis = Input.GetAxis("Mouse X");
                if (Semih_Network.IsHost)
                {
                    AccessTools.Method("Sail:Rotate").Invoke(__instance, new object[] { axis });
                }
                else
                {
                    Message_Sail_Rotate message2 = new Message_Sail_Rotate(Messages.Sail_Rotate, __instance, axis);
                    ___network.SendP2P(___network.HostID, message2, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game);
                }
            }
            ___paintCollider.SetActiveSafe(!button);
            return(false);
        }
        if (___isRotating)
        {
            ___isRotating = false;
            ___localPlayer.PlayerScript.SetMouseLookScripts(true);
        }
        ___canvas.displayTextManager.HideDisplayTexts();
        return(false);
    }