]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/minelayer.qc
Merge branch 'master' into Mario/showspecs
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / minelayer.qc
index 14a1c6491c9bfb99ee0fff6824f81ae0bb906c27..08b3634f41306cad37e10cf2cf67a0b3c2692c28 100644 (file)
@@ -108,19 +108,19 @@ void W_MineLayer_Stick(entity this, entity to)
                SetMovetypeFollow(newmine, to);
 }
 
-void W_MineLayer_Explode(entity this)
+void W_MineLayer_Explode(entity this, entity directhitentity)
 {
-       if(other.takedamage == DAMAGE_AIM)
-               if(IS_PLAYER(other))
-                       if(DIFF_TEAM(this.realowner, other))
-                               if(!IS_DEAD(other))
-                                       if(IsFlying(other))
+       if(directhitentity.takedamage == DAMAGE_AIM)
+               if(IS_PLAYER(directhitentity))
+                       if(DIFF_TEAM(this.realowner, directhitentity))
+                               if(!IS_DEAD(directhitentity))
+                                       if(IsFlying(directhitentity))
                                                Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
 
        this.event_damage = func_null;
        this.takedamage = DAMAGE_NO;
 
-       RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), world, world, WEP_CVAR(minelayer, force), this.projectiledeathtype, other);
+       RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), NULL, NULL, WEP_CVAR(minelayer, force), this.projectiledeathtype, directhitentity);
 
        if(PS(this.realowner).m_weapon == WEP_MINE_LAYER)
        {
@@ -138,6 +138,11 @@ void W_MineLayer_Explode(entity this)
        remove(this);
 }
 
+void W_MineLayer_Explode_think(entity this)
+{
+       W_MineLayer_Explode(this, NULL);
+}
+
 void W_MineLayer_DoRemoteExplode(entity this)
 {
        this.event_damage = func_null;
@@ -146,7 +151,7 @@ void W_MineLayer_DoRemoteExplode(entity this)
        if(this.movetype == MOVETYPE_NONE || this.movetype == MOVETYPE_FOLLOW)
                this.velocity = this.mine_orientation; // particle fx and decals need .velocity
 
-       RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), world, world, WEP_CVAR(minelayer, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, world);
+       RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), NULL, NULL, WEP_CVAR(minelayer, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, NULL);
 
        if(PS(this.realowner).m_weapon == WEP_MINE_LAYER)
        {
@@ -192,14 +197,14 @@ void W_MineLayer_ProximityExplode(entity this)
        }
 
        this.mine_time = 0;
-       W_MineLayer_Explode(this);
+       W_MineLayer_Explode(this, NULL);
 }
 
 int W_MineLayer_Count(entity e)
 {
        int minecount = 0;
        entity mine;
-       for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.realowner == e)
+       for(mine = NULL; (mine = find(mine, classname, "mine")); ) if(mine.realowner == e)
                minecount += 1;
 
        return minecount;
@@ -234,9 +239,8 @@ void W_MineLayer_Think(entity this)
        // TODO: Do this on team change too -- Samual: But isn't a player killed when they switch teams?
        if(!IS_PLAYER(this.realowner) || IS_DEAD(this.realowner) || STAT(FROZEN, this.realowner))
        {
-               other = world;
                this.projectiledeathtype |= HITTYPE_BOUNCE;
-               W_MineLayer_Explode(this);
+               W_MineLayer_Explode(this, NULL);
                return;
        }
 
@@ -268,26 +272,26 @@ void W_MineLayer_Think(entity this)
                W_MineLayer_RemoteExplode(this);
 }
 
-void W_MineLayer_Touch(entity this)
+void W_MineLayer_Touch(entity this, entity toucher)
 {
        if(this.movetype == MOVETYPE_NONE || this.movetype == MOVETYPE_FOLLOW)
                return; // we're already a stuck mine, why do we get called? TODO does this even happen?
 
-       if(WarpZone_Projectile_Touch(this))
+       if(WarpZone_Projectile_Touch(this, toucher))
        {
                if(wasfreed(this))
                        this.realowner.minelayer_mines -= 1;
                return;
        }
 
-       if(other && IS_PLAYER(other) && !IS_DEAD(other))
+       if(toucher && IS_PLAYER(toucher) && !IS_DEAD(toucher))
        {
                // hit a player
                // don't stick
        }
        else
        {
-               W_MineLayer_Stick(this, other);
+               W_MineLayer_Stick(this, toucher);
        }
 }
 
@@ -305,7 +309,7 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode);
+               W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode_think);
 }
 
 void W_MineLayer_Attack(Weapon thiswep, entity actor)
@@ -385,7 +389,7 @@ float W_MineLayer_PlacedMines(entity this, float detonate)
        entity mine;
        float minfound = 0;
 
-       for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.realowner == this)
+       for(mine = NULL; (mine = find(mine, classname, "mine")); ) if(mine.realowner == this)
        {
                if(detonate)
                {
@@ -422,7 +426,7 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor))
         teamdamage = 0;
         enemydamage = 0;
         targetlist = findchainfloat(bot_attack, true);
-        entity mine = find(world, classname, "mine");
+        entity mine = find(NULL, classname, "mine");
         while(mine)
         {
             if(mine.realowner != actor)
@@ -453,7 +457,7 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor))
         if(teamplay && actor.team)
             desirabledamage = desirabledamage - teamdamage;
 
-        mine = find(world, classname, "mine");
+        mine = find(NULL, classname, "mine");
         while(mine)
         {
             if(mine.realowner != actor)