]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/nades/nades.qc
Spawn the monster at the location of the nade (don't drop to floor), fixes oddness...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nades / nades.qc
index d48319a421fa599861a11ba4aaabe1dabe71ac1b..9ac33b45bb328a612a395fb74f5a206fd62a7644 100644 (file)
@@ -1,6 +1,7 @@
 #include "nades.qh"
 
 #include "../overkill/okmachinegun.qh"
+#include "../overkill/okshotgun.qh"
 
 #ifdef SVQC
 bool autocvar_g_nades_nade_small;
@@ -670,7 +671,9 @@ void nade_heal_boom(entity this)
 
 void nade_monster_boom(entity this)
 {
-       entity e = spawnmonster(spawn(), this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1);
+       entity e = spawn();
+       e.noalign = true; // don't drop to floor
+       e = spawnmonster(e, this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1);
 
        if(autocvar_g_nades_pokenade_monster_lifetime > 0)
                e.monster_lifetime = time + autocvar_g_nades_pokenade_monster_lifetime;
@@ -892,7 +895,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        }
        else if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN) || DEATH_ISWEAPON(deathtype, WEP_OVERKILL_MACHINEGUN))
                damage = this.max_health * 0.1;
-       else if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO
+       else if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN) || DEATH_ISWEAPON(deathtype, WEP_OVERKILL_SHOTGUN)) // WEAPONTODO
        {
                if(!(deathtype & HITTYPE_SECONDARY))
                        damage = this.max_health * 1.15;
@@ -1189,7 +1192,6 @@ void nades_CheckThrow(entity this)
                this.nade_altbutton = true;
                if(time > this.nade_refire)
                {
-                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_NADE_THROW);
                        nade_prime(this);
                        this.nade_refire = time + autocvar_g_nades_nade_refire;
                }
@@ -1294,7 +1296,10 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
                held_nade.angles_y = player.angles.y;
 
                if (time + 0.1 >= held_nade.wait)
+               {
                        toss_nade(player, false, '0 0 0', time + 0.05);
+                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_THROW);
+               }
        }
 
        if(IS_PLAYER(player))
@@ -1345,44 +1350,47 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
                }
        }
 
-       int n = 0;
-
-       IntrusiveList reviving_players = NULL;
-
-       if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
-               n = -1;
-       else if (STAT(FROZEN, player) == FROZEN_TEMP_DYING)
+       if (frametime && IS_PLAYER(player))
        {
-               vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
-               n = 0;
-               FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), {
-                       if (!reviving_players)
-                               reviving_players = IL_NEW();
-                       IL_PUSH(reviving_players, it);
-                       ++n;
-               });
-       }
+               int n = 0;
 
-       if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us
-       {
-               STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
-               SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
+               IntrusiveList reviving_players = NULL;
 
-               if(STAT(REVIVE_PROGRESS, player) >= 1)
+               if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
+                       n = -1;
+               else if (STAT(FROZEN, player) == FROZEN_TEMP_DYING)
                {
-                       Unfreeze(player, false);
-
-                       entity first = IL_FIRST(reviving_players);
-                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname);
-                       Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
+                       vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
+                       n = 0;
+                       FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), {
+                               if (!reviving_players)
+                                       reviving_players = IL_NEW();
+                               IL_PUSH(reviving_players, it);
+                               ++n;
+                       });
                }
 
-               IL_EACH(reviving_players, true, {
-                       STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
-               });
+               if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us
+               {
+                       STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
+                       SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
+
+                       if(STAT(REVIVE_PROGRESS, player) >= 1)
+                       {
+                               Unfreeze(player, false);
+
+                               entity first = IL_FIRST(reviving_players);
+                               Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname);
+                               Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
+                       }
+
+                       IL_EACH(reviving_players, true, {
+                               STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
+                       });
+               }
+               if (reviving_players)
+                       IL_DELETE(reviving_players);
        }
-       if (reviving_players)
-               IL_DELETE(reviving_players);
 }
 
 MUTATOR_HOOKFUNCTION(nades, PlayerPhysics_UpdateStats)
@@ -1453,7 +1461,6 @@ MUTATOR_HOOKFUNCTION(nades, PlayerDies, CBC_ORDER_LAST)
        {
                float killcount_bonus = ((CS(frag_attacker).killcount >= 1) ? bound(0, autocvar_g_nades_bonus_score_minor * CS(frag_attacker).killcount, autocvar_g_nades_bonus_score_medium) 
                                                                                                                                        : autocvar_g_nades_bonus_score_minor);
-
                if (SAME_TEAM(frag_attacker, frag_target) || frag_attacker == frag_target)
                        nades_RemoveBonus(frag_attacker);
                else if(GameRules_scoring_is_vip(frag_target))