]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator_touchexplode.qc
Mutators: port to new syntax
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_touchexplode.qc
index e0dd4cd67e8dc434036ca04cf51b579aa53a59bf..ba90bedbbd81fc7251ccd3fd7f67b6c12d5ba38d 100644 (file)
@@ -1,25 +1,24 @@
-
 #include "mutator.qh"
 
+REGISTER_MUTATOR(touchexplode, cvar("g_touchexplode"));
+
 .float touchexplode_time;
 
 void PlayerTouchExplode(entity p1, entity p2)
 {SELFPARAM();
-       vector org;
-       org = (p1.origin + p2.origin) * 0.5;
+       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);
        Send_Effect(EFFECT_EXPLOSION_SMALL, org, '0 0 0', 1);
 
-       entity e;
-       e = spawn();
+       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);
 }
 
-MUTATOR_HOOKFUNCTION(touchexplode_PlayerThink)
+MUTATOR_HOOKFUNCTION(touchexplode, PlayerPreThink)
 {SELFPARAM();
        if(time > self.touchexplode_time)
        if(!gameover)
@@ -42,10 +41,3 @@ MUTATOR_HOOKFUNCTION(touchexplode_PlayerThink)
 
        return false;
 }
-
-MUTATOR_DEFINITION(mutator_touchexplode)
-{
-       MUTATOR_HOOK(PlayerPreThink, touchexplode_PlayerThink, CBC_ORDER_ANY);
-
-       return false;
-}