]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
support update pk3s (+menu_updatecheck_getpacks 0 to opt out)
authorRudolf Polzer <divverent@alientrap.org>
Mon, 12 Mar 2012 16:25:56 +0000 (17:25 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 12 Mar 2012 16:25:56 +0000 (17:25 +0100)
defaultXonotic.cfg
qcsrc/menu/xonotic/util.qc

index ac5f8cb0bd779a6dcde86ffa329bc084345b5a49..0ec01d5825b50a1b34229dce87e7a67f0be5bb7c 100644 (file)
@@ -1564,7 +1564,8 @@ set cl_effects_lightningarc_branchfactor_add 0.1
 set g_hitplots 0 "when set to 1, hitplots are stored by the server to provide a means of proving that a triggerbot was used"
 seta g_hitplots_individuals "" "the individuals, by IP, that should have their hitplots recorded"
 
-set menu_updatecheck 1
+set menu_updatecheck 1 "check for updates"
+set menu_updatecheck_getpacks 1 "get update packs from update server"
 
 set bot_navigation_ignoreplayers 0 // FIXME remove this once the issue is solved
 set bot_sound_monopoly 0 "when enabled, only bots can make any noise"
index 580f22a93c7c7e5caab333763150067fa5a0173f..e733b7460b38d3d4de90203b5a34da2cc169f417 100644 (file)
@@ -256,6 +256,8 @@ void setDependentWeird(entity e, float(entity) func)
 float _Nex_ExtResponseSystem_Queried;
 string _Nex_ExtResponseSystem_UpdateTo;
 string _Nex_ExtResponseSystem_UpdateToURL;
+string _Nex_ExtResponseSystem_Packs;
+float _Nex_ExtResponseSystem_PacksStep;
 
 void URI_Get_Callback(float id, float status, string data)
 {
@@ -336,6 +338,15 @@ void UpdateNotification_URI_Get_Callback(float id, float status, string data)
                        _Nex_ExtResponseSystem_BannedServers = strzone(argv(3));
                        _Nex_ExtResponseSystem_BannedServersNeedsRefresh = 1;
                }
+
+               if(n >= 5)
+               {
+                       if(cvar("menu_updatecheck_getpacks"))
+                       {
+                               _Nex_ExtResponseSystem_Packs = strzone(argv(4));
+                               _Nex_ExtResponseSystem_PacksStep = 1;
+                       }
+               }
        }
 }
 
@@ -435,6 +446,30 @@ void preMenuDraw()
                }
        }
 
+       if(_Nex_ExtResponseSystem_PacksStep > 0)
+       {
+               float n;
+               float allgood;
+               n = tokenize_console(_Nex_ExtResponseSystem_Packs);
+               allgood = TRUE;
+               for(i = 0; i+1 < n; i += 2)
+               {
+                       if(fexists(argv(i+1)))
+                               continue;
+                       allgood = FALSE;
+                       if(_Nex_ExtResponseSystem_PacksStep == 1) // first run
+                               localcmd("\ncurl --pak \"", argv(i), "\"\n");
+               }
+               if(allgood)
+               {
+                       if(_Nex_ExtResponseSystem_PacksStep == 2)
+                               localcmd("\nmenu_restart\n");
+                       _Nex_ExtResponseSystem_PacksStep = 0;
+               }
+               else
+                       _Nex_ExtResponseSystem_PacksStep = 2;
+       }
+
        if(_Nex_ExtResponseSystem_UpdateTo != "")
        {
                // TODO rather turn this into a dialog