From: Rudolf Polzer Date: Mon, 12 Mar 2012 16:25:56 +0000 (+0100) Subject: support update pk3s (+menu_updatecheck_getpacks 0 to opt out) X-Git-Tag: xonotic-v0.7.0~355 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=eea4e8795d5cd319b6778ad90d148d3098b19a86;p=xonotic%2Fxonotic-data.pk3dir.git support update pk3s (+menu_updatecheck_getpacks 0 to opt out) --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index ac5f8cb0b..0ec01d582 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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" diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 580f22a93..e733b7460 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -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