]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/nades/nades.qc
Merge branch 'master' into terencehill/accuracy_shotgun
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nades / nades.qc
index d667c0cbf42a80a85b36498812bc2d048618914b..b0c8d314091f5afee4a3c81c4d4a127feca44416 100644 (file)
@@ -81,7 +81,7 @@ MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile)
 
        entity nade_type = Nade_FromProjectile(proj.cnt);
        if (nade_type == NADE_TYPE_Null) return;
-       if(STAT(NADES_SMALL, NULL))
+       if(STAT(NADES_SMALL))
        {
                proj.mins = '-8 -8 -8';
                proj.maxs = '8 8 8';
@@ -150,7 +150,7 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
 #include <common/monsters/sv_monsters.qh>
 #include <server/g_subs.qh>
 
-REGISTER_MUTATOR(nades, cvar("g_nades"));
+REGISTER_MUTATOR(nades, autocvar_g_nades);
 
 .float nade_time_primed;
 .float nade_lifetime;
@@ -370,11 +370,11 @@ void nade_napalm_boom(entity this)
        CSQCProjectile(fountain, true, PROJECTILE_NAPALM_FOUNTAIN, true);
 }
 
-void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time)
+void nade_ice_freeze(entity freezefield, entity frost_target, float freezetime)
 {
        frost_target.frozen_by = freezefield.realowner;
        Send_Effect(EFFECT_ELECTRO_IMPACT, frost_target.origin, '0 0 0', 1);
-       Freeze(frost_target, 1/freeze_time, 3, false);
+       Freeze(frost_target, 1 / freezetime, 3, false);
 
        Drop_Special_Items(frost_target);
 }
@@ -626,11 +626,12 @@ void nade_heal_touch(entity this, entity toucher)
                        float hp = GetResourceAmount(toucher, RESOURCE_HEALTH);
                        if (hp < maxhealth)
                        {
-                               if ( this.nade_show_particles )
+                               if (this.nade_show_particles)
+                               {
                                        Send_Effect(EFFECT_HEALING, toucher.origin, '0 0 0', 1);
-                               SetResourceAmount(toucher, RESOURCE_HEALTH, min(hp + health_factor, maxhealth));
+                               }
+                               GiveResourceWithLimit(toucher, RESOURCE_HEALTH, health_factor, maxhealth);
                        }
-                       toucher.pauserothealth_finished = max(toucher.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
                }
                else if ( health_factor < 0 )
                {
@@ -871,7 +872,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
 
        hp -= damage;
        SetResourceAmount(this, RESOURCE_HEALTH, hp);
-       
+
 
        if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
                this.realowner = attacker;
@@ -1272,30 +1273,27 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
                }
        }
 
-       float n = 0;
+       int n = 0;
        entity o = NULL;
        if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
                n = -1;
-       else
+       else if(STAT(FROZEN, player) == 3)
        {
                vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
                n = 0;
                FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
-                       if(!IS_DEAD(it))
-                       if(STAT(FROZEN, it) == 0)
-                       if(SAME_TEAM(it, player))
+                       if(!IS_DEAD(it) && STAT(FROZEN, it) == 0 && SAME_TEAM(it, player))
                        if(boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax))
                        {
                                if(!o)
                                        o = it;
-                               if(STAT(FROZEN, player) == 1)
-                                       it.reviving = true;
+                               it.reviving = true;
                                ++n;
                        }
                });
        }
 
-       if(n && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
+       if(n > 0 && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
        {
                player.revive_progress = bound(0, player.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
                SetResourceAmount(player, RESOURCE_HEALTH, max(1, player.revive_progress * start_health));