]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc
Merge branch 'drjaska/mayhem' into z411/bai-server
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / duel / sv_duel.qc
1 #include "sv_duel.qh"
2
3 MUTATOR_HOOKFUNCTION(duel, GetPlayerLimit)
4 {
5         M_ARGV(0, int) = 2; // duel is always 1v1!
6 }
7
8 MUTATOR_HOOKFUNCTION(duel, Scores_CountFragsRemaining)
9 {
10         // announce remaining frags?
11         return true;
12 }
13
14 MUTATOR_HOOKFUNCTION(duel, Scores_AnnounceLeads)
15 {
16         // enable leads announcer
17         return true;
18 }
19
20 MUTATOR_HOOKFUNCTION(duel, FilterItemDefinition)
21 {
22         entity definition = M_ARGV(0, entity);
23
24         if(definition.instanceOfPowerup)
25         {
26                 return !autocvar_g_duel_with_powerups;
27         }
28 }
29
30 MUTATOR_HOOKFUNCTION(duel, FragCenterMessage)
31 {
32         // Use normal notifications in warmup
33         if(warmup_stage) return false;
34         
35         entity attacker = M_ARGV(0, entity);
36         entity targ = M_ARGV(1, entity);
37         string tie_str;
38         int kill_count_to_attacker = M_ARGV(3, int);
39         int kill_count_to_target = M_ARGV(4, int);
40         
41         WinningConditionHelper(NULL);
42         
43         if(WinningConditionHelper_equality)
44                 tie_str = "^3Tied";
45         else if(attacker == WinningConditionHelper_winner)
46                 tie_str = "^2Leads";
47         else
48                 tie_str = "^1Trails";
49         
50         Send_Notification(
51                 NOTIF_ONE,
52                 attacker,
53                 MSG_CENTER,
54                 CENTER_DEATH_MURDER_DUEL,
55                 targ.netname,
56                 tie_str,
57                 kill_count_to_attacker,
58                 GameRules_scoring_add(attacker, SCORE, 0)
59         );
60         Send_Notification(
61                 NOTIF_ONE,
62                 targ,
63                 MSG_CHOICE,
64                 CHOICE_FRAGGED,
65                 attacker.netname,
66                 kill_count_to_target,
67                 GetResource(attacker, RES_HEALTH),
68                 GetResource(attacker, RES_ARMOR),
69                 (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping)
70         );
71         
72         return true;
73 }