From 588148c163f6837f4608b4c1353f3bc7a88f57b5 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 7 May 2013 16:14:52 +1000 Subject: [PATCH] Remove a redundant mutator hook --- qcsrc/server/g_world.qc | 2 -- qcsrc/server/mutators/base.qh | 6 ------ qcsrc/server/mutators/mutator_minstagib.qc | 25 +++++++++++++++------- qcsrc/server/t_items.qc | 8 ------- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 85ab359a7..d2fb72a93 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1545,7 +1545,6 @@ void FixIntermissionClient(entity e) } } -void minstagib_stop_countdown(entity e); /* go to the next level for deathmatch only called if a time or frag limit has expired @@ -1591,7 +1590,6 @@ void NextLevel() GameLogClose(); FOR_EACH_PLAYER(other) { - minstagib_stop_countdown(other); FixIntermissionClient(other); if(other.winning) bprint(other.netname, " ^7wins.\n"); diff --git a/qcsrc/server/mutators/base.qh b/qcsrc/server/mutators/base.qh index 0b07a9337..29797d7a0 100644 --- a/qcsrc/server/mutators/base.qh +++ b/qcsrc/server/mutators/base.qh @@ -232,12 +232,6 @@ MUTATOR_HOOKABLE(Item_RespawnCountdown); // INPUT+OUTPUT: string item_name; vector item_color; - -MUTATOR_HOOKABLE(Item_GiveTo); - // called when an item is given to a player - entity giveitem; - float player_wswitch; - float player_pickedup; MUTATOR_HOOKABLE(BotShouldAttack); // called when a bot checks a target to attack diff --git a/qcsrc/server/mutators/mutator_minstagib.qc b/qcsrc/server/mutators/mutator_minstagib.qc index 83886077c..9f2aa0364 100644 --- a/qcsrc/server/mutators/mutator_minstagib.qc +++ b/qcsrc/server/mutators/mutator_minstagib.qc @@ -28,6 +28,8 @@ void minstagib_stop_countdown(entity e) } void minstagib_ammocheck(void) { + if not(IS_PLAYER(self)) + return; // not a player if (time < self.minstagib_nextthink) return; @@ -98,6 +100,15 @@ void minstagib_ammocheck(void) self.minstagib_nextthink = time + 1; } +MUTATOR_HOOKFUNCTION(minstagib_MatchEnd) +{ + entity head; + FOR_EACH_PLAYER(head) + minstagib_stop_countdown(head); + + return FALSE; +} + MUTATOR_HOOKFUNCTION(minstagib_BotShouldAttack) { if(checkentity.items & IT_STRENGTH) @@ -324,9 +335,9 @@ MUTATOR_HOOKFUNCTION(minstagib_ItemCountdown) return FALSE; } -MUTATOR_HOOKFUNCTION(minstagib_GiveItem) +MUTATOR_HOOKFUNCTION(minstagib_ItemTouch) { - if(giveitem.ammo_cells) + if(self.ammo_cells) { // play some cool sounds ;) if (IS_CLIENT(other)) @@ -339,18 +350,15 @@ MUTATOR_HOOKFUNCTION(minstagib_GiveItem) if(other.health < 100) other.health = 100; - - player_pickedup = TRUE; } - if(giveitem.max_health) + if(self.max_health) { other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_minstagib_extralives); sprint(other, "^3You picked up some extra lives\n"); - player_pickedup = TRUE; } - return TRUE; + return FALSE; } MUTATOR_HOOKFUNCTION(minstagib_OnEntityPreSpawn) @@ -390,13 +398,14 @@ MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsPrettyString) MUTATOR_DEFINITION(mutator_minstagib) { + MUTATOR_HOOK(MatchEnd, minstagib_MatchEnd, CBC_ORDER_ANY); MUTATOR_HOOK(BotShouldAttack, minstagib_BotShouldAttack, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerPhysics, minstagib_PlayerPhysics, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerSpawn, minstagib_PlayerSpawn, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerDamage_Calculate, minstagib_PlayerDamage, CBC_ORDER_ANY); MUTATOR_HOOK(MakePlayerObserver, minstagib_MakePlayerObserver, CBC_ORDER_ANY); MUTATOR_HOOK(SetStartItems, minstagib_SetStartItems, CBC_ORDER_ANY); - MUTATOR_HOOK(Item_GiveTo, minstagib_GiveItem, CBC_ORDER_ANY); + MUTATOR_HOOK(ItemTouch, minstagib_ItemTouch, CBC_ORDER_ANY); MUTATOR_HOOK(FilterItem, minstagib_FilterItem, CBC_ORDER_ANY); MUTATOR_HOOK(CustomizeWaypoint, minstagib_CustomizeWaypoint, CBC_ORDER_ANY); MUTATOR_HOOK(Item_RespawnCountdown, minstagib_ItemCountdown, CBC_ORDER_ANY); diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 45698f1b2..b7c3c56eb 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -657,14 +657,6 @@ float Item_GiveTo(entity item, entity player) } :skip - - other = player; - giveitem = item; - player_wswitch = _switchweapon; - player_pickedup = pickedup; - MUTATOR_CALLHOOK(Item_GiveTo); - _switchweapon = player_wswitch; - pickedup = player_pickedup; // always eat teamed entities if(item.team) -- 2.39.2