]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/electro.qc
Merge branch 'terencehill/lms_itemtimes_fix' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / electro.qc
index 44c5cf80d1f0ec9b9c582a865262ee48878baa05..3e93644fb87e31f5f104a0cc5bdb1b4d2a865c25 100644 (file)
@@ -86,7 +86,7 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own)
                        if(WEP_CVAR(electro, combo_comboradius_thruwall))
                        {
                                // if distance is greater than thruwall distance, check to make sure it's not through a wall
-                               if(vlen(e.WarpZone_findradius_dist) > WEP_CVAR(electro, combo_comboradius_thruwall))
+                               if(vdist(e.WarpZone_findradius_dist, >, WEP_CVAR(electro, combo_comboradius_thruwall)))
                                {
                                        WarpZone_TraceLine(org, e.origin, MOVE_NOMONSTERS, e);
                                        if(trace_fraction != 1)
@@ -149,7 +149,7 @@ void W_Electro_Explode()
        if(other.takedamage == DAMAGE_AIM)
                if(IS_PLAYER(other))
                        if(DIFF_TEAM(self.realowner, other))
-                               if(other.deadflag == DEAD_NO)
+                               if(!IS_DEAD(other))
                                        if(IsFlying(other))
                                                Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
 
@@ -306,34 +306,34 @@ void W_Electro_Orb_Touch()
        }
 }
 
-void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
        // note: combos are usually triggered by W_Electro_TriggerCombo, not damage
        float is_combo = (inflictor.classname == "electro_orb_chain" || inflictor.classname == "electro_bolt");
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_combo ? 1 : -1)))
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_combo ? 1 : -1)))
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
-       if(self.health <= 0)
+       this.health = this.health - damage;
+       if(this.health <= 0)
        {
-               self.takedamage = DAMAGE_NO;
-               self.nextthink = time;
+               this.takedamage = DAMAGE_NO;
+               this.nextthink = time;
                if(is_combo)
                {
                        // change owner to whoever caused the combo explosion
-                       self.realowner = inflictor.realowner;
-                       self.classname = "electro_orb_chain";
-                       self.think = W_Electro_ExplodeCombo;
-                       self.nextthink = time +
+                       this.realowner = inflictor.realowner;
+                       this.classname = "electro_orb_chain";
+                       this.think = W_Electro_ExplodeCombo;
+                       this.nextthink = time +
                                (
                                        // bound the length, inflictor may be in a galaxy far far away (warpzones)
                                        min(
                                                WEP_CVAR(electro, combo_radius),
-                                               vlen(self.origin - inflictor.origin)
+                                               vlen(this.origin - inflictor.origin)
                                        )
                                        /
                                        // delay combo chains, looks cooler
@@ -342,8 +342,8 @@ void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int d
                }
                else
                {
-                       self.use = W_Electro_Explode;
-                       self.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
+                       this.use = W_Electro_Explode;
+                       this.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
                }
        }
 }
@@ -428,7 +428,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
                METHOD(Electro, wr_aim, void(entity thiswep))
                {
                        self.BUTTON_ATCK = self.BUTTON_ATCK2 = false;
-                       if(vlen(self.origin-self.enemy.origin) > 1000) { self.bot_secondary_electromooth = 0; }
+                       if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
                        if(self.bot_secondary_electromooth == 0)
                        {
                                float shoot;
@@ -465,7 +465,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
 
                                if(!ammo_amount)
                                {
-                                       thiswep.wr_reload(thiswep);
+                                       thiswep.wr_reload(thiswep, actor, weaponentity);
                                        return;
                                }
                        }
@@ -515,7 +515,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
                {
                        self.electro_secondarytime = time;
                }
-               METHOD(Electro, wr_reload, void(entity thiswep))
+               METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
                }