]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/nades/nades.qc
s/world/NULL/
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nades / nades.qc
index 45c1560714c3f5540b833fb267e30f0940c062d7..c704d31ae2ef03872201b8655594375b8957f118 100644 (file)
@@ -338,15 +338,15 @@ void nade_napalm_boom(entity this)
 
 
        fountain = spawn();
-       fountain.owner = self.owner;
-       fountain.realowner = self.realowner;
-       fountain.origin = self.origin;
+       fountain.owner = this.owner;
+       fountain.realowner = this.realowner;
+       fountain.origin = this.origin;
        setorigin(fountain, fountain.origin);
        setthink(fountain, napalm_fountain_think);
        fountain.nextthink = time;
        fountain.ltime = time + autocvar_g_nades_napalm_fountain_lifetime;
        fountain.pushltime = fountain.ltime;
-       fountain.team = self.team;
+       fountain.team = this.team;
        fountain.movetype = MOVETYPE_TOSS;
        fountain.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
        fountain.bot_dodge = true;
@@ -367,33 +367,32 @@ void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time)
 
 void nade_ice_think(entity this)
 {
-
        if(round_handler_IsActive())
        if(!round_handler_IsRoundStarted())
        {
-               remove(self);
+               remove(this);
                return;
        }
 
-       if(time >= self.ltime)
+       if(time >= this.ltime)
        {
                if ( autocvar_g_nades_ice_explode )
                {
-                       entity expef = EFFECT_NADE_EXPLODE(self.realowner.team);
-                       Send_Effect(expef, self.origin + '0 0 1', '0 0 0', 1);
-                       sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-
-                       RadiusDamage(self, self.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
-                               autocvar_g_nades_nade_radius, self, world, autocvar_g_nades_nade_force, self.projectiledeathtype, self.enemy);
-                       Damage_DamageInfo(self.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
-                               autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, self.projectiledeathtype, 0, self);
+                       entity expef = EFFECT_NADE_EXPLODE(this.realowner.team);
+                       Send_Effect(expef, this.origin + '0 0 1', '0 0 0', 1);
+                       sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+
+                       RadiusDamage(this, this.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
+                               autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, this.enemy);
+                       Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
+                               autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this);
                }
-               remove(self);
+               remove(this);
                return;
        }
 
 
-       self.nextthink = time+0.1;
+       this.nextthink = time+0.1;
 
        // gaussian
        float randomr;
@@ -405,29 +404,29 @@ void nade_ice_think(entity this)
        randomp.x = randomr*cos(randomw);
        randomp.y = randomr*sin(randomw);
        randomp.z = 1;
-       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, self.origin + randomp, '0 0 0', 1);
+       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, this.origin + randomp, '0 0 0', 1);
 
-       if(time >= self.nade_special_time)
+       if(time >= this.nade_special_time)
        {
-               self.nade_special_time = time+0.7;
+               this.nade_special_time = time+0.7;
 
-               Send_Effect(EFFECT_ELECTRO_IMPACT, self.origin, '0 0 0', 1);
-               Send_Effect(EFFECT_ICEFIELD, self.origin, '0 0 0', 1);
+               Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1);
+               Send_Effect(EFFECT_ICEFIELD, this.origin, '0 0 0', 1);
        }
 
 
-       float current_freeze_time = self.ltime - time - 0.1;
+       float current_freeze_time = this.ltime - time - 0.1;
 
        entity e;
-       for(e = findradius(self.origin, autocvar_g_nades_nade_radius); e; e = e.chain)
-       if(e != self)
-       if(!autocvar_g_nades_ice_teamcheck || (DIFF_TEAM(e, self.realowner) || e == self.realowner))
+       for(e = findradius(this.origin, autocvar_g_nades_nade_radius); e; e = e.chain)
+       if(e != this)
+       if(!autocvar_g_nades_ice_teamcheck || (DIFF_TEAM(e, this.realowner) || e == this.realowner))
        if(e.takedamage && !IS_DEAD(e))
        if(e.health > 0)
        if(!e.revival_time || ((time - e.revival_time) >= 1.5))
        if(!STAT(FROZEN, e))
        if(current_freeze_time > 0)
