From: Mario Date: Tue, 9 Aug 2016 10:04:22 +0000 (+1000) Subject: Fix wr_playerdeath X-Git-Tag: xonotic-v0.8.2~723^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=858873de7a8672d4a92a131e8387c62347d3a842;p=xonotic%2Fxonotic-data.pk3dir.git Fix wr_playerdeath --- diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index 3b83b450f..739ec1c32 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -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) */ diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 2f78116ef..d606567a1 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -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 diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 70335cc0e..8fb7fb253 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -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)) { diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index a542e6431..1ae97c99e 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -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);