]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_keyhunt.qc
Merge branch 'master' into Mario/turrets
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_keyhunt.qc
index a0cbf619a77f61a6ea73a0e16bbf2c3c7c0b3f90..7b3ea98af6dc0dc558224870e604164259e969d3 100644 (file)
@@ -67,6 +67,26 @@ string kh_sound_alarm = "kh/alarm.wav";  // the new siren/alarm
 
 float kh_key_dropped, kh_key_carried;
 
+#define ST_KH_CAPS 1
+#define SP_KH_CAPS 4
+#define SP_KH_PUSHES 5
+#define SP_KH_DESTROYS 6
+#define SP_KH_PICKUPS 7
+#define SP_KH_KCKILLS 8
+#define SP_KH_LOSSES 9
+void kh_ScoreRules(float teams)
+{
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE);
+       ScoreInfo_SetLabel_TeamScore(  ST_KH_CAPS,      "caps",      SFL_SORT_PRIO_SECONDARY);
+       ScoreInfo_SetLabel_PlayerScore(SP_KH_CAPS,      "caps",      SFL_SORT_PRIO_SECONDARY);
+       ScoreInfo_SetLabel_PlayerScore(SP_KH_PUSHES,    "pushes",    0);
+       ScoreInfo_SetLabel_PlayerScore(SP_KH_DESTROYS,  "destroyed", SFL_LOWER_IS_BETTER);
+       ScoreInfo_SetLabel_PlayerScore(SP_KH_PICKUPS,   "pickups",   0);
+       ScoreInfo_SetLabel_PlayerScore(SP_KH_KCKILLS,   "kckills",   0);
+       ScoreInfo_SetLabel_PlayerScore(SP_KH_LOSSES,    "losses",    SFL_LOWER_IS_BETTER);
+       ScoreRules_basics_end();
+}
+
 float kh_KeyCarrier_waypointsprite_visible_for_player(entity e)  // runs all the time
 {
        if(!IS_PLAYER(e) || self.team != e.team)
@@ -426,7 +446,7 @@ void kh_Key_Touch()  // runs many, many times when a key has been dropped and ca
                // maybe start a shorter countdown?
        }
 
-       if not(IS_PLAYER(other))
+       if (!IS_PLAYER(other))
                return;
        if(other.deadflag != DEAD_NO)
                return;
@@ -500,6 +520,7 @@ void kh_WinnerTeam(float teem)  // runs when a team wins // Samual: Teem?.... TE
                f = DistributeEvenly_Get(1);
                kh_Scores_Event(key.owner, key, "capture", f, 0);
                PlayerTeamScore_Add(key.owner, SP_KH_CAPS, ST_KH_CAPS, 1);
+               nades_GiveBonus(key.owner, autocvar_g_nades_bonus_score_high);
        }
 
        first = TRUE;
@@ -627,9 +648,9 @@ void kh_LoserTeam(float teem, entity lostkey)  // runs when a player pushes a fl
                        --j;
                }
        }
-       
+
        Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(lostkey, INFO_KEYHUNT_LOST_), lostkey.kh_previous_owner.netname);
-       
+
        play2all(kh_sound_destroy);
        te_tarexplosion(lostkey.origin);
 
@@ -647,7 +668,7 @@ void kh_Key_Think()  // runs all the time
        if(self.owner)
        {
 #ifndef KH_PLAYER_USE_ATTACHMENT
-               makevectors('0 1 0' * (self.cnt + mod(time, 360) * KH_KEY_XYSPEED));
+               makevectors('0 1 0' * (self.cnt + (time % 360) * KH_KEY_XYSPEED));
                setorigin(self, v_forward * KH_KEY_XYDIST + '0 0 1' * self.origin_z);
 #endif
        }
@@ -790,7 +811,7 @@ void kh_Key_DropOne(entity key)
        kh_Scores_Event(player, key, "dropkey", 0, 0);
        PlayerScore_Add(player, SP_KH_LOSSES, 1);
        Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(key, INFO_KEYHUNT_DROP_), player.netname);
-       
+
        kh_Key_AssignTo(key, world);
        makevectors(player.v_angle);
        key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, FALSE);
@@ -840,8 +861,8 @@ float kh_CheckPlayers(float num)
                                if(!tmp_player.BUTTON_CHAT)
                                        if(tmp_player.team == t_team)
                                                ++players;
-               
-               if not(players) { return t_team; }
+
+               if (!players) { return t_team; }
        }
        return 0;
 }
@@ -855,7 +876,7 @@ void kh_WaitForPlayers()  // delay start of the round until enough players are p
        }
 
        float p1 = kh_CheckPlayers(0), p2 = kh_CheckPlayers(1), p3 = kh_CheckPlayers(2), p4 = kh_CheckPlayers(3);
-       if not(p1 || p2 || p3 || p4)
+       if (!(p1 || p2 || p3 || p4))
        {
                Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEYHUNT_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round);
                kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, kh_StartRound);
@@ -893,7 +914,7 @@ void kh_StartRound()  // runs at the start of each round
                Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEYHUNT_WAIT, p1, p2, p3, p4);
                return;
        }
-       
+
        Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT);
        Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT_OTHER);
 
@@ -989,7 +1010,7 @@ void kh_Initialize()  // sets up th KH environment
 
        addstat(STAT_KH_KEYS, AS_INT, kh_state);
 
-       ScoreRules_kh(kh_teams);
+       kh_ScoreRules(kh_teams);
 }
 
 void kh_finalize()