-               nade_ice_freeze(self, e, current_freeze_time);
+               nade_ice_freeze(this, e, current_freeze_time);
 }
 
 void nade_ice_boom(entity this)
@@ -498,7 +497,7 @@ void nade_spawn_boom(entity this)
        if(this.realowner.nade_spawnloc)
        {
                remove(this.realowner.nade_spawnloc);
-               this.realowner.nade_spawnloc = world;
+               this.realowner.nade_spawnloc = NULL;
        }
 
        this.realowner.nade_spawnloc = spawnloc;
@@ -506,21 +505,21 @@ void nade_spawn_boom(entity this)
 
 void nade_heal_think(entity this)
 {
-       if(time >= self.ltime)
+       if(time >= this.ltime)
        {
-               remove(self);
+               remove(this);
                return;
        }
 
-       self.nextthink = time;
+       this.nextthink = time;
 
-       if(time >= self.nade_special_time)
+       if(time >= this.nade_special_time)
        {
-               self.nade_special_time = time+0.25;
-               self.nade_show_particles = 1;
+               this.nade_special_time = time+0.25;
+               this.nade_show_particles = 1;
        }
        else
-               self.nade_show_particles = 0;
+               this.nade_show_particles = 0;
 }
 
 void nade_heal_touch(entity this)
@@ -532,9 +531,9 @@ void nade_heal_touch(entity this)
        if(!STAT(FROZEN, other))
        {
                health_factor = autocvar_g_nades_heal_rate*frametime/2;
-               if ( other != self.realowner )
+               if ( other != this.realowner )
                {
-                       if ( SAME_TEAM(other,self) )
+                       if ( SAME_TEAM(other,this) )
                                health_factor *= autocvar_g_nades_heal_friend;
                        else
                                health_factor *= autocvar_g_nades_heal_foe;
@@ -544,7 +543,7 @@ void nade_heal_touch(entity this)
                        maxhealth = (IS_MONSTER(other)) ? other.max_health : g_pickup_healthmega_max;
                        if ( other.health < maxhealth )
                        {
-                               if ( self.nade_show_particles )
+                               if ( this.nade_show_particles )
                                        Send_Effect(EFFECT_HEALING, other.origin, '0 0 0', 1);
                                other.health = min(other.health+health_factor, maxhealth);
                        }
@@ -552,7 +551,7 @@ void nade_heal_touch(entity this)
                }
                else if ( health_factor < 0 )
                {
-                       Damage(other,self,self.realowner,-health_factor,DEATH_NADE_HEAL.m_id,other.origin,'0 0 0');
+                       Damage(other,this,this.realowner,-health_factor,DEATH_NADE_HEAL.m_id,other.origin,'0 0 0');
                }
 
        }
@@ -561,7 +560,7 @@ void nade_heal_touch(entity this)
        {
                entity show_red = (IS_VEHICLE(other)) ? other.owner : other;
                show_red.stat_healing_orb = time+0.1;
-               show_red.stat_healing_orb_alpha = 0.75 * (self.ltime - time) / self.healer_lifetime;
+               show_red.stat_healing_orb_alpha = 0.75 * (this.ltime - time) / this.healer_lifetime;
        }
 }
 
@@ -652,7 +651,7 @@ void nade_boom(entity this)
        if(nade_blast)
        {
                RadiusDamage(this, this.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
-                                autocvar_g_nades_nade_radius, this, world, autocvar_g_nades_nade_force, this.projectiledeathtype, this.enemy);
+                                autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, this.enemy);
                Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this);
        }
 
