]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move waypoint check to mutator (will add it back when we have a proper invisibility...
authorMario <mario.mario@y7mail.com>
Fri, 19 Apr 2013 05:43:45 +0000 (15:43 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 19 Apr 2013 05:43:45 +0000 (15:43 +1000)
qcsrc/server/mutators/base.qh
qcsrc/server/mutators/mutator_minstagib.qc
qcsrc/server/waypointsprites.qc

index d74201f976f9445a56e4da5a98599f9d227a4999..0b07a933765ed429345b264456c5299951aa8109 100644 (file)
@@ -96,6 +96,11 @@ MUTATOR_HOOKABLE(BuildMutatorsPrettyString);
        // appends ", Mutator name" to ret_string for display
        // INPUT, OUTPUT:
                string ret_string;
+               
+MUTATOR_HOOKABLE(CustomizeWaypoint);
+       // called every frame
+       // customizes the waypoint for spectators
+       // INPUT: self = waypoint, other = player, other.enemy = spectator
 
 MUTATOR_HOOKABLE(FilterItem);
        // checks if the current item may be spawned (self.items and self.weapons may be read and written to, as well as the ammo_ fields)
index e1e4ebf5c6f178a81576b7916eac6439ce11816f..7d3980d2afcc577b8f82a64ae38529db14079d24 100644 (file)
@@ -302,6 +302,19 @@ MUTATOR_HOOKFUNCTION(minstagib_FilterItem)
        return TRUE;
 }
 
+MUTATOR_HOOKFUNCTION(minstagib_CustomizeWaypoint)
+{
+       entity e = WaypointSprite_getviewentity(other);
+       
+       // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
+       // but only apply this to real players, not to spectators
+       if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
+       if(IsDifferentTeam(self.owner, e))
+               return TRUE;
+       
+       return FALSE;
+}
+
 MUTATOR_HOOKFUNCTION(minstagib_ItemCountdown)
 {
        switch(self.items)
@@ -387,6 +400,7 @@ MUTATOR_DEFINITION(mutator_minstagib)
        MUTATOR_HOOK(SetStartItems, minstagib_SetStartItems, CBC_ORDER_ANY);
        MUTATOR_HOOK(Item_GiveTo, minstagib_GiveItem, 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);
        MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, minstagib_SplitHealthArmor, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerPowerups, minstagib_PlayerPowerups, CBC_ORDER_ANY);
index 0e6f2168b863b50c94a7c49dd20659a9315ed879..c692b6e4ad53d26174c1686f0bb9f35c7cbcae05 100644 (file)
@@ -237,15 +237,9 @@ float WaypointSprite_Customize()
        // make spectators see what the player would see
        entity e;
        e = WaypointSprite_getviewentity(other);
-
-       // as a GENERAL rule:
-       // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
-       // but only apply this to real players, not to spectators
-       if(g_minstagib && (self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
-       {
-               if(!WaypointSprite_isteammate(self.owner, e))
-                       return FALSE;
-       }
+       
+       if(MUTATOR_CALLHOOK(CustomizeWaypoint))
+               return FALSE;
 
        return self.waypointsprite_visible_for_player(e);
 }