From: Mario Date: Fri, 19 Apr 2013 05:43:45 +0000 (+1000) Subject: Move waypoint check to mutator (will add it back when we have a proper invisibility... X-Git-Tag: xonotic-v0.7.0~55^2~3^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=79058b12f0ee3454f3801f68e4b2452038be3a80;p=xonotic%2Fxonotic-data.pk3dir.git Move waypoint check to mutator (will add it back when we have a proper invisibility powerup) --- diff --git a/qcsrc/server/mutators/base.qh b/qcsrc/server/mutators/base.qh index d74201f97..0b07a9337 100644 --- a/qcsrc/server/mutators/base.qh +++ b/qcsrc/server/mutators/base.qh @@ -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) diff --git a/qcsrc/server/mutators/mutator_minstagib.qc b/qcsrc/server/mutators/mutator_minstagib.qc index e1e4ebf5c..7d3980d2a 100644 --- a/qcsrc/server/mutators/mutator_minstagib.qc +++ b/qcsrc/server/mutators/mutator_minstagib.qc @@ -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); diff --git a/qcsrc/server/waypointsprites.qc b/qcsrc/server/waypointsprites.qc index 0e6f2168b..c692b6e4a 100644 --- a/qcsrc/server/waypointsprites.qc +++ b/qcsrc/server/waypointsprites.qc @@ -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); }