Example #1
0
        void TeleportHaleToPlayers()
        {
            IPlayer[] players   = Game.GetPlayers();
            IPlayer   plr       = HALE;
            float     HalePlace = HALE.GetWorldPosition().X;
            int       faceDir   = plr.GetFaceDirection();
            int       counter   = 1;
            int       index;
            bool      isSideRight;

            while ((plr == HALE || plr.IsDead == true) & counter < 20)
            {
                index       = m_rnd.Next(0, players.Length);
                isSideRight = HalePlace < players[index].GetWorldPosition().X;
                // Player on the right side?
                if (faceDir == 1 & isSideRight)
                {
                    plr = players[index];
                }
                // Player on the left side?
                else if (faceDir == -1 & !isSideRight)
                {
                    plr = players[index];
                }
                counter++;
            }
            Game.PlaySound("ChurchBell1", plr.GetWorldPosition(), 1);
            SFDGameScriptInterface.Vector2 nextPlace = plr.GetWorldPosition();
            HALE.SetWorldPosition(nextPlace);
        }
Example #2
0
        public void OnPlayerKeyInput(IPlayer player, VirtualKeyInfo[] keyEvents)
        {
            for (int i = 0; i < keyEvents.Length; i++)
            {
                // Game.WriteToConsole(string.Format("Player {0} keyevent: {1}", player.UniqueID, keyEvents[i].ToString()));

                // TP HALE to some position if HALE presses DOWN + BLOCK and cooldown is gone
                if (keyEvents[i].Event == VirtualKeyEvent.Pressed && keyEvents[i].Key == VirtualKey.BLOCK && player.KeyPressed(VirtualKey.CROUCH_ROLL_DIVE))
                {
                    if (player == HALE && (Game.TotalElapsedGameTime - lastTeleported) > tpCooldown && tpEnabled == true)
                    {
                        lastTeleported = Game.TotalElapsedGameTime;
                        if (HALENAMES[HALETYPE] == "Sin Feaster")
                        {
                            TeleportHaleToPlayers();
                            HALE.SetInputEnabled(false);
                            HaleMovementStopper.Trigger();
                        }
                        break;
                    }
                    else if (player == HALE && (Game.TotalElapsedGameTime - lastWarudod) > warudoCooldown && warudoEnabled == true)
                    {
                        lastWarudod = Game.TotalElapsedGameTime;
                        IPlayer[] players = Game.GetPlayers();
                        foreach (IPlayer plr in players)
                        {
                            if (plr != HALE)
                            {
                                plr.SetInputEnabled(false);
                                Game.PlaySound("ChurchBell1", plr.GetWorldPosition(), 1);
                            }
                        }
                        Game.RunCommand("/SLOMO " + "1");
                        PlayerMovementStopper.Trigger();
                    }
                }
            }
        }