]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
GameRules: make `GameRules_teams(true)` imply `have_team_spawns = -1`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / nexball / nexball.qc
index a9bd737ca0066caff3db25d142ae2b4afa4e9a9e..163cc3854185fbd7b52165fdf6ef0399e1275a44 100644 (file)
@@ -72,11 +72,11 @@ float OtherTeam(float t)  //works only if there are two teams on the map!
 const float ST_NEXBALL_GOALS = 1;
 void nb_ScoreRules(int teams)
 {
-       ScoreRules_basics(teams, 0, 0, true);
-       ScoreInfo_SetLabel_TeamScore(   ST_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore( SP_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
-       ScoreRules_basics_end();
+    GameRules_scoring(teams, 0, 0, {
+        field_team(ST_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
+        field(SP_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
+        field(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
+    });
 }
 
 void LogNB(string mode, entity actor)
@@ -119,14 +119,16 @@ void relocate_nexball(entity this)
        tracebox(this.origin, BALL_MINS, BALL_MAXS, this.origin, true, this);
        if(trace_startsolid)
        {
-               vector o;
-               o = this.origin;
-               if(!move_out_of_solid(this))
+               vector o = this.origin;
+               if (!move_out_of_solid(this)) {
                        objerror(this, "could not get out of solid at all!");
-               LOG_INFO("^1NOTE: this map needs FIXING. ", this.classname, " at ", vtos(o - '0 0 1'));
-               LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(this.origin.x - o.x));
-               LOG_INFO(" ", ftos(this.origin.y - o.y));
-               LOG_INFO(" ", ftos(this.origin.z - o.z), "'\n");
+        }
+        LOG_INFOF(
+            "^1NOTE: this map needs FIXING. %s at %s needs to be moved out of solid, e.g. by %s",
+            this.classname,
+            vtos(o - '0 0 1'),
+            vtos(this.origin - o)
+        );
                this.origin = o;
        }
 }
@@ -234,7 +236,7 @@ void DropBall(entity ball, vector org, vector vel)
 
 void InitBall(entity this)
 {
-       if(gameover) return;
+       if(game_stopped) return;
        UNSET_ONGROUND(this);
        set_movetype(this, MOVETYPE_BOUNCE);
        if(this.classname == "nexball_basketball")
@@ -362,7 +364,7 @@ void GoalTouch(entity this, entity toucher)
        float isclient, pscore, otherteam;
        string pname;
 
-       if(gameover) return;
+       if(game_stopped) return;
        if((this.spawnflags & GOAL_TOUCHPLAYER) && toucher.ballcarried)
                ball = toucher.ballcarried;
        else
@@ -753,11 +755,11 @@ void W_Nexball_Touch(entity this, entity toucher)
                                LogNB("stole", attacker);
                                _sound(toucher, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
 
-                               if(SAME_TEAM(attacker, toucher) && time > attacker.teamkill_complain)
+                               if(SAME_TEAM(attacker, toucher) && time > CS(attacker).teamkill_complain)
                                {
-                                       attacker.teamkill_complain = time + 5;
-                                       attacker.teamkill_soundtime = time + 0.4;
-                                       attacker.teamkill_soundsource = toucher;
+                                       CS(attacker).teamkill_complain = time + 5;
+                                       CS(attacker).teamkill_soundtime = time + 0.4;
+                                       CS(attacker).teamkill_soundsource = toucher;
                                }
 
                                GiveBall(attacker, toucher.ballcarried);
@@ -910,6 +912,11 @@ METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor, .entity weapo
     //weapon_setup(WEP_PORTO.m_id);
 }
 
+METHOD(BallStealer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+    TC(BallStealer, this);
+}
+
 METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor, .entity weaponentity))
 {
     TC(BallStealer, this);
@@ -1148,9 +1155,9 @@ REGISTER_MUTATOR(nb, g_nexball)
                InitializeEntity(NULL, nb_delayedinit, INITPRIO_GAMETYPE);
                WEP_NEXBALL.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
 
-               ActivateTeamplay();
-               SetLimits(autocvar_g_nexball_goallimit, autocvar_g_nexball_goalleadlimit, autocvar_timelimit_override, -1);
-               have_team_spawns = -1; // request team spawns
+               GameRules_teams(true);
+               GameRules_limit_score(autocvar_g_nexball_goallimit);
+               GameRules_limit_lead(autocvar_g_nexball_goalleadlimit);
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE