]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_damage.qc
Purge self from the damage/death mutator hooks
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_damage.qc
index 0c76214c8744f1cdf592574599e9db1585776c27..adfd5ddd88fd6a3baf80b91d6e20b7cde2dad9e4 100644 (file)
@@ -31,7 +31,7 @@ void UpdateFrags(entity player, float f)
 }
 
 void GiveFrags (entity attacker, entity targ, float f, int deathtype)
-{SELFPARAM();
+{
        // TODO route through PlayerScores instead
        if(gameover) return;
 
@@ -102,9 +102,9 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
        }
 
        // FIXME fix the mess this is (we have REAL points now!)
-       if(MUTATOR_CALLHOOK(GiveFragsForKill, self, attacker, targ, f))
+       if(MUTATOR_CALLHOOK(GiveFragsForKill, attacker, targ, f))
        {
-               f = frag_score;
+               f = M_ARGV(2, float);
        }
 
        attacker.totalfrags += f;
@@ -501,8 +501,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
        if(targ.killcount) { targ.killcount = 0; }
 }
 
-void Ice_Think()
-{SELFPARAM();
+void Ice_Think(entity this)
+{
        if(!STAT(FROZEN, self.owner) || self.owner.iceblock != self)
        {
                remove(self);
@@ -531,7 +531,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
        entity ice = new(ice);
        ice.owner = targ;
        ice.scale = targ.scale;
-       ice.think = Ice_Think;
+       setthink(ice, Ice_Think);
        ice.nextthink = time;
        ice.frame = floor(random() * 21); // ice model has 20 different looking frames
        setmodel(ice, MDL_ICE);
@@ -541,7 +541,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
        targ.iceblock = ice;
        targ.revival_time = 0;
 
-       WITHSELF(ice, Ice_Think());
+       WITHSELF(ice, Ice_Think(ice));
 
        RemoveGrapplingHook(targ);
 
@@ -697,9 +697,9 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
 
                // should this be changed at all? If so, in what way?
                MUTATOR_CALLHOOK(PlayerDamage_Calculate, inflictor, attacker, targ, deathtype, damage, mirrordamage, force);
-               damage = frag_damage;
-               mirrordamage = frag_mirrordamage;
-               force = frag_force;
+               damage = M_ARGV(4, float);
+               mirrordamage = M_ARGV(5, float);
+               force = M_ARGV(6, vector);
 
                if(STAT(FROZEN, targ))
                if(deathtype != DEATH_HURTTRIGGER.m_id && deathtype != DEATH_TEAMCHANGE.m_id && deathtype != DEATH_AUTOTEAMCHANGE.m_id)
@@ -850,7 +850,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                        farcent.origin = hitloc;
                        farcent.forcetype = FORCETYPE_FORCEATPOS;
                        farcent.nextthink = time + 0.1;
-                       farcent.think = SUB_Remove_self;
+                       setthink(farcent, SUB_Remove);
                }
                else
                {
@@ -1092,7 +1092,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
                {
                        // print("adding a fire burner to ", e.classname, "\n");
                        e.fire_burner = new(fireburner);
-                       e.fire_burner.think = fireburner_think;
+                       setthink(e.fire_burner, fireburner_think);
                        e.fire_burner.nextthink = time;
                        e.fire_burner.owner = e;
                }
@@ -1251,8 +1251,8 @@ void Fire_ApplyEffect(entity e)
                e.effects &= ~EF_FLAME;
 }
 
-void fireburner_think()
-{SELFPARAM();
+void fireburner_think(entity this)
+{
        // for players, this is done in the regular loop
        if(wasfreed(self.owner))
        {