]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move minigame HUD command into minigame file
authorMario <mario@smbclan.net>
Mon, 28 Dec 2015 11:20:37 +0000 (21:20 +1000)
committerMario <mario@smbclan.net>
Mon, 28 Dec 2015 11:20:37 +0000 (21:20 +1000)
qcsrc/client/commands/cl_cmd.qc
qcsrc/common/minigames/cl_minigames.qc

index c99db92687eb1cb49c01768edf78e97eab572de3..24833d834704777fd88279fec7095ec08500f1a9 100644 (file)
@@ -284,15 +284,6 @@ void LocalCommand_hud(int request, int argc)
                                        return;
                                }
 
-                               case "minigame":
-                               {
-                                       if (HUD_MinigameMenu_IsOpened())
-                                               HUD_MinigameMenu_Close();
-                                       else
-                                               HUD_MinigameMenu_Open();
-                                       return;
-                               }
-
                                case "save":
                                {
                                        if (argv(2))
index ea5596f080108ac6065d95cdb874dbd75478a846..93147d4041b2ab44388870e634cec5dc00cb6bb9 100644 (file)
@@ -382,3 +382,22 @@ void minigame_prompt()
                        _("It's your turn"), "");
        }
 }
+
+// handle commands etc.
+REGISTER_MUTATOR(minigames, true);
+
+MUTATOR_HOOKFUNCTION(minigames, HUD_Command)
+{
+       if(MUTATOR_RETURNVALUE) { return false; } // command was already handled
+
+       if(argv(1) == "minigame")
+       {
+               if (HUD_MinigameMenu_IsOpened())
+                       HUD_MinigameMenu_Close();
+               else
+                       HUD_MinigameMenu_Open();
+               return true;
+       }
+
+       return false;
+}