]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add "rounds" score field for CA
authorJan Behrens <jan.d.behrens@uni-muenster.de>
Fri, 10 May 2013 11:15:02 +0000 (13:15 +0200)
committerJan Behrens <zykure@web.de>
Fri, 10 May 2013 14:17:59 +0000 (16:17 +0200)
qcsrc/server/cl_player.qc
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_ca.qh

index f00d42df275b032424f099cf76910ef941b8b03a..2b7566298e8cd4a922fa5253fba88d8e40ae3bb6 100644 (file)
@@ -497,7 +497,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        self.dmg_inflictor = inflictor;
 
        if(g_ca && self != attacker && IS_PLAYER(attacker))
-               PlayerScore_Add(attacker, SP_SCORE, (damage - excess) * autocvar_g_ca_damage2score_multiplier);
+               PlayerTeamScore_Add(attacker, SP_SCORE, ST_SCORE, (damage - excess) * autocvar_g_ca_damage2score_multiplier);
 
        float abot, vbot, awep;
        abot = (IS_BOT_CLIENT(attacker));
index 32e7e98b6d080ffe81f5622e735d1d4598d5fe12..7c8c1cb77c62c8d451e5fa7f0def6c9cc5e5e019 100644 (file)
@@ -85,7 +85,7 @@ float CA_CheckWinner()
        {
                Send_Notification(NOTIF_ALL, world, MSG_CENTER, APP_TEAM_NUM_4(winner_team, CENTER_ROUND_TEAM_WIN_));
                Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(winner_team, INFO_ROUND_TEAM_WIN_));
-               TeamScore_AddToTeam(winner_team, ST_SCORE, +1);
+               TeamScore_AddToTeam(winner_team, ST_CA_ROUNDS, +1);
        }
        else if(winner_team == -1)
        {
@@ -226,7 +226,7 @@ MUTATOR_HOOKFUNCTION(ca_SetStartItems)
 {
        start_health = cvar("g_lms_start_health");
        start_armorvalue = cvar("g_lms_start_armor");
-       
+
        start_ammo_shells = cvar("g_lms_start_ammo_shells");
        start_ammo_nails = cvar("g_lms_start_ammo_nails");
        start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
@@ -238,6 +238,19 @@ MUTATOR_HOOKFUNCTION(ca_SetStartItems)
        return 0;
 }
 
+// scoreboard setup
+void ca_ScoreRules()
+{
+       ScoreRules_basics(2, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+       ScoreInfo_SetLabel_TeamScore  (ST_CA_ROUNDS,    "rounds",    SFL_SORT_PRIO_PRIMARY);
+       ScoreRules_basics_end();
+}
+
+void ca_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+{
+       ca_ScoreRules();
+}
+
 void ca_Initialize()
 {
        allowed_to_spawn = TRUE;
@@ -249,6 +262,8 @@ void ca_Initialize()
        addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
        addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
        addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
+
+       InitializeEntity(world, ca_DelayedInit, INITPRIO_GAMETYPE);
 }
 
 MUTATOR_DEFINITION(gamemode_ca)
index ab0a9d1954e928a5e4621df4fb34bb1b1ec5d3e8..a33395254bef0a82abefaebe7ed17b88d9c3b426 100644 (file)
@@ -1,3 +1,8 @@
 // should be removed in the future, as other code should not have to care
 .float caplayer; // 0.5 if scheduled to join the next round
 
+#ifdef SVQC
+
+#define ST_CA_ROUNDS 1
+
+#endif