@@ -693,21 +692,21 @@ bool CanThrowNade(entity this);
 void nade_touch(entity this)
 {
        if(other)
-               UpdateCSQCProjectile(self);
+               UpdateCSQCProjectile(this);
 
-       if(other == self.realowner)
-               return; // no self impacts
+       if(other == this.realowner)
+               return; // no this impacts
 
        if(autocvar_g_nades_pickup)
-       if(time >= self.spawnshieldtime)
-       if(!other.nade && self.health == self.max_health) // no boosted shot pickups, thank you very much
+       if(time >= this.spawnshieldtime)
+       if(!other.nade && this.health == this.max_health) // no boosted shot pickups, thank you very much
        if(!other.frozen)
        if(CanThrowNade(other)) // prevent some obvious things, like dead players
        if(IS_REAL_CLIENT(other)) // above checks for IS_PLAYER, don't need to do it here
        {
-               nade_pickup(other, self);
-               sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
-               remove(self);
+               nade_pickup(other, this);
+               sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
+               remove(this);
                return;
        }
        /*float is_weapclip = 0;
@@ -717,27 +716,27 @@ void nade_touch(entity this)
                is_weapclip = 1;*/
        if(ITEM_TOUCH_NEEDKILL()) // || is_weapclip)
        {
-               FOREACH_ENTITY_ENT(aiment, self,
+               FOREACH_ENTITY_ENT(aiment, this,
                {
                        if(it.classname == "grapplinghook")
                                RemoveGrapplingHook(it.realowner);
                });
-               remove(self);
+               remove(this);
                return;
        }
 
        PROJECTILE_TOUCH(this);
 
-       //setsize(self, '-2 -2 -2', '2 2 2');
-       //UpdateCSQCProjectile(self);
-       if(self.health == self.max_health)
+       //setsize(this, '-2 -2 -2', '2 2 2');
+       //UpdateCSQCProjectile(this);
+       if(this.health == this.max_health)
        {
-               spamsound(self, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTEN_NORM);
+               spamsound(this, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTEN_NORM);
                return;
        }
 
-       self.enemy = other;
-       nade_boom(self);
+       this.enemy = other;
+       nade_boom(this);
 }
 
 void nade_beep(entity this)
@@ -752,14 +751,14 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
        {
                this.takedamage = DAMAGE_NO;
-               WITHSELF(this, nade_boom(this));
+               nade_boom(this);
                return;
        }
 
        if(this.nade_type == NADE_TYPE_TRANSLOCATE.m_id || this.nade_type == NADE_TYPE_SPAWN.m_id)
                return;
 
-       if (MUTATOR_CALLHOOK(Nade_Damage, DEATH_WEAPONOF(deathtype), force, damage)) {}
+       if (MUTATOR_CALLHOOK(Nade_Damage, this, DEATH_WEAPONOF(deathtype), force, damage)) {}
        else if(DEATH_ISWEAPON(deathtype, WEP_BLASTER))
        {
                force *= 1.5;
@@ -814,14 +813,14 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
 
 void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
 {
-       if(e.nade == world)
+       if(e.nade == NULL)
                return;
 
        entity _nade = e.nade;
-       e.nade = world;
+       e.nade = NULL;
 
        remove(e.fake_nade);
-       e.fake_nade = world;
+       e.fake_nade = NULL;
 
        makevectors(e.v_angle);
 
@@ -837,7 +836,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
 
        setorigin(_nade, w_shotorg + offset + (v_right * 25) * -1);
        //setmodel(_nade, MDL_PROJECTILE_NADE);
-       //setattachment(_nade, world, "");
+       //setattachment(_nade, NULL, "");
        PROJECTILE_MAKETRIGGER(_nade);
        if(STAT(NADES_SMALL, e))
                setsize(_nade, '-8 -8 -8', '8 8 8');
@@ -868,7 +867,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
        _nade.takedamage = DAMAGE_AIM;
        _nade.event_damage = nade_damage;
        setcefc(_nade, func_null);
-       _nade.exteriormodeltoclient = world;
+       _nade.exteriormodeltoclient = NULL;
        _nade.traileffectnum = 0;
        _nade.teleportable = true;
        _nade.pushable = true;
@@ -936,20 +935,20 @@ MUTATOR_HOOKFUNCTION(nades, PutClientInServer)
 float nade_customize(entity this)
 {
        //if(IS_SPEC(other)) { return false; }
-       if(other == self.exteriormodeltoclient || (IS_SPEC(other) && other.enemy == self.exteriormodeltoclient))
+       if(other == this.exteriormodeltoclient || (IS_SPEC(other) && other.enemy == this.exteriormodeltoclient))
        {
                // somewhat hide the model, but keep the glow
-               //self.effects = 0;
-               if(self.traileffectnum)
-                       self.traileffectnum = 0;
-               self.alpha = -1;
+               //this.effects = 0;
+               if(this.traileffectnum)
+                       this.traileffectnum = 0;
+               this.alpha = -1;
        }
        else
        {
-               //self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
-               if(!self.traileffectnum)
-                       self.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(self.nade_type).m_projectile[false], self.team).eent_eff_name);
-               self.alpha = 1;
+               //this.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
+               if(!this.traileffectnum)
+                       this.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(this.nade_type).m_projectile[false], this.team).eent_eff_name);
+               this.alpha = 1;
        }
 
        return true;
