]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_player.qc
Mutators: make cloaked and running_guns mutators
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_player.qc
index 1b770121e8a8904b18ffe87312d271a8a885d741..dd70c31ddb4e717a77f58c8b3a72301182a2a405 100644 (file)
 
 #include "../common/animdecide.qh"
 
+void Drop_Special_Items(entity player)
+{
+       // called when the player has become stuck or frozen
+       // so objective items aren't stuck with the player
+
+       MUTATOR_CALLHOOK(DropSpecialItems, player);
+}
+
 void CopyBody_Think(void)
 {SELFPARAM();
        if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
@@ -44,7 +52,7 @@ void CopyBody(float keepvelocity)
 {SELFPARAM();
        if (self.effects & EF_NODRAW)
                return;
-       setself(spawn());
+       setself(new(body));
        self.enemy = this;
        self.lip = this.lip;
        self.colormap = this.colormap;
@@ -54,7 +62,6 @@ void CopyBody(float keepvelocity)
        self.angles = this.angles;
        self.v_angle = this.v_angle;
        self.avelocity = this.avelocity;
-       self.classname = "body";
        self.damageforcescale = this.damageforcescale;
        self.effects = this.effects;
        self.glowmod = this.glowmod;
@@ -160,11 +167,14 @@ void player_anim (void)
        animdecide_setstate(self, animbits, false);
        animdecide_setimplicitstate(self, (self.flags & FL_ONGROUND));
 
-       if (self.weaponentity)
+       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
        {
-               updateanim(self.weaponentity);
-               if (!self.weaponentity.animstate_override)
-                       setanim(self.weaponentity, self.weaponentity.anim_idle, true, false, false);
+               if (self.(weaponentity))
+               {
+                       updateanim(self.(weaponentity));
+                       if (!self.(weaponentity).animstate_override)
+                               setanim(self.(weaponentity), self.(weaponentity).anim_idle, true, false, false);
+               }
        }
 }
 
@@ -471,9 +481,18 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
        self.dmg_take = self.dmg_take + take;//max(take - 10, 0);
        self.dmg_inflictor = inflictor;
 
-       float abot, vbot;
-       abot = (IS_BOT_CLIENT(attacker));
-       vbot = (IS_BOT_CLIENT(self));
+       if (self != attacker) {
+               float realdmg = damage - excess;
+               if (IS_PLAYER(attacker)) {
+                       PlayerScore_Add(attacker, SP_DMG, realdmg);
+               }
+               if (IS_PLAYER(self)) {
+                       PlayerScore_Add(self, SP_DMGTAKEN, realdmg);
+               }
+       }
+       
+       bool abot = (IS_BOT_CLIENT(attacker));
+       bool vbot = (IS_BOT_CLIENT(self));
 
        valid_damage_for_weaponstats = 0;
        Weapon awep = WEP_Null;
@@ -495,7 +514,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                dh = dh - max(self.health, 0);
                da = da - max(self.armorvalue, 0);
                WeaponStats_LogDamage(awep.m_id, abot, self.weapon, vbot, dh + da);
-               MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc);
+               MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc, deathtype);
        }
 
        if (self.health < 1)
@@ -635,7 +654,10 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                {
                        Weapon w = get_weaponinfo(j);
                        w.wr_resetplayer(w);
-                       ATTACK_FINISHED_FOR(self, j) = 0;
+                       for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+                       {
+                               ATTACK_FINISHED_FOR(self, j, slot) = 0;
+                       }
                }
        }
 }