]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove a redundant mutator hook
authorMario <mario.mario@y7mail.com>
Tue, 7 May 2013 06:14:52 +0000 (16:14 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 7 May 2013 06:14:52 +0000 (16:14 +1000)
qcsrc/server/g_world.qc
qcsrc/server/mutators/base.qh
qcsrc/server/mutators/mutator_minstagib.qc
qcsrc/server/t_items.qc

index 85ab359a74a1ec4fded0118560b583401e747b18..d2fb72a93909ad17cb7f3392d11e848b5cf3edec 100644 (file)
@@ -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");
index 0b07a933765ed429345b264456c5299951aa8109..29797d7a04d622c7f5207f4770ef93988b48aa91 100644 (file)
@@ -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
index 83886077c4683274635a0c5120387a6b29f5f139..9f2aa0364250e9fba18583c51bcbf841926f4cd2 100644 (file)
@@ -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);
index 45698f1b2b978eeec8a7ceab1ea11b9edde10dea..b7c3c56eb93fc9a9aef32d82adc04b00c02a2114 100644 (file)
@@ -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)