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