Ejemplo n.º 1
0
        public static IEnumerator giveJuggernaut(Entity player, string juggType)
        {
            yield return(WaitForFrame());

            //remove light armor
            if (player.HasPerk("specialty_lightarmor"))
            {
                removeLightArmor(player, player.GetField <int>("previousMaxHealth"));
            }

            //remove explosive bullets
            if (player.HasPerk("specialty_explosivebullets"))
            {
                player.UnSetPerk("specialty_explosivebullets");
            }

            bool createObjectiveIcon = true;

            switch (juggType)
            {
            case "juggernaut":
                player.SetField("isJuggernaut", true);
                giveJuggLoadout(player, player.SessionTeam, juggType);
                player.SetMoveSpeedScale(.65f);
                break;

            case "juggernaut_recon":
                player.SetField("isJuggernautRecon", true);
                giveJuggLoadout(player, player.SessionTeam, juggType);
                player.SetMoveSpeedScale(.75f);

                Entity portable_radar = GSCFunctions.Spawn("script_model", player.Origin);
                portable_radar.SetField("team", player.SessionTeam);

                portable_radar.MakePortableRadar(player);
                player.SetField("personalRadar", portable_radar);

                radarMover(player, portable_radar);
                break;

            case "tjugg_juggernaut":
                player.SetField("isJuggernaut", true);
                giveJuggLoadout(player, player.SessionTeam, "gamemode");
                player.SetMoveSpeedScale(.7f);

                Entity portable_radar1 = GSCFunctions.Spawn("script_model", player.Origin);
                portable_radar1.SetField("team", player.SessionTeam);

                portable_radar1.MakePortableRadar(player);
                player.SetField("personalRadar", portable_radar1);

                radarMover(player, portable_radar1);
                break;

            case "jugg_juggernaut":
                player.SetField("isJuggernaut", true);
                giveJuggLoadout(player, player.SessionTeam, "gamemode");
                player.SetMoveSpeedScale(.7f);
                if (GSCFunctions.GetMatchRulesData("juggData", "showJuggRadarIcon") == "0")
                {
                    createObjectiveIcon = false;
                }
                break;
            }

            updateMoveSpeedScale(player);

            player.DisableWeaponPickup();

            if (GSCFunctions.GetDvarInt("camera_thirdPerson") == 0)
            {
                HudElem juggernautOverlay = GSCFunctions.NewClientHudElem(player);
                juggernautOverlay.X         = 0;
                juggernautOverlay.Y         = 0;
                juggernautOverlay.AlignX    = HudElem.XAlignments.Left;
                juggernautOverlay.AlignY    = HudElem.YAlignments.Top;
                juggernautOverlay.HorzAlign = HudElem.HorzAlignments.Fullscreen;
                juggernautOverlay.VertAlign = HudElem.VertAlignments.Fullscreen;
                juggernautOverlay.SetShader(level.GetField <Dictionary <string, Entity> >("juggSettings")[juggType].GetField <string>("overlay"), 640, 480);
                juggernautOverlay.Sort            = -10;
                juggernautOverlay.Archived        = true;
                juggernautOverlay.HideIn3rdPerson = true;
            }

            juggernautSounds(player);

            player.SetPerk("specialty_radarjuggernaut", true, false);

            teamPlayerCardSplash(level.GetField <Dictionary <string, Entity> >("juggSettings")[juggType].GetField <string>("splashUsedName"), player);
            player.PlaySoundToTeam(voice[player.SessionTeam] + "use_juggernaut", player.SessionTeam, player);
            player.PlaySoundToTeam(voice[otherTeam[player.SessionTeam]] + "enemy_juggernaut", otherTeam[player.SessionTeam]);

            updateKillstreaks(player, true);

            StartAsync(juggRemover(player));

            //reapply flag
            if (player.HasField("carryFlag"))
            {
                yield return(WaitForFrame());

                player.Attach(player.GetField <string>("carryFlag"), "J_spine4", true);
            }

            Notify("juggernaut_equipped", player);

            //Log data?
        }