]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_damage.qc
Clean up filenames a bit
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_damage.qc
index 7ca31cecbb91adc8f24e61dc755bff041fc985ba..56cac627f5c7e7be76a72e57567f663fc005b7b3 100644 (file)
@@ -552,10 +552,7 @@ void Ice_Think()
 
 void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypoint)
 {
-       float monster = (targ.flags & FL_MONSTER);
-       float player = (targ.flags & FL_CLIENT);
-       
-       if(!player && !monster) // only specified entities can be freezed
+       if(!IS_PLAYER(targ) && !(targ.flags & FL_MONSTER)) // only specified entities can be freezed
                return;
                
        if(targ.frozen)
@@ -595,18 +592,19 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
 
 void Unfreeze (entity targ)
 {
-       if not(targ.frozen)
-               return; // not even frozen?
-               
+       if(targ.frozen) // only reset health if target was frozen
+               targ.health = ((IS_PLAYER(targ)) ? autocvar_g_balance_health_start : targ.max_health);
        targ.frozen = 0;
        targ.revive_progress = 0;
-       targ.health = ((targ.classname == STR_PLAYER) ? autocvar_g_balance_health_start : targ.max_health);
        
        WaypointSprite_Kill(targ.waypointsprite_attached);
 
        // remove the ice block
-       remove(targ.iceblock);
-       targ.iceblock = world;
+       if(targ.iceblock)
+       {
+               remove(targ.iceblock);
+               targ.iceblock = world;
+       }
 }
 
 // these are updated by each Damage call for use in button triggering and such
@@ -691,13 +689,10 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                                {
                                                        attacker.dmg_team = attacker.dmg_team + damage;
                                                        complainteamdamage = attacker.dmg_team - autocvar_g_teamdamage_threshold;
-                                                       if(complainteamdamage > 0 && !g_ca) // FIXME why is g_ca ruled out here? Why not just g_mirrordamage 0 on CA servers?
+                                                       if(complainteamdamage > 0)
                                                                mirrordamage = autocvar_g_mirrordamage * complainteamdamage;
                                                        mirrorforce = autocvar_g_mirrordamage * vlen(force);
-                                                       if(g_ca)
-                                                               damage = 0;
-                                                       else
-                                                               damage = autocvar_g_friendlyfire * damage;
+                                                       damage = autocvar_g_friendlyfire * damage;
                                                        // mirrordamage will be used LATER
 
                                                        if(autocvar_g_mirrordamage_virtual)
@@ -737,7 +732,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        mirrorforce *= g_weaponforcefactor;
                }
                
-               if(((targ.frozen == 2 && attacker.monsterid != MONSTER_SPIDER) || (targ.frozen == 1)) && deathtype != DEATH_HURTTRIGGER)
+               if(((targ.frozen == 2 && attacker.monsterid != MON_SPIDER) || (targ.frozen == 1)) && deathtype != DEATH_HURTTRIGGER)
                {
                        damage = 0;
                        force *= 0.2;
@@ -779,7 +774,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
 
                if (targ == attacker)
                {
-                       if(g_ca || (g_cts && !autocvar_g_cts_selfdamage))
+                       if(g_cts && !autocvar_g_cts_selfdamage)
                                damage = 0;
                        else
                                damage = damage * autocvar_g_balance_selfdamagepercent; // Partial damage if the attacker hits himself
@@ -843,7 +838,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        // apply push
        if (self.damageforcescale)
        if (vlen(force))
-       if (!IS_PLAYER(self) || time >= self.spawnshieldtime || g_midair)
+       if (!IS_PLAYER(self) || time >= self.spawnshieldtime)
        {
                vector farce = damage_explosion_calcpush(self.damageforcescale * force, self.velocity, autocvar_g_balance_damagepush_speedfactor);
                if(self.movetype == MOVETYPE_PHYSICS)