]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a mutator file for deathmatch and add a hook for counting the remaining frags...
authorMario <zacjardine@y7mail.com>
Sat, 29 Aug 2015 06:23:14 +0000 (16:23 +1000)
committerMario <zacjardine@y7mail.com>
Sat, 29 Aug 2015 06:23:51 +0000 (16:23 +1000)
qcsrc/server/g_world.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_deathmatch.qc [new file with mode: 0644]
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/gamemode_race.qc
qcsrc/server/mutators/gamemode_tdm.qc
qcsrc/server/mutators/mutators.qh
qcsrc/server/mutators/mutators_include.qc
qcsrc/server/teamplay.qc

index 2ad5af5ac6b9e5fa55215f2e36e7ef26ac389293..05c508c4c1ac702a6ed7f18ce44d3d7384c433b9 100644 (file)
@@ -1857,7 +1857,7 @@ float WinningCondition_Scores(float limit, float leadlimit)
        if(WinningConditionHelper_zeroisworst)
                leadlimit = 0; // not supported in this mode
 
-       if(g_dm || g_tdm || g_ca || g_freezetag || (g_race && !g_race_qualifying) || g_nexball)
+       if(MUTATOR_CALLHOOK(Scores_CountFragsRemaining))
        // these modes always score in increments of 1, thus this makes sense
        {
                if(leaderfrags != WinningConditionHelper_topscore)
index 3db53202275238ffeb7bb855891f17964365cc85..33fa9ee3f7019b9efe2e319b670df233cfbb7ef3 100644 (file)
@@ -583,4 +583,7 @@ MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
     /**/ o(string, ret_string) \
     /**/
 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
+
+/** Return error to play frag remaining announcements */
+MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
 #endif
index 9ad532e909e4dcfd2b56d3d187308db93a999b15..544b8766b770ce1d5901e5418c3fbd464f9aecdb 100644 (file)
@@ -353,6 +353,12 @@ MUTATOR_HOOKFUNCTION(ca_PlayerRegen)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(ca_CountFrags)
+{
+       // announce remaining frags
+       return true;
+}
+
 void ca_Initialize()
 {
        allowed_to_spawn = true;
@@ -394,6 +400,7 @@ MUTATOR_DEFINITION(gamemode_ca)
        MUTATOR_HOOK(FilterItem, ca_FilterItem, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, ca_PlayerDamage_SplitHealthArmor, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerRegen, ca_PlayerRegen, CBC_ORDER_ANY);
+       MUTATOR_HOOK(Scores_CountFragsRemaining, ca_CountFrags, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
diff --git a/qcsrc/server/mutators/gamemode_deathmatch.qc b/qcsrc/server/mutators/gamemode_deathmatch.qc
new file mode 100644 (file)
index 0000000..06afc51
--- /dev/null
@@ -0,0 +1,31 @@
+MUTATOR_HOOKFUNCTION(dm_CountFrags)
+{
+       // announce remaining frags
+       return true;
+}
+
+MUTATOR_DEFINITION(gamemode_deathmatch)
+{
+       MUTATOR_HOOK(Scores_CountFragsRemaining, dm_CountFrags, CBC_ORDER_ANY);
+
+       MUTATOR_ONADD
+       {
+               if(time > 1) // game loads at time 1
+                       error("This is a game type and it cannot be added at runtime.");
+       }
+
+       MUTATOR_ONROLLBACK_OR_REMOVE
+       {
+               // we actually cannot roll back dm_Initialize here
+               // BUT: we don't need to! If this gets called, adding always
+               // succeeds.
+       }
+
+       MUTATOR_ONREMOVE
+       {
+               print("This is a game type and it cannot be removed at runtime.");
+               return -1;
+       }
+
+       return 0;
+}
index fd3a9deb407fecfeefc7140f412428ff60ab0ceb..e1336c5c14b6a82cb71de8a984da403b59e41fba 100644 (file)
@@ -555,7 +555,7 @@ MUTATOR_HOOKFUNCTION(freezetag_BotRoles)
 MUTATOR_HOOKFUNCTION(freezetag_GetTeamCount)
 {
        ret_float = freezetag_teams;
-       return 0;
+       return false;
 }
 
 void freezetag_Initialize()
index 456d0df1f962f6fb4cb099faea1aea1b5741c827..2875f316e9b244d0a2d569f85141785711a0d592 100644 (file)
@@ -778,7 +778,6 @@ void W_Nexball_Attack2(void)
        if(!(balls & BALL_BASKET))
                return;
        W_SetupShot(self, false, 2, "nexball/shoot2.wav", CH_WEAPON_A, 0);
-//     Send_Effect("grenadelauncher_muzzleflash", w_shotorg, w_shotdir * 1000, 1);
        missile = spawn();
 
        missile.owner = self;
index 3cefc86692f6d6e8fbc9d6a094f424bdc5e4b01c..be65154757191ca04c354e98ed8d0f31f8709a3b 100644 (file)
@@ -273,6 +273,15 @@ MUTATOR_HOOKFUNCTION(race_GetTeamCount)
        return false;
 }
 
+MUTATOR_HOOKFUNCTION(race_CountFrags)
+{
+       // announce remaining frags if not in qualifying mode
+       if(!g_race_qualifying)
+               return true;
+
+       return false;
+}
+
 void race_Initialize()
 {
        race_ScoreRules();
@@ -294,6 +303,7 @@ MUTATOR_DEFINITION(gamemode_race)
        MUTATOR_HOOK(GetPressedKeys, race_PlayerPostThink, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidPlayerScore_Clear, race_ForbidClearPlayerScore, CBC_ORDER_ANY);
        MUTATOR_HOOK(GetTeamCount, race_GetTeamCount, CBC_ORDER_ANY);
+       MUTATOR_HOOK(Scores_CountFragsRemaining, race_CountFrags, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index afff8bdb2583dc8a187b0814c56e8d75ead365e7..d977ece6fd3bcdf51a2ac8ce42f588d7036751d8 100644 (file)
@@ -55,9 +55,16 @@ MUTATOR_HOOKFUNCTION(tdm_GetTeamCount)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(tdm_CountFrags)
+{
+       // announce remaining frags
+       return true;
+}
+
 MUTATOR_DEFINITION(gamemode_tdm)
 {
        MUTATOR_HOOK(GetTeamCount, tdm_GetTeamCount, CBC_ORDER_ANY);
+       MUTATOR_HOOK(Scores_CountFragsRemaining, tdm_CountFrags, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 6d889e24eba2afb38c71dc09ae2f89f5b11f9d6e..e1355a447b63087ab9f96716a865574900008ab5 100644 (file)
@@ -15,6 +15,7 @@ MUTATOR_DECLARATION(gamemode_invasion);
 MUTATOR_DECLARATION(gamemode_cts);
 MUTATOR_DECLARATION(gamemode_race);
 MUTATOR_DECLARATION(gamemode_tdm);
+MUTATOR_DECLARATION(gamemode_deathmatch);
 
 MUTATOR_DECLARATION(mutator_dodging);
 MUTATOR_DECLARATION(mutator_invincibleprojectiles);
index aaedcba8b37256305b67c702cc028c1b7a0c2a2e..d403cb12fc97817fcd45fd0b1349c0cfb39006c6 100644 (file)
@@ -89,6 +89,7 @@
 #include "gamemode_race.qc"
 #include "gamemode_cts.qc"
 #include "gamemode_tdm.qc"
+#include "gamemode_deathmatch.qc"
 
 #include "mutator_invincibleproj.qc"
 #include "mutator_new_toys.qc"
index f75df5e38a6a6fe3daa1e53c2a964402292f07eb..26bcb246d61790126b1c7cc6470f40b83a216456 100644 (file)
@@ -84,6 +84,7 @@ void InitGameplayMode()
 
        if(g_dm)
        {
+               MUTATOR_ADD(gamemode_deathmatch);
        }
 
        if(g_tdm)