From ede503c22b0f0e11bf9cc905514e42a35951acba Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 6 Jan 2016 14:27:30 +1000 Subject: [PATCH] Purge self from PlayerDies --- .../gamemodes/gamemode/nexball/nexball.qc | 4 ++-- .../gamemodes/gamemode/onslaught/onslaught.qc | 14 +++++++------- qcsrc/common/mutators/mutator/buffs/buffs.qc | 16 ++++++++-------- .../mutators/mutator/campcheck/campcheck.qc | 5 ++--- .../mutators/mutator/overkill/overkill.qc | 11 +++++------ qcsrc/common/mutators/mutator/pinata/pinata.qc | 8 ++++---- .../spawn_near_teammate/spawn_near_teammate.qc | 4 ++-- .../mutators/mutator/superspec/superspec.qc | 6 +++--- qcsrc/server/cl_player.qc | 2 +- qcsrc/server/mutators/mutator/gamemode_ca.qc | 4 ++-- qcsrc/server/mutators/mutator/gamemode_cts.qc | 6 +++--- .../mutators/mutator/gamemode_freezetag.qc | 18 +++++++++--------- .../mutators/mutator/gamemode_keepaway.qc | 4 ++-- .../mutators/mutator/gamemode_keyhunt.qc | 10 +++++----- qcsrc/server/mutators/mutator/gamemode_lms.qc | 5 ++--- qcsrc/server/mutators/mutator/gamemode_race.qc | 6 +++--- 16 files changed, 60 insertions(+), 63 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 1630163af..d1ac1b40a 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -908,8 +908,8 @@ MUTATOR_HOOKFUNCTION(nb, ClientDisconnect) } MUTATOR_HOOKFUNCTION(nb, PlayerDies) -{SELFPARAM(); - nb_DropBall(self); +{ + nb_DropBall(frag_target); return false; } diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index b4d767295..6f246d905 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -1688,16 +1688,16 @@ entity ons_Nearest_ControlPoint_2D(vector pos, float max_dist) return closest_target; } /** - * find the number of control points and generators in the same team as self + * find the number of control points and generators in the same team as this */ -int ons_Count_SelfControlPoints() -{SELFPARAM(); +int ons_Count_SelfControlPoints(entity this) +{ entity tmp_entity; tmp_entity = findchain(classname, "onslaught_controlpoint"); int n = 0; while(tmp_entity) { - if(SAME_TEAM(tmp_entity, self)) + if(SAME_TEAM(tmp_entity, this)) if(tmp_entity.iscaptured) n++; tmp_entity = tmp_entity.chain; @@ -1705,7 +1705,7 @@ int ons_Count_SelfControlPoints() tmp_entity = findchain(classname, "onslaught_generator"); while(tmp_entity) { - if(SAME_TEAM(tmp_entity, self)) + if(SAME_TEAM(tmp_entity, this)) n++; tmp_entity = tmp_entity.chain; } @@ -1936,8 +1936,8 @@ MUTATOR_HOOKFUNCTION(ons, PlayerDies) } if ( autocvar_g_onslaught_spawn_choose ) - if ( ons_Count_SelfControlPoints() > 1 ) - stuffcmd(self, "qc_cmd_cl hud clickradar\n"); + if ( ons_Count_SelfControlPoints(frag_target) > 1 ) + stuffcmd(frag_target, "qc_cmd_cl hud clickradar\n"); return false; } diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index 32fe2d87d..117d2dbaa 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -656,17 +656,17 @@ MUTATOR_HOOKFUNCTION(buffs, MonsterMove) } MUTATOR_HOOKFUNCTION(buffs, PlayerDies) -{SELFPARAM(); - if(self.buffs) +{ + if(frag_target.buffs) { - int buffid = buff_FirstFromFlags(self.buffs).m_id; - Send_Notification(NOTIF_ALL_EXCEPT, self, MSG_INFO, INFO_ITEM_BUFF_LOST, self.netname, buffid); - self.buffs = 0; + int buffid = buff_FirstFromFlags(frag_target.buffs).m_id; + Send_Notification(NOTIF_ALL_EXCEPT, frag_target, MSG_INFO, INFO_ITEM_BUFF_LOST, frag_target.netname, buffid); + frag_target.buffs = 0; - if(self.buff_model) + if(frag_target.buff_model) { - remove(self.buff_model); - self.buff_model = world; + remove(frag_target.buff_model); + frag_target.buff_model = world; } } return false; diff --git a/qcsrc/common/mutators/mutator/campcheck/campcheck.qc b/qcsrc/common/mutators/mutator/campcheck/campcheck.qc index 01d388577..4916464a1 100644 --- a/qcsrc/common/mutators/mutator/campcheck/campcheck.qc +++ b/qcsrc/common/mutators/mutator/campcheck/campcheck.qc @@ -9,9 +9,8 @@ REGISTER_MUTATOR(campcheck, cvar("g_campcheck")); .float campcheck_traveled_distance; MUTATOR_HOOKFUNCTION(campcheck, PlayerDies) -{SELFPARAM(); - Kill_Notification(NOTIF_ONE, self, MSG_CENTER_CPID, CPID_CAMPCHECK); - +{ + Kill_Notification(NOTIF_ONE, frag_target, MSG_CENTER_CPID, CPID_CAMPCHECK); return false; } diff --git a/qcsrc/common/mutators/mutator/overkill/overkill.qc b/qcsrc/common/mutators/mutator/overkill/overkill.qc index 3645053c3..f0db0836a 100644 --- a/qcsrc/common/mutators/mutator/overkill/overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/overkill.qc @@ -113,18 +113,17 @@ MUTATOR_HOOKFUNCTION(ok, PlayerDamage_Calculate, CBC_ORDER_LAST) } MUTATOR_HOOKFUNCTION(ok, PlayerDamage_SplitHealthArmor) -{SELFPARAM(); +{ if(damage_take) - self.ok_pauseregen_finished = max(self.ok_pauseregen_finished, time + 2); + frag_target.ok_pauseregen_finished = max(frag_target.ok_pauseregen_finished, time + 2); return false; } MUTATOR_HOOKFUNCTION(ok, PlayerDies) { - SELFPARAM(); entity targ = ((frag_attacker) ? frag_attacker : frag_target); - if(IS_MONSTER(this)) + if(IS_MONSTER(frag_target)) { remove(other); // remove default item other = NULL; @@ -140,10 +139,10 @@ MUTATOR_HOOKFUNCTION(ok, PlayerDies) e.gravity = 1; e.reset = SUB_Remove; setorigin(e, frag_target.origin + '0 0 32'); - e.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500; + e.velocity = '0 0 200' + normalize(targ.origin - frag_target.origin) * 500; SUB_SetFade(e, time + 5, 1); - this.ok_lastwep = PS(this).m_switchweapon.m_id; + frag_target.ok_lastwep = PS(frag_target).m_switchweapon.m_id; return false; } diff --git a/qcsrc/common/mutators/mutator/pinata/pinata.qc b/qcsrc/common/mutators/mutator/pinata/pinata.qc index d9b7666c6..22ab9acae 100644 --- a/qcsrc/common/mutators/mutator/pinata/pinata.qc +++ b/qcsrc/common/mutators/mutator/pinata/pinata.qc @@ -2,12 +2,12 @@ REGISTER_MUTATOR(pinata, cvar("g_pinata") && !cvar("g_instagib") && !cvar("g_overkill")); MUTATOR_HOOKFUNCTION(pinata, PlayerDies) -{SELFPARAM(); +{ FOREACH(Weapons, it != WEP_Null, LAMBDA( - if(self.weapons & WepSet_FromWeapon(it)) - if(PS(self).m_switchweapon != it) + if(frag_target.weapons & WepSet_FromWeapon(it)) + if(PS(frag_target).m_switchweapon != it) if(W_IsWeaponThrowable(it.m_id)) - W_ThrowNewWeapon(self, it.m_id, false, CENTER_OR_VIEWOFS(self), randomvec() * 175 + '0 0 325'); + W_ThrowNewWeapon(frag_target, it.m_id, false, CENTER_OR_VIEWOFS(frag_target), randomvec() * 175 + '0 0 325'); )); return true; diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc index 168a06d2e..d94cb5397 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc @@ -159,8 +159,8 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn) } MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerDies) -{SELFPARAM(); - self.msnt_deathloc = self.origin; +{ + frag_target.msnt_deathloc = frag_target.origin; return 0; } diff --git a/qcsrc/common/mutators/mutator/superspec/superspec.qc b/qcsrc/common/mutators/mutator/superspec/superspec.qc index ed1f37b59..b7a596cdf 100644 --- a/qcsrc/common/mutators/mutator/superspec/superspec.qc +++ b/qcsrc/common/mutators/mutator/superspec/superspec.qc @@ -439,10 +439,10 @@ MUTATOR_HOOKFUNCTION(superspec, ClientConnect) } MUTATOR_HOOKFUNCTION(superspec, PlayerDies) -{SELFPARAM(); +{ FOREACH_CLIENT(IS_SPEC(it), LAMBDA( setself(it); - if(self.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && self.enemy == this) + if(self.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && self.enemy == frag_target) { if(self.autospec_flags & ASF_SHOWWHAT) superspec_msg("", "", self, sprintf("^7Following %s^7 due to followkiller\n", frag_attacker.netname), 2); @@ -451,7 +451,7 @@ MUTATOR_HOOKFUNCTION(superspec, PlayerDies) } )); - setself(this); + setself(frag_target); return false; } diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 0e16fac33..c6b0359c4 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -543,7 +543,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, if(accuracy_isgooddamage(attacker, this)) attacker.accuracy.(accuracy_frags[w.m_id-1]) += 1; - WITH(entity, self, this, MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype)); + MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype); excess = frag_damage; Weapon wep = PS(this).m_weapon; diff --git a/qcsrc/server/mutators/mutator/gamemode_ca.qc b/qcsrc/server/mutators/mutator/gamemode_ca.qc index e2056a407..c43eb88e0 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ca.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ca.qc @@ -292,10 +292,10 @@ void ca_LastPlayerForTeam_Notify() } MUTATOR_HOOKFUNCTION(ca, PlayerDies) -{SELFPARAM(); +{ ca_LastPlayerForTeam_Notify(); if(!allowed_to_spawn) - self.respawn_flags = RESPAWN_SILENT; + frag_target.respawn_flags = RESPAWN_SILENT; if(!warmup_stage) eliminatedPlayers.SendFlags |= 1; return 1; diff --git a/qcsrc/server/mutators/mutator/gamemode_cts.qc b/qcsrc/server/mutators/mutator/gamemode_cts.qc index 1ce78a1f7..fed9a8920 100644 --- a/qcsrc/server/mutators/mutator/gamemode_cts.qc +++ b/qcsrc/server/mutators/mutator/gamemode_cts.qc @@ -281,9 +281,9 @@ MUTATOR_HOOKFUNCTION(cts, PutClientInServer) } MUTATOR_HOOKFUNCTION(cts, PlayerDies) -{SELFPARAM(); - self.respawn_flags |= RESPAWN_FORCE; - race_AbandonRaceCheck(self); +{ + frag_target.respawn_flags |= RESPAWN_FORCE; + race_AbandonRaceCheck(frag_target); return false; } diff --git a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc index 7dd7e67c5..abc5d8c5a 100644 --- a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc @@ -376,12 +376,12 @@ MUTATOR_HOOKFUNCTION(ft, MakePlayerObserver) } MUTATOR_HOOKFUNCTION(ft, PlayerDies) -{SELFPARAM(); +{ if(round_handler_IsActive()) if(round_handler_CountdownRunning()) { - if(STAT(FROZEN, self)) - freezetag_Unfreeze(world); + if(STAT(FROZEN, frag_target)) + WITH(entity, self, frag_target, freezetag_Unfreeze(world)); freezetag_count_alive_players(); return 1; // let the player die so that he can respawn whenever he wants } @@ -392,23 +392,23 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies) || frag_deathtype == DEATH_TEAMCHANGE.m_id || frag_deathtype == DEATH_AUTOTEAMCHANGE.m_id) { // let the player die, he will be automatically frozen when he respawns - if(STAT(FROZEN, self) != 1) + if(STAT(FROZEN, frag_target) != 1) { freezetag_Add_Score(frag_attacker); freezetag_count_alive_players(); freezetag_LastPlayerForTeam_Notify(); } else - freezetag_Unfreeze(world); // remove ice - self.health = 0; // Unfreeze resets health - self.freezetag_frozen_timeout = -2; // freeze on respawn + WITH(entity, self, frag_target, freezetag_Unfreeze(world)); // remove ice + frag_target.health = 0; // Unfreeze resets health + frag_target.freezetag_frozen_timeout = -2; // freeze on respawn return 1; } - if(STAT(FROZEN, self)) + if(STAT(FROZEN, frag_target)) return 1; - freezetag_Freeze(frag_attacker); + WITH(entity, self, frag_target, freezetag_Freeze(frag_attacker)); freezetag_LastPlayerForTeam_Notify(); if(frag_attacker == frag_target || frag_attacker == world) diff --git a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc index 8659a9807..073631e70 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc @@ -313,7 +313,7 @@ void havocbot_role_ka_collector() // ============== MUTATOR_HOOKFUNCTION(ka, PlayerDies) -{SELFPARAM(); +{ if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker))) { if(frag_target.ballcarried) { // add to amount of times killing carrier @@ -329,7 +329,7 @@ MUTATOR_HOOKFUNCTION(ka, PlayerDies) PlayerScore_Add(frag_attacker, SP_SCORE, autocvar_g_keepaway_score_killac); } - if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has died, drop it + if(frag_target.ballcarried) { ka_DropEvent(frag_target); } // a player with the ball has died, drop it return 0; } diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 09a029984..6f8ec9551 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -1301,13 +1301,13 @@ MUTATOR_HOOKFUNCTION(kh, MakePlayerObserver) } MUTATOR_HOOKFUNCTION(kh, PlayerDies) -{SELFPARAM(); - if(self == other) - kh_Key_DropAll(self, true); +{ + if(frag_target == other) + kh_Key_DropAll(frag_target, true); else if(IS_PLAYER(other)) - kh_Key_DropAll(self, false); + kh_Key_DropAll(frag_target, false); else - kh_Key_DropAll(self, true); + kh_Key_DropAll(frag_target, true); return 0; } diff --git a/qcsrc/server/mutators/mutator/gamemode_lms.qc b/qcsrc/server/mutators/mutator/gamemode_lms.qc index 9d82004e2..77f6b6ca8 100644 --- a/qcsrc/server/mutators/mutator/gamemode_lms.qc +++ b/qcsrc/server/mutators/mutator/gamemode_lms.qc @@ -177,9 +177,8 @@ MUTATOR_HOOKFUNCTION(lms, PutClientInServer) } MUTATOR_HOOKFUNCTION(lms, PlayerDies) -{SELFPARAM(); - self.respawn_flags |= RESPAWN_FORCE; - +{ + frag_target.respawn_flags |= RESPAWN_FORCE; return false; } diff --git a/qcsrc/server/mutators/mutator/gamemode_race.qc b/qcsrc/server/mutators/mutator/gamemode_race.qc index 9d2dcbf4a..03ee6eaf9 100644 --- a/qcsrc/server/mutators/mutator/gamemode_race.qc +++ b/qcsrc/server/mutators/mutator/gamemode_race.qc @@ -321,9 +321,9 @@ MUTATOR_HOOKFUNCTION(rc, PutClientInServer) } MUTATOR_HOOKFUNCTION(rc, PlayerDies) -{SELFPARAM(); - self.respawn_flags |= RESPAWN_FORCE; - race_AbandonRaceCheck(self); +{ + frag_target.respawn_flags |= RESPAWN_FORCE; + race_AbandonRaceCheck(frag_target); return false; } -- 2.39.2