]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/buffs/buffs.qc
Purify PutClientInServer and PlayerSpawn mutator hooks
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / buffs / buffs.qc
index c450dc5703d8ba2520a64518701b442c9737bb6a..869dbcb62d5a116d8174040a4022e18acdbb327e 100644 (file)
@@ -92,8 +92,8 @@ REGISTER_MUTATOR(buffs, cvar("g_buffs"))
        }
 }
 
-bool buffs_BuffModel_Customize()
-{SELFPARAM();
+bool buffs_BuffModel_Customize(entity this)
+{
        entity player, myowner;
        bool same_team;
 
@@ -132,7 +132,7 @@ void buffs_BuffModel_Spawn(entity player)
        player.buff_model.scale = 0.7;
        player.buff_model.pflags = PFLAGS_FULLDYNAMIC;
        player.buff_model.light_lev = 200;
-       player.buff_model.customizeentityforclient = buffs_BuffModel_Customize;
+       setcefc(player.buff_model, buffs_BuffModel_Customize);
 }
 
 vector buff_GlowColor(entity buff)
@@ -389,8 +389,8 @@ void buff_Reset(entity this)
                buff_Respawn(this);
 }
 
-float buff_Customize()
-{SELFPARAM();
+float buff_Customize(entity this)
+{
        entity player = WaypointSprite_getviewentity(other);
        if(!this.buff_active || (this.team && DIFF_TEAM(player, this)))
        {
@@ -432,7 +432,7 @@ void buff_Init(entity this)
        this.skin = buff.m_skin;
        this.effects = EF_FULLBRIGHT | EF_STARDUST | EF_NOSHADOW;
        this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
-       this.customizeentityforclient = buff_Customize;
+       setcefc(this, buff_Customize);
        //this.gravity = 100;
        this.color = buff.m_color;
        this.glowmod = buff_GlowColor(this);
@@ -519,6 +519,12 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_SplitHealthArmor)
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate)
 {
+       entity frag_attacker = M_ARGV(1, entity);
+       entity frag_target = M_ARGV(2, entity);
+       float frag_deathtype = M_ARGV(3, float);
+       float frag_damage = M_ARGV(4, float);
+       vector frag_force = M_ARGV(6, vector);
+
        if(frag_deathtype == DEATH_BUFF.m_id) { return false; }
 
        if(frag_target.buffs & BUFF_SPEED.m_itemid)
@@ -608,15 +614,20 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate)
                        frag_attacker.armorvalue = bound(0, frag_attacker.armorvalue + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, frag_target.armorvalue), g_pickup_armorsmall_max);
        }
 
+       M_ARGV(4, float) = frag_damage;
+       M_ARGV(6, vector) = frag_force;
+
        return false;
 }
 
-MUTATOR_HOOKFUNCTION(buffs,PlayerSpawn)
-{SELFPARAM();
-       self.buffs = 0;
+MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn)
+{
+       entity player = M_ARGV(0, entity);
+
+       player.buffs = 0;
        // reset timers here to prevent them continuing after re-spawn
-       self.buff_disability_time = 0;
-       self.buff_disability_effect_time = 0;
+       player.buff_disability_time = 0;
+       player.buff_disability_effect_time = 0;
        return false;
 }