]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/overkill/overkill.qc
Weapons: store switchweapon as direct weapon reference
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / overkill / overkill.qc
index 4ad190d258f439bf44e0319c458aa88418711929..952537e31f979bf5227847abe07d3cb3fdf7c9f0 100644 (file)
@@ -146,7 +146,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerDies)
        e.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500;
        SUB_SetFade(e, time + 5, 1);
 
-       this.ok_lastwep = this.switchweapon;
+       this.ok_lastwep = PS(this).m_switchweapon.m_id;
 
        return false;
 }
@@ -186,7 +186,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
 
        if(self.ok_lastwep)
        {
-               self.switchweapon = self.ok_lastwep;
+               PS(self).m_switchweapon = Weapons_from(self.ok_lastwep);
                self.ok_lastwep = 0;
        }
 
@@ -224,7 +224,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
        if(self.ok_use_ammocharge)
        if(!ok_CheckWeaponCharge(self, self.weapon))
        {
-               if(autocvar_g_overkill_ammo_charge_notice && time > self.ok_notice_time && self.BUTTON_ATCK && IS_REAL_CLIENT(self) && self.weapon == self.switchweapon)
+               if(autocvar_g_overkill_ammo_charge_notice && time > self.ok_notice_time && self.BUTTON_ATCK && IS_REAL_CLIENT(self) && self.weapon == PS(self).m_switchweapon.m_id)
                {
                        //Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_OVERKILL_CHARGE);
                        self.ok_notice_time = time + 2;