]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_damage.qc
Merge branch 'master' into Mario/classname_checks
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_damage.qc
index 16a6a04afa6d22fa659a1eda9ff030fcd42a8787..c057619f6ed5b0c62c750e86d5db0b3a353de7cd 100644 (file)
@@ -587,7 +587,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
         damage_attacker = attacker;
                attacker_save = attacker;
 
-       if(targ.classname == "player")
+       if(IS_PLAYER(targ))
                if(targ.hook)
                        if(targ.hook.aiment)
                                if(targ.hook.aiment == attacker)
@@ -596,7 +596,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        // special rule: gravity bomb does not hit team mates (other than for disconnecting the hook)
        if(DEATH_ISWEAPON(deathtype, WEP_HOOK) || DEATH_ISWEAPON(deathtype, WEP_TUBA))
        {
-               if(targ.classname == "player")
+               if(IS_PLAYER(targ))
                        if not(IsDifferentTeam(targ, attacker))
                        {
                                self = oldself;
@@ -621,20 +621,11 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        }
        else
        {
-               /*
-               skill based bot damage? gtfo. (tZork)
-               if (targ.classname == "player")
-               if (attacker.classname == "player")
-               if (!targ.isbot)
-               if (attacker.isbot)
-                       damage = damage * bound(0.1, (skill + 5) * 0.1, 1);
-        */
-        
                // nullify damage if teamplay is on
                if(deathtype != DEATH_TELEFRAG)
-               if(attacker.classname == "player")
+               if(IS_PLAYER(attacker))
                {
-                       if(targ.classname == "player" && targ != attacker && (IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(targ)))
+                       if(IS_PLAYER(targ) && targ != attacker && (IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(targ)))
                        {
                                damage = 0;
                                force = '0 0 0';
@@ -649,7 +640,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                                damage = 0;
                                        else if(autocvar_teamplay_mode == 4)
                                        {
-                                               if(targ.classname == "player" && targ.deadflag == DEAD_NO)
+                                               if(IS_PLAYER(targ) && targ.deadflag == DEAD_NO)
                                                {
                                                        attacker.dmg_team = attacker.dmg_team + damage;
                                                        complainteamdamage = attacker.dmg_team - autocvar_g_teamdamage_threshold;
@@ -695,15 +686,15 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        }
                }
 
-               if(targ.classname == "player")
-               if(attacker.classname == "player")
+               if(IS_PLAYER(targ))
+               if(IS_PLAYER(attacker))
                if(attacker != targ)
                {
                        targ.lms_traveled_distance = autocvar_g_lms_campcheck_distance;
                        attacker.lms_traveled_distance = autocvar_g_lms_campcheck_distance;
                }
 
-               if(targ.classname == "player")
+               if(IS_PLAYER(targ))
                if (g_minstagib)
                {
                        if ((deathtype == DEATH_FALL)  ||
@@ -732,7 +723,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                complainteamdamage = 0;
                                if (targ != attacker)
                                {
-                                       if ((targ.health >= 1) && (targ.classname == "player"))
+                                       if ((targ.health >= 1) && (IS_PLAYER(targ)))
                                                centerprint(attacker, "Secondary fire inflicts no damage!");
                                        force = '0 0 0';
                                        // keep mirrorforce
@@ -799,7 +790,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        else
                                victim = targ;
 
-                       if(victim.classname == "player" || victim.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
+                       if(IS_PLAYER(victim) || victim.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
                        {
                                if(IsDifferentTeam(victim, attacker))
                                {
@@ -818,7 +809,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
 
                                                if not(DEATH_ISSPECIAL(deathtype))
                                                {
-                                                       if(targ.classname == "player") // don't do this for vehicles
+                                                       if(IS_PLAYER(targ)) // don't do this for vehicles
                                                        if(!g_minstagib)
                                                        if(IsFlying(victim))
                                                                yoda = 1;
@@ -850,7 +841,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        // apply push
        if (self.damageforcescale)
        if (vlen(force))
-       if (self.classname != "player" || time >= self.spawnshieldtime || g_midair)
+       if (!IS_PLAYER(self) || time >= self.spawnshieldtime || g_midair)
        {
                vector farce = damage_explosion_calcpush(self.damageforcescale * force, self.velocity, autocvar_g_balance_damagepush_speedfactor);
                if(self.movetype == MOVETYPE_PHYSICS)
@@ -1015,7 +1006,7 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e
                                                        if(autocvar_g_throughfloor_debug)
                                                                print(sprintf(" steps=%f", total));
 
-                                                       if (targ.classname == "player")
+                                                       if (IS_PLAYER(targ))
                                                                total = ceil(bound(autocvar_g_throughfloor_min_steps_player, total, autocvar_g_throughfloor_max_steps_player));
                                                        else
                                                                total = ceil(bound(autocvar_g_throughfloor_min_steps_other, total, autocvar_g_throughfloor_max_steps_other));
@@ -1151,7 +1142,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
        float dps;
        float maxtime, mintime, maxdamage, mindamage, maxdps, mindps, totaldamage, totaltime;
 
-       if(e.classname == "player")
+       if(IS_PLAYER(e))
        {
                if(e.deadflag)
                        return -1;
@@ -1275,7 +1266,7 @@ void Fire_ApplyDamage(entity e)
                return;
 
        for(t = 0, o = e.owner; o.owner && t < 16; o = o.owner, ++t);
-       if(clienttype(o) == CLIENTTYPE_NOTACLIENT)
+       if(IS_NOT_A_CLIENT(o))
                o = e.fire_owner;
 
        // water and slime stop fire
@@ -1303,7 +1294,7 @@ void Fire_ApplyDamage(entity e)
        if not(IS_INDEPENDENT_PLAYER(e))
        FOR_EACH_PLAYER(other) if(e != other)
        {
-               if(other.classname == "player")
+               if(IS_PLAYER(other))
                if(other.deadflag == DEAD_NO)
                if not(IS_INDEPENDENT_PLAYER(other))
                if(boxesoverlap(e.absmin, e.absmax, other.absmin, other.absmax))