@@ -959,9 +958,12 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
 {
        entity n = new(nade), fn = new(fake_nade);
 
-       n.nade_type = bound(1, ntype, Nades_COUNT);
+       n.nade_type = max(1, ntype);
        n.pokenade_type = pntype;
 
+       if(Nades_from(n.nade_type) == NADE_TYPE_Null)
+               n.nade_type = NADE_TYPE_NORMAL.m_id;
+
        setmodel(n, MDL_PROJECTILE_NADE);
        //setattachment(n, player, "bip01 l hand");
        n.exteriormodeltoclient = player;
@@ -991,36 +993,36 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        player.fake_nade = fn;
 }
 
-void nade_prime()
-{SELFPARAM();
+void nade_prime(entity this)
+{
        if(autocvar_g_nades_bonus_only)
-       if(!self.bonus_nades)
+       if(!this.bonus_nades)
                return; // only allow bonus nades
 
-       if(self.nade)
-               remove(self.nade);
+       if(this.nade)
+               remove(this.nade);
 
-       if(self.fake_nade)
-               remove(self.fake_nade);
+       if(this.fake_nade)
+               remove(this.fake_nade);
 
        int ntype;
-       string pntype = self.pokenade_type;
+       string pntype = this.pokenade_type;
 
-       if(self.items & ITEM_Strength.m_itemid && autocvar_g_nades_bonus_onstrength)
-               ntype = self.nade_type;
-       else if (self.bonus_nades >= 1)
+       if(this.items & ITEM_Strength.m_itemid && autocvar_g_nades_bonus_onstrength)
+               ntype = this.nade_type;
+       else if (this.bonus_nades >= 1)
        {
-               ntype = self.nade_type;
-               pntype = self.pokenade_type;
-               self.bonus_nades -= 1;
+               ntype = this.nade_type;
+               pntype = this.pokenade_type;
+               this.bonus_nades -= 1;
        }
        else
        {
-               ntype = ((autocvar_g_nades_client_select) ? self.cvar_cl_nade_type : autocvar_g_nades_nade_type);
-               pntype = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
+               ntype = ((autocvar_g_nades_client_select) ? this.cvar_cl_nade_type : autocvar_g_nades_nade_type);
+               pntype = ((autocvar_g_nades_client_select) ? this.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
        }
 
-       spawn_held_nade(self, self, autocvar_g_nades_nade_lifetime, ntype, pntype);
+       spawn_held_nade(this, this, autocvar_g_nades_nade_lifetime, ntype, pntype);
 }
 
 bool CanThrowNade(entity this)
@@ -1048,33 +1050,33 @@ bool CanThrowNade(entity this)
 
 .bool nade_altbutton;
 
-void nades_CheckThrow()
-{SELFPARAM();
-       if(!CanThrowNade(self))
+void nades_CheckThrow(entity this)
+{
+       if(!CanThrowNade(this))
                return;
 
-       entity held_nade = self.nade;
+       entity held_nade = this.nade;
        if (!held_nade)
        {
-               self.nade_altbutton = true;
-               if(time > self.nade_refire)
+               this.nade_altbutton = true;
+               if(time > this.nade_refire)
                {
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_NADE_THROW);
-                       nade_prime();
-                       self.nade_refire = time + autocvar_g_nades_nade_refire;
+                       Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_NADE_THROW);
+                       nade_prime(this);
+                       this.nade_refire = time + autocvar_g_nades_nade_refire;
                }
        }
        else
        {
-               self.nade_altbutton = false;
+               this.nade_altbutton = false;
                if (time >= held_nade.nade_time_primed + 1) {
-                       makevectors(self.v_angle);
+                       makevectors(this.v_angle);
                        float _force = time - held_nade.nade_time_primed;
                        _force /= autocvar_g_nades_nade_lifetime;
                        _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
                        vector dir = (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05);
                        dir = W_CalculateSpread(dir, autocvar_g_nades_spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
-                       toss_nade(self, true, dir * _force, 0);
+                       toss_nade(this, true, dir * _force, 0);
                }
        }
 }
@@ -1086,7 +1088,7 @@ void nades_Clear(entity player)
        if(player.fake_nade)
                remove(player.fake_nade);
 
-       player.nade = player.fake_nade = world;
+       player.nade = player.fake_nade = NULL;
        player.nade_timer = 0;
 }
 
@@ -1119,7 +1121,7 @@ CLASS(NadeOffhand, OffhandWeapon)
         if (!(time > player.nade_refire)) return;
                if (key_pressed) {
                        if (!held_nade) {
-                               nade_prime();
+                               nade_prime(player);
                                held_nade = player.nade;
                        }
                } else if (time >= held_nade.nade_time_primed + 1) {
@@ -1142,28 +1144,29 @@ MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST)
     entity player = M_ARGV(0, entity);
 
        if (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
-               WITHSELF(player, nades_CheckThrow());
+               nades_CheckThrow(player);
                return true;
        }
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
-{SELFPARAM();
-       if (!IS_PLAYER(self)) { return false; }
+{
+       entity player = M_ARGV(0, entity);
+
+       if (!IS_PLAYER(player)) { return; }
 
-       if (self.nade && (self.offhand != OFFHAND_NADE || (self.weapons & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, self, self.nade_altbutton);
+       if (player.nade && (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton);
 
-       if(IS_PLAYER(self))
+       if(IS_PLAYER(player))
        {
                if ( autocvar_g_nades_bonus && autocvar_g_nades )
                {
                        entity key;
                        float key_count = 0;
-                       FOR_EACH_KH_KEY(key) if(key.owner == self) { ++key_count; }
+                       FOR_EACH_KH_KEY(key) if(key.owner == player) { ++key_count; }
 
                        float time_score;
-                       if(self.flagcarried || self.ballcarried) // this player is important
+                       if(player.flagcarried || player.ballcarried) // this player is important
                                time_score = autocvar_g_nades_bonus_score_time_flagcarrier;
                        else
                                time_score = autocvar_g_nades_bonus_score_time;
@@ -1173,69 +1176,67 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
 
                        if(autocvar_g_nades_bonus_client_select)
                        {
-                               self.nade_type = self.cvar_cl_nade_type;
-                               self.pokenade_type = self.cvar_cl_pokenade_type;
+                               player.nade_type = player.cvar_cl_nade_type;
+                               player.pokenade_type = player.cvar_cl_pokenade_type;
                        }
                        else
                        {
-                               self.nade_type = autocvar_g_nades_bonus_type;
-                               self.pokenade_type = autocvar_g_nades_pokenade_monster_type;
+                               player.nade_type = autocvar_g_nades_bonus_type;
+                               player.pokenade_type = autocvar_g_nades_pokenade_monster_type;
                        }
 
-                       self.nade_type = bound(1, self.nade_type, Nades_COUNT);
+                       player.nade_type = bound(1, player.nade_type, Nades_COUNT);
 
-                       if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
-                               nades_GiveBonus(self, time_score / autocvar_g_nades_bonus_score_max);
+                       if(player.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
+                               nades_GiveBonus(player, time_score / autocvar_g_nades_bonus_score_max);
                }
                else
                {
-                       self.bonus_nades = self.bonus_nade_score = 0;
+                       player.bonus_nades = player.bonus_nade_score = 0;
                }
        }
 
        float n = 0;
-       entity o = world;
-       if(self.freezetag_frozen_timeout > 0 && time >= self.freezetag_frozen_timeout)
+       entity o = NULL;
+       if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
                n = -1;
        else
        {
                vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
                n = 0;
-               FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
                        if(!IS_DEAD(it))
                        if(STAT(FROZEN, it) == 0)
-                       if(SAME_TEAM(it, self))
-                       if(boxesoverlap(self.absmin - revive_extra_size, self.absmax + revive_extra_size, it.absmin, it.absmax))
+                       if(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, self) == 1)
+                               if(STAT(FROZEN, player) == 1)
                                        it.reviving = true;
                                ++n;
                        }
                ));
        }
 
-       if(n && STAT(FROZEN, self) == 3) // OK, there is at least one teammate reviving us
+       if(n && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
        {
-               self.revive_progress = bound(0, self.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
-               self.health = max(1, self.revive_progress * start_health);
+               player.revive_progress = bound(0, player.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
+               player.health = max(1, player.revive_progress * start_health);
 
-               if(self.revive_progress >= 1)
+               if(player.revive_progress >= 1)
                {
-                       Unfreeze(self);
+                       Unfreeze(player);
 
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
-                       Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, self.netname);
+                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
+                       Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
                }
 
                FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
-                       other.revive_progress = self.revive_progress;
-                       other.reviving = false;
+                       it.revive_progress = player.revive_progress;
+                       it.reviving = false;
                ));
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
@@ -1262,11 +1263,9 @@ MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
                if(player.nade_spawnloc.cnt <= 0)
                {
                        remove(player.nade_spawnloc);
-                       player.nade_spawnloc = world;
+                       player.nade_spawnloc = NULL;
                }
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades, PlayerDies, CBC_ORDER_LAST)
@@ -1322,11 +1321,9 @@ MUTATOR_HOOKFUNCTION(nades, PlayerDamage_Calculate)
                Send_Effect(EFFECT_ICEORGLASS, frag_target.origin, '0 0 0', 3);
                M_ARGV(4, float) = 0;
                M_ARGV(6, vector) = '0 0 0';
-               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED_NADE, frag_target.netname);
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED_NADE, frag_target.netname);
                Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF);
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades, MonsterDies)
@@ -1338,8 +1335,6 @@ MUTATOR_HOOKFUNCTION(nades, MonsterDies)
        if(DIFF_TEAM(frag_attacker, frag_target))
        if(!(frag_target.spawnflags & MONSTERFLAG_SPAWNED))
                nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor);
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades, DropSpecialItems)
@@ -1348,8 +1343,6 @@ MUTATOR_HOOKFUNCTION(nades, DropSpecialItems)
        
        if(frag_target.nade)
                toss_nade(frag_target, true, '0 0 0', time + 0.05);
-
-       return false;
 }
 
 void nades_RemovePlayer(entity this)