]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_common.qc
Manual riddance of remaining "if not".
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_common.qc
index 9bae1b7ba720b3c476ead7f9980627fba21bfea6..dd89ec2f889cdf5e3d688f340d649e31a47d7107 100644 (file)
@@ -1,22 +1,18 @@
 
-void W_GiveWeapon (entity e, float wep, string name)
+void W_GiveWeapon (entity e, float wep)
 {
        entity oldself;
 
        if (!wep)
                return;
 
-       WEPSET_OR_EW(e, wep);
+       e.weapons |= WepSet_FromWeapon(wep);
 
        oldself = self;
        self = e;
 
-       if (other.classname == "player")
-       {
-               sprint (other, "You got the ^2");
-               sprint (other, name);
-               sprint (other, "\n");
-       }
+       if(IS_PLAYER(other))
+               { Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_WEAPON_GOT, wep); }
 
        self = oldself;
 }
@@ -108,7 +104,10 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        // Find all non-hit players the beam passed close by
        if(deathtype == WEP_MINSTANEX || deathtype == WEP_NEX)
        {
-               FOR_EACH_REALCLIENT(msg_entity) if(msg_entity != self) if(!msg_entity.railgunhit) if not(msg_entity.classname == "spectator" && msg_entity.enemy == self) // we use realclient, so spectators can hear the whoosh too
+               FOR_EACH_REALCLIENT(msg_entity)
+               if(msg_entity != self)
+               if(!msg_entity.railgunhit)
+               if(!(IS_SPEC(msg_entity) && msg_entity.enemy == self)) // we use realclient, so spectators can hear the whoosh too
                {
                        // nearest point on the beam
                        beampos = start + dir * bound(0, (msg_entity.origin - start) * dir, length);
@@ -121,7 +120,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
 
                        if(!pseudoprojectile)
                                pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
-                       soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, snd, VOL_BASE * f, ATTN_NONE);
+                       soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, snd, VOL_BASE * f, ATTEN_NONE);
                }
 
                if(pseudoprojectile)
@@ -166,10 +165,10 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        trace_dphitq3surfaceflags = endq3surfaceflags;
 }
 
-.float dmg_edge;
 .float dmg_force;
 .float dmg_radius;
 .float dmg_total;
+//.float last_yoda;
 void W_BallisticBullet_Hit (void)
 {
        float f, q, g;
@@ -184,24 +183,17 @@ void W_BallisticBullet_Hit (void)
        {
                endzcurveparticles();
 
-               headshot = 0;
                yoda = 0;
-               damage_headshotbonus = self.dmg_edge * f;
                railgun_start = self.origin - 2 * frametime * self.velocity;
                railgun_end = self.origin + 2 * frametime * self.velocity;
                g = accuracy_isgooddamage(self.realowner, other);
                Damage(other, self, self.realowner, self.dmg * f, self.projectiledeathtype, self.origin, self.dmg_force * normalize(self.velocity) * f);
-               damage_headshotbonus = 0;
 
-               if(headshot)
-                       f *= q;
-               if(self.dmg_edge > 0)
+               /*if(yoda && (time > (self.last_yoda + 5)))
                {
-                       if(headshot)
-                               AnnounceTo(self.realowner, "headshot");
-                       if(yoda)
-                               AnnounceTo(self.realowner, "awesome");
-               }
+                       Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
+                       self.last_yoda = time; 
+               }*/
 
                // calculate hits for ballistic weapons
                if(g)
@@ -230,7 +222,7 @@ void W_BallisticBullet_LeaveSolid_think()
        self.nextthink = max(time, self.W_BallisticBullet_LeaveSolid_nextthink_save);
        self.W_BallisticBullet_LeaveSolid_think_save = func_null;
 
-       self.flags &~= FL_ONGROUND;
+       self.flags &= ~FL_ONGROUND;
 
        if(self.enemy.solid == SOLID_BSP)
        {
@@ -365,8 +357,8 @@ void W_BallisticBullet_Touch (void)
        //   common/weapclip (intended)
        //   common/noimpact (is supposed to eat projectiles, but is erased farther above)
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
-       if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)
-       if not(trace_dphitcontents & DPCONTENTS_OPAQUE)
+       if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
+       if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
        {
                remove(self);
                return;
@@ -397,7 +389,7 @@ void fireBallisticBullet_trace_callback(vector start, vector hit, vector end)
        self.owner = world;
 }
 
-void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float headshotbonus, float force, float dtype, float tracereffects, float gravityfactor, float bulletconstant)
+void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float gravityfactor, float bulletconstant)
 {
        float lag, dt, savetime; //, density;
        entity pl, oldself;
@@ -433,7 +425,6 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
 
        proj.touch = W_BallisticBullet_Touch;
        proj.dmg = damage;
-       proj.dmg_edge = headshotbonus;
        proj.dmg_force = force;
        proj.projectiledeathtype = dtype;
 
@@ -456,7 +447,7 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
                lag = ANTILAG_LATENCY(self);
                if(lag < 0.001)
                        lag = 0;
-               if(clienttype(self) != CLIENTTYPE_REAL)
+               if (!IS_REAL_CLIENT(self))
                        lag = 0;
                if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
                        lag = 0; // only do hitscan, but no antilag
@@ -526,8 +517,8 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
                        //   common/weapclip (intended)
                        //   common/noimpact (is supposed to eat projectiles, but is erased farther above)
                        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
-                       if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)
-                       if not(trace_dphitcontents & DPCONTENTS_OPAQUE)
+                       if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
+                       if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
                                break;
 
                        // go through solid!
@@ -574,7 +565,7 @@ void fireBullet (vector start, vector dir, float spread, float damage, float for
 
        if (pointcontents (trace_endpos) != CONTENT_SKY)
        {
-               if not (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
+               if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
                        Damage_DamageInfo(trace_endpos, damage, 0, 0, dir * max(1, force), dtype, trace_ent.species, self);                    
 
                Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * force);
@@ -605,14 +596,14 @@ float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtyp
        {
                if(is_from_exception)
                        return (exception); // if exception is detected, allow it to override
-               else if not(is_from_contents)
+               else if (!is_from_contents)
                        return FALSE; // otherwise, only allow damage from contents
        }       
        else if(autocvar_g_projectiles_damage == 1)
        {
                if(is_from_exception)
                        return (exception); // if exception is detected, allow it to override
-               else if not(is_from_contents || is_from_owner)
+               else if (!(is_from_contents || is_from_owner))
                        return FALSE; // otherwise, only allow self damage and damage from contents
        }
        else if(autocvar_g_projectiles_damage == 2) // allow any damage, but override for exceptions
@@ -629,7 +620,7 @@ void W_PrepareExplosionByDamage(entity attacker, void() explode)
        self.takedamage = DAMAGE_NO;
        self.event_damage = func_null;
        
-       if((attacker.flags & FL_CLIENT) && !autocvar_g_projectiles_keep_owner)
+       if(IS_CLIENT(attacker) && !autocvar_g_projectiles_keep_owner)
        {
                self.owner = attacker;
                self.realowner = attacker;