]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix wr_playerdeath 347/head
authorMario <mario@smbclan.net>
Tue, 9 Aug 2016 10:04:22 +0000 (20:04 +1000)
committerMario <mario@smbclan.net>
Tue, 9 Aug 2016 10:04:22 +0000 (20:04 +1000)
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/server/cl_player.qc

index 3b83b450fe1b74ebe94d2971b4d7f0bd88c49843..739ec1c32fab4e859bbaeac0a586d56ad55e6305 100644 (file)
@@ -107,7 +107,7 @@ CLASS(Weapon, Object)
     /** (CLIENT) impact effect for weapon explosion */
     METHOD(Weapon, wr_impacteffect, void(Weapon this, entity actor)) {}
     /** (SERVER) called whenever a player dies */
-    METHOD(Weapon, wr_playerdeath, void(Weapon this, entity actor)) {}
+    METHOD(Weapon, wr_playerdeath, void(Weapon this, entity actor, .entity weaponentity)) {}
     /** (SERVER) logic to run when weapon is lost */
     METHOD(Weapon, wr_gonethink, void(Weapon this, entity actor, .entity weaponentity)) {}
     /** (ALL)    dump weapon cvars to config in data directory (see: sv_cmd dumpweapons) */
index 2f78116ef3478183095032ad452b174bd920170f..d606567a111d129bec916a82ff6fd67ce2ca371c 100644 (file)
@@ -879,12 +879,12 @@ METHOD(Arc, wr_resetplayer, void(entity thiswep, entity actor))
     for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        actor.arc_BUTTON_ATCK_prev[slot] = false;
 }
-METHOD(Arc, wr_playerdeath, void(entity thiswep, entity actor))
+METHOD(Arc, wr_playerdeath, void(entity thiswep, entity actor, .entity weaponentity))
 {
     actor.arc_overheat = 0;
     actor.arc_cooldown = 0;
-    for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-       actor.arc_BUTTON_ATCK_prev[slot] = false;
+    int slot = weaponslot(weaponentity);
+    actor.arc_BUTTON_ATCK_prev[slot] = false;
 }
 #endif
 #ifdef CSQC
index 70335cc0e523c92bd70ef379cf44e6af5137c55a..8fb7fb253260955bf41ea93b55fa8d3e4dce9293 100644 (file)
@@ -506,19 +506,11 @@ METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor))
 {
     actor.hagar_load = 0;
 }
-METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor))
+METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor, .entity weaponentity))
 {
     // if we have any rockets loaded when we die, release them
     if(actor.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
-    {
-       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-       {
-               .entity weaponentity = weaponentities[slot];
-               if(actor.(weaponentity).weaponname != WEP_HAGAR.mdl)
-                       continue; // only if it's a hagar (currently only way to detect)
-               W_Hagar_Attack2_Load_Release(actor, weaponentity);
-       }
-    }
+       W_Hagar_Attack2_Load_Release(actor, weaponentity);
 }
 METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
index a542e6431345095828ccd90dc87dd9ecc081406e..1ae97c99e5c23020ea6d79fcbd567ce21f721d4f 100644 (file)
@@ -559,7 +559,13 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                excess = M_ARGV(4, float);
 
                Weapon wep = PS(this).m_weapon;
-               wep.wr_playerdeath(wep, this);
+               /*for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+               {
+                       .entity weaponentity = weaponentities[slot];
+                       wep.wr_playerdeath(wep, this, weaponentity);
+               }*/
+               .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+               wep.wr_playerdeath(wep, this, weaponentity);
 
                RemoveGrapplingHook(this);