예제 #1
0
        private static void ballScore(Entity zone, int points = 1)
        {
            if (!ballEnt.HasField("carrier"))
            {
                Log.Write(LogLevel.Error, "Ball scored without proper setup! Carrier was not set");
                return;
            }
            Entity scorer = ballEnt.GetField <Entity>("carrier");

            if (scorer == null || scorer == level)
            {
                Log.Write(LogLevel.Error, "Ball scored with no valid carrier!");
                return;
            }
            GSCFunctions.PlayFX(ballExplodeFX, zone.Origin);
            stopBallFX();
            ballEnt.PlaySound("mp_capture_flag");
            ballEnt.Unlink();//Unlink from parent ent
            ballEnt.MoveTo(zone.Origin, 1, .5f, .5f);
            scorer.Notify("objective", "captured");
            AfterDelay(1000, () => ballEnt.MoveTo(zone.Origin + new Vector3(0, 0, 5000), 3, 1));
            AfterDelay(4000, () => respawnBall());
            string team  = zone.GetField <string>("team");
            int    score = GSCFunctions.GetTeamScore(team);

            GSCFunctions.SetTeamScore(team, score + points);

            StartAsync(checkRoundWin(scorer));
        }
예제 #2
0
        private static void scaleTDMScore()
        {
            if (GSCFunctions.GetDvar("g_gametype") != "war")
            {
                return;
            }

            int totalPlayers = Players.Count;
            int highestScore = Math.Max(GSCFunctions.GetTeamScore("allies"), GSCFunctions.GetTeamScore("axis"));

            switch (totalPlayers)
            {
            case 1:
            case 2:
            case 3:
                if (highestScore < 1500)
                {
                    GSCFunctions.SetDynamicDvar("scr_war_scorelimit", 1500);
                }
                break;

            case 4:
            case 5:
                if (highestScore < 2500)
                {
                    GSCFunctions.SetDynamicDvar("scr_war_scorelimit", 2500);
                }
                break;

            case 6:
            case 7:
            case 8:
            case 9:
                if (highestScore < 5000)
                {
                    GSCFunctions.SetDynamicDvar("scr_war_scorelimit", 5000);
                }
                break;

            case 10:
            case 11:
            case 12:
                if (highestScore < 7500)
                {
                    GSCFunctions.SetDynamicDvar("scr_war_scorelimit", 7500);
                }
                break;
            }
        }
예제 #3
0
        private static IEnumerator checkRoundWin(Entity winner)
        {
            string team = winner.SessionTeam;

            if (GSCFunctions.GetTeamScore(team) >= GSCFunctions.GetDvarInt("scr_ctf_scorelimit"))
            {
                //HACK, set scorelimit to 1 then teleport the corresponding flag and enemy base to the winning player to tell GSC we scored a flag
                GSCFunctions.SetDynamicDvar("scr_ctf_scorelimit", "1");
                GSCFunctions.SetTeamScore(winner.SessionTeam, 0);
                yield return(Wait(.5f));//Wait a frame or two to let scorelimit update

                Notify("update_scorelimit", 1);
                if (isHalftime)
                {
                    if (team == "allies")
                    {
                        OnInterval(50, () =>
                        {
                            alliesFlagBase.Origin = winner.Origin;
                            if (gameEnded)
                            {
                                return(false);
                            }
                            return(true);
                        });
                        axisFlagTrig2.LinkTo(winner, "tag_origin", Vector3.Zero, Vector3.Zero);
                    }
                    else if (team == "axis")
                    {
                        OnInterval(50, () =>
                        {
                            axisFlagBase.Origin = winner.Origin;
                            if (gameEnded)
                            {
                                return(false);
                            }
                            return(true);
                        });
                        alliesFlagTrig2.LinkTo(winner, "tag_origin", Vector3.Zero, Vector3.Zero);
                    }
                    else
                    {
                        GSCFunctions.SetDynamicDvar("scr_ctf_timelimit", "0.01");//Failsafe
                    }
                }
                else
                {
                    if (team == "allies")
                    {
                        OnInterval(50, () =>
                        {
                            axisFlagBase.Origin = winner.Origin;
                            if (gameEnded)
                            {
                                return(false);
                            }
                            return(true);
                        });
                        alliesFlagTrig2.LinkTo(winner, "tag_origin", Vector3.Zero, Vector3.Zero);
                    }
                    else if (team == "axis")
                    {
                        OnInterval(50, () =>
                        {
                            alliesFlagBase.Origin = winner.Origin;
                            if (gameEnded)
                            {
                                return(false);
                            }
                            return(true);
                        });
                        axisFlagTrig2.LinkTo(winner, "tag_origin", Vector3.Zero, Vector3.Zero);
                    }
                    else
                    {
                        GSCFunctions.SetDynamicDvar("scr_ctf_timelimit", "0.01");//Failsafe
                    }
                }
            }
        }