]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / rocketminsta / sv_rocketminsta.qc
1 #include "sv_rocketminsta.qh"
2
3 #include <common/deathtypes/all.qh>
4 #include <server/round_handler.qh>
5
6 REGISTER_MUTATOR(rm, cvar("g_instagib"));
7
8 MUTATOR_HOOKFUNCTION(rm, Damage_Calculate)
9 {
10         // we do it this way, so rm can be toggled during the match
11         if (!autocvar_g_rm) { return; }
12
13         entity frag_attacker = M_ARGV(1, entity);
14         entity frag_target = M_ARGV(2, entity);
15         float frag_deathtype = M_ARGV(3, float);
16         float frag_damage = M_ARGV(4, float);
17
18         if (DEATH_ISWEAPON(frag_deathtype, WEP_DEVASTATOR)) {
19                 if (frag_attacker == frag_target || frag_target.classname == "nade") {
20                         frag_damage = 0;
21                 }
22         }
23
24         if (autocvar_g_rm_laser) {
25                 if (DEATH_ISWEAPON(frag_deathtype, WEP_ELECTRO)) {
26                         if (frag_attacker == frag_target || (round_handler_IsActive() && !round_handler_IsRoundStarted())) {
27                                 frag_damage = 0;
28                         }
29                 }
30         }
31
32         M_ARGV(4, float) = frag_damage;
33 }
34
35 MUTATOR_HOOKFUNCTION(rm, PlayerDies)
36 {
37         // we do it this way, so rm can be toggled during the match
38         if (!autocvar_g_rm) { return; }
39
40         float frag_deathtype = M_ARGV(3, float);
41
42         if (DEATH_ISWEAPON(frag_deathtype, WEP_DEVASTATOR) || DEATH_ISWEAPON(frag_deathtype, WEP_ELECTRO)) {
43                 M_ARGV(4, float) = 1000; // always gib if it was a vaporizer death
44         }
45 }