]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/touchexplode/touchexplode.qc
Fix panel show flags checks
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / touchexplode / touchexplode.qc
index ec439489d0de383c50681330fc4225a56c62c600..c585e7e9061872460920bc0ea3f6fc660c8ff374 100644 (file)
@@ -9,40 +9,39 @@ REGISTER_MUTATOR(touchexplode, cvar("g_touchexplode"));
 .float touchexplode_time;
 
 void PlayerTouchExplode(entity p1, entity p2)
-{SELFPARAM();
+{
        vector org = (p1.origin + p2.origin) * 0.5;
        org.z += (p1.mins.z + p2.mins.z) * 0.5;
 
-       sound(self, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
+       sound(p1, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
        Send_Effect(EFFECT_EXPLOSION_SMALL, org, '0 0 0', 1);
 
        entity e = spawn();
        setorigin(e, org);
-       RadiusDamage(e, world, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_radius, world, world, autocvar_g_touchexplode_force, DEATH_TOUCHEXPLODE.m_id, world);
-       remove(e);
+       RadiusDamage(e, NULL, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_radius, NULL, NULL, autocvar_g_touchexplode_force, DEATH_TOUCHEXPLODE.m_id, NULL);
+       delete(e);
 }
 
 MUTATOR_HOOKFUNCTION(touchexplode, PlayerPreThink)
-{SELFPARAM();
-       if(time > self.touchexplode_time)
-       if(!gameover)
-       if(!self.frozen)
-       if(IS_PLAYER(self))
-       if(self.deadflag == DEAD_NO)
-       if (!IS_INDEPENDENT_PLAYER(self))
-       FOR_EACH_PLAYER(other) if(self != other)
-       {
-               if(time > other.touchexplode_time)
-               if(!other.frozen)
-               if(other.deadflag == DEAD_NO)
-               if (!IS_INDEPENDENT_PLAYER(other))
-               if(boxesoverlap(self.absmin, self.absmax, other.absmin, other.absmax))
-               {
-                       PlayerTouchExplode(self, other);
-                       self.touchexplode_time = other.touchexplode_time = time + 0.2;
-               }
-       }
+{
+       entity player = M_ARGV(0, entity);
 
-       return false;
+       if(time > player.touchexplode_time)
+       if(!gameover)
+       if(!STAT(FROZEN, player))
+       if(IS_PLAYER(player))
+       if(!IS_DEAD(player))
+       if(!IS_INDEPENDENT_PLAYER(player))
+               FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+                       if(time > it.touchexplode_time)
+                       if(!STAT(FROZEN, it))
+                       if(!IS_DEAD(it))
+                       if (!IS_INDEPENDENT_PLAYER(it))
+                       if(boxesoverlap(player.absmin, player.absmax, it.absmin, it.absmax))
+                       {
+                               PlayerTouchExplode(player, it);
+                               player.touchexplode_time = it.touchexplode_time = time + 0.2;
+                       }
+               ));
 }
 #endif