]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement new mutator hook to handle the "help me" ping for mutators that need to...
authorSamual <samual@xonotic.org>
Mon, 2 Apr 2012 05:18:43 +0000 (01:18 -0400)
committerSamual <samual@xonotic.org>
Mon, 2 Apr 2012 05:18:43 +0000 (01:18 -0400)
qcsrc/server/cl_impulse.qc
qcsrc/server/mutators/base.qh
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qh

index 524e796af2e32859054ee3a82522eae1ddb85147..41fb6cdb963422325261ea81887ff8417cd1ca31 100644 (file)
@@ -159,11 +159,14 @@ void ImpulseCommands (void)
                        case 33:
                                if(self.deadflag == DEAD_NO && teamplay)
                                {
-                                       wp = WaypointSprite_Attach("helpme", TRUE, RADARICON_HELPME, '1 0.5 0');
-                                       if(!wp)
-                                               WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier);
-                                       else
-                                               WaypointSprite_Ping(wp);
+                                       if not(MUTATOR_CALLHOOK(HelpMePing))
+                                       {
+                                               wp = WaypointSprite_Attach("helpme", TRUE, RADARICON_HELPME, '1 0.5 0');
+                                               if(!wp)
+                                                       WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier);
+                                               else
+                                                       WaypointSprite_Ping(wp);
+                                       }
                                        sprint(self, "HELP ME attached\n");
                                }
                                break;
index f2d740c39ed9b63f4593790d435e55f57d1eac43..374945d0c148e2b1863150f38fd03994849d34bf 100644 (file)
@@ -209,4 +209,13 @@ MUTATOR_HOOKABLE(SetModname);
 MUTATOR_HOOKABLE(PortalTeleport);
        // called whenever a player goes through a portal gun teleport
        // allows you to strip a player of an item if they go through the teleporter to help prevent cheating
-       entity self;
\ No newline at end of file
+       // INPUT
+       entity self;
+       
+MUTATOR_HOOKABLE(HelpMePing);
+       // called whenever a player uses impulse 33 (help me) in cl_impulse.qc
+       // normally help me ping uses self.waypointsprite_attachedforcarrier,
+       // but if your mutator uses something different then you can handle it
+       // in a special manner using this hook
+       // INPUT
+       entity self; // the player who pressed impulse 33
\ No newline at end of file
index b2346e9933113061a6101a1cffac955a6d508b01..6f07f843d64a6b96f99c722388a846a24a5a27b6 100644 (file)
@@ -1036,6 +1036,22 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
        return 0;
 }
 
+MUTATOR_HOOKFUNCTION(ctf_HelpMePing)
+{
+       if(self.wps_flagcarrier)
+       {
+               WaypointSprite_HelpMePing(self.wps_flagcarrier);
+       } 
+       else
+       {
+               WaypointSprite_Spawn("helpme", waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, FALSE, RADARICON_HELPME, '1 0.5 0');
+               WaypointSprite_Ping(self.wps_helpme);
+       }
+
+       return 1;
+}
+
+
 // ==========
 // Spawnfuncs
 // ==========
@@ -1191,6 +1207,7 @@ MUTATOR_DEFINITION(gamemode_ctf)
        MUTATOR_HOOK(PlayerPreThink, ctf_PlayerPreThink, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDamage_Calculate, ctf_PlayerDamage, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerUseKey, ctf_PlayerUseKey, CBC_ORDER_ANY);
+       MUTATOR_HOOK(HelpMePing, ctf_HelpMePing, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 5a7e9d88b6742556c1d47ad5adbbdabdd5d91903..7befba4ca2db504a1a2d88d5cd78a54d6b7605a2 100644 (file)
@@ -44,6 +44,7 @@ entity ctf_worldflaglist;
 
 // waypoint sprites
 .entity bot_basewaypoint; // flag waypointsprite
+.entity wps_helpme;
 .entity wps_flagbase; 
 .entity wps_flagcarrier;
 .entity wps_flagdropped;