]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc
Add Mayhem score option functionalities for DM, TDM and Duel
[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, FilterItemDefinition)
15 {
16         entity definition = M_ARGV(0, entity);
17
18         if(definition.instanceOfPowerup)
19         {
20                 return !autocvar_g_duel_with_powerups;
21         }
22 }
23
24 MUTATOR_HOOKFUNCTION(duel, ReadLevelCvars)
25 {
26         Mayhem_FragLimit_Override();
27 }
28
29 MUTATOR_HOOKFUNCTION(duel, PlayerDamage_SplitHealthArmor)
30 {
31         entity frag_attacker = M_ARGV(1, entity);
32         entity frag_target = M_ARGV(2, entity);
33         //float dmg_taken = M_ARGV(4, float);
34         //float dmg_saved = M_ARGV(5, float);
35         float frag_deathtype = M_ARGV(6, float);
36         float frag_damage = M_ARGV(7, float);
37
38         Mayhem_Scoring_Method( 
39                 frag_attacker, 
40                 frag_target, 
41                 M_ARGV(4, float), 
42                 M_ARGV(5, float), 
43                 frag_deathtype, 
44                 frag_damage
45         );
46 }
47
48 MUTATOR_HOOKFUNCTION(duel, GiveFragsForKill, CBC_ORDER_FIRST)
49 {
50         if (autocvar_g_mayhem)
51         {
52                 entity frag_attacker = M_ARGV(0, entity);
53                 M_ARGV(2, float) = 0; //score to give for the frag directly
54
55                 if (IS_PLAYER(frag_attacker)) FFAMayhemCalculatePlayerScore(frag_attacker);
56
57                 return true;
58         }
59 }