예제 #1
0
        private void Heal()
        {
            float pHealth = Player.localPlayer.m_playerDeath.health;

            if (pHealth < 100)
            {
                server?.ClientRequestHeal(PickupHelper.GetItemIndexByName("Med Kit"));
            }
        }
예제 #2
0
        public void Update()
        {
            marker.transform.position = PlayerManager.LocalPlayer.m_head.transform.position;
            if (Input.GetKeyDown(KeyCode.F8))
            {
                DumpItems();
            }

            if (Input.GetKey(KeyCode.End))
            {
                Destroy(this);
            }

            if (Player.localPlayer == null)
            {
                return;
            }

            if (Input.GetKey(KeyCode.K) && PlayerManager.AllPlayers.Length > 0)
            {
                foreach (var p in PlayerManager.AlivePlayers)
                {
                    if (p != Player.localPlayer)
                    {
                        p.m_playerDeath.TakeDamage(Vector3.one * 30f, Vector3.one, false, null, false, false, null, null);
                    }
                }
            }

            PerformTaze();

            if (Input.GetKeyDown(KeyCode.KeypadEnter))
            {
                fly = !fly;
            }

            if (Input.GetKeyDown(KeyCode.Q))
            {
                Skydive();
            }

            if (Input.GetKeyDown(KeyCode.L))
            {
                foreach (var i in PickupHelper.GetAllItemNames())
                {
                    ItemDataEntry e;
                    if (PickupHelper.GetItemByName(i, out e))
                    {
                        Console.WriteLine("DROPPING {0}", e.pickup.name);
                        Player.localPlayer.m_interactionHandler.Drop(e.pickup.m_itemIndex, 10, true, e.pickup.equipSlots, false, false);
                    }
                }
            }
            if (Input.GetKeyDown(KeyCode.F1))
            {
                server?.TranscendToGod();
            }

            if (Input.GetKeyDown(KeyCode.F2))
            {
                server?.RipShitUp();
            }

            if (Input.GetKeyDown(KeyCode.T))
            {
                TeleportToCrosshair();
            }
            ;

            if (Input.GetKey(KeyCode.B))
            {
                TazePlayer(PlayerManager.Nearest, 5f);
            }

            if (Input.GetKey(KeyCode.N))
            {
                TazePlayer(PlayerManager.Target, 5f);
            }

            if (Input.GetKey(KeyCode.J) && server)
            {
                var t = PlayerManager.Target;
                if (t)
                {
                    server.ClientDoEffect(t.GetID(), MKABDBMIHKD.Skydiving, 5f);
                }
            }

            if (Input.GetKey(KeyCode.Mouse3) && Player.localPlayer)
            {
                Player.localPlayer.GetComponent <InputHandler>().inputMovementDirection += Player.localPlayer.m_playerCamera.transform.forward * 20f;
            }

            if (Input.GetKey(KeyCode.Mouse4))
            {
                marker.transform.position = Player.localPlayer.m_playerCamera.transform.position
                                            + Vector3.up * UnityEngine.Random.Range(0f, 2f)
                                            + Vector3.left * UnityEngine.Random.Range(-5f, 5f)
                                            + Vector3.forward * UnityEngine.Random.Range(-5f, 5f);

                server?.SendPlayerUpdate(marker.transform.position,
                                         new Vector2(UnityEngine.Random.Range(-179, 179), UnityEngine.Random.Range(-179, 179)),
                                         new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f)),
                                         5, true);
            }

            PlayerManager.LocalPlayer.m_weaponHandler?.leftWeapon?.GetComponentInChildren <Railing>(true)?.gameObject.SetActive(true);
            PlayerManager.LocalPlayer.m_weaponHandler?.rightWeapon?.GetComponentInChildren <Railing>(true)?.gameObject.SetActive(true);

            if (Input.GetKeyDown(KeyCode.KeypadPlus))
            {
                DumpLayers();
            }

            if (Input.GetKey(KeyCode.U))
            {
                foreach (var p in PlayerManager.LookingAtMe)
                {
                    server.ClientDoEffect(p.GetID(), MKABDBMIHKD.Tase, 5f);
                }
            }
            if (Input.GetKeyDown(KeyCode.KeypadMultiply))
            {
                autoPickup = !autoPickup;
            }

            if (autoPickup && PickupManager.instance)// && autoPickupLast + autoPickupInterval < Time.time)
            {
                var p = GetNearestPickup(PickupManager.instance.m_Pickups);
                if (p)
                {
                    Console.WriteLine("Picking up {0}", p.name);
                    var oldPos   = PlayerManager.LocalPlayer.m_torso.transform;
                    var rotation = new Vector2(PlayerManager.LocalPlayer.m_torso.transform.rotation.eulerAngles.x, PlayerManager.LocalPlayer.m_torso.transform.rotation.eulerAngles.y);

                    server?.SendPlayerUpdate(p.transform.position, rotation, p.transform.forward, 1, true);
                    p.canInteract = true;
                    Player.localPlayer.m_interactionHandler.PickUp(p, false, p.equipSlots, 1);

                    server?.SendPlayerUpdate(oldPos.position, rotation, oldPos.forward, 1, true);
                    autoPickupLast = Time.time;
                }
            }
        }