X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fworld.qc;h=41c9705da06f510026176c49d70f787505ad95fa;hp=7fce21e6ee81f69fe4a35112daaec00739e22ccc;hb=480de525d9378ac5baa42568c212dc6b13363879;hpb=b661d07fc75cd9448da4fe89af98b426b4e94c7f diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 7fce21e6ee..41c9705da0 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -46,7 +45,6 @@ #include #include #include -#include #include const float LATENCY_THINKRATE = 10; @@ -279,7 +277,6 @@ void cvar_changes_init() BADCVAR("g_duel_not_dm_maps"); BADCVAR("g_freezetag"); BADCVAR("g_freezetag_teams"); - BADCVAR("g_invasion_teams"); BADCVAR("g_invasion_type"); BADCVAR("g_jailbreak"); BADCVAR("g_jailbreak_teams"); @@ -337,7 +334,6 @@ void cvar_changes_init() // does nothing gameplay relevant BADCVAR("captureleadlimit_override"); BADCVAR("condump_stripcolors"); - BADCVAR("gameversion"); BADCVAR("fs_gamedir"); BADCVAR("g_allow_oldvortexbeam"); BADCVAR("g_balance_kill_delay"); @@ -397,7 +393,7 @@ void cvar_changes_init() BADCVAR("w_prop_interval"); BADPREFIX("chat_"); BADPREFIX("crypto_"); - BADPREFIX("gameversion_"); + BADPREFIX("gameversion"); BADPREFIX("g_chat_"); BADPREFIX("g_ctf_captimerecord_"); BADPREFIX("g_hats_"); @@ -416,6 +412,7 @@ void cvar_changes_init() BADPREFIX("sv_timeout_"); BADPREFIX("sv_vote_"); BADPREFIX("timelimit_"); + BADPRESUFFIX("g_", "_round_timelimit"); // allowed changes to server admins (please sync this to server.cfg) // vi commands: @@ -495,6 +492,7 @@ void cvar_changes_init() BADCVAR("sv_motd"); BADCVAR("sv_public"); BADCVAR("sv_showfps"); + BADCVAR("sv_showspectators"); BADCVAR("sv_status_privacy"); BADCVAR("sv_taunt"); BADCVAR("sv_vote_call"); @@ -519,13 +517,6 @@ void cvar_changes_init() BADCVAR("g_grappling_hook"); BADCVAR("g_jetpack"); - // temporary for testing - // TODO remove before 0.8.3 release - BADCVAR("g_ca_weaponarena"); - BADCVAR("g_freezetag_weaponarena"); - BADCVAR("g_lms_weaponarena"); - BADCVAR("g_ctf_stalemate_time"); - #undef BADPRESUFFIX #undef BADPREFIX #undef BADCVAR @@ -820,11 +811,11 @@ spawnfunc(worldspawn) if(autocvar_g_campaign) CampaignPreInit(); + else + PlayerStats_GameReport_Init(); // we need this to be initiated before InitGameplayMode Map_MarkAsRecent(mapname); - PlayerStats_GameReport_Init(); // we need this to be initiated before InitGameplayMode - InitGameplayMode(); static_init_late(); static_init_precache(); @@ -843,46 +834,15 @@ spawnfunc(worldspawn) WaypointSprite_Init(); - GameLogInit(); // prepare everything // NOTE for matchid: // changing the logic generating it is okay. But: // it HAS to stay <= 64 chars // character set: ASCII 33-126 without the following characters: : ; ' " \ $ - if(autocvar_sv_eventlog) - { - string num = strftime_s(); // strftime(false, "%s") isn't reliable, see strftime_s description - string s = sprintf("%s.%s.%06d", itos(autocvar_sv_eventlog_files_counter), num, floor(random() * 1000000)); - matchid = strzone(s); - - GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s)); - s = ":gameinfo:mutators:LIST"; - - MUTATOR_CALLHOOK(BuildMutatorsString, s); - s = M_ARGV(0, string); + // strftime(false, "%s") isn't reliable, see strftime_s description + matchid = strzone(sprintf("%d.%s.%06d", autocvar_sv_eventlog_files_counter, strftime_s(), random() * 1000000)); - // initialiation stuff, not good in the mutator system - if(!autocvar_g_use_ammunition) - s = strcat(s, ":no_use_ammunition"); - - // initialiation stuff, not good in the mutator system - if(autocvar_g_pickup_items == 0) - s = strcat(s, ":no_pickup_items"); - if(autocvar_g_pickup_items > 0) - s = strcat(s, ":pickup_items"); - - // initialiation stuff, not good in the mutator system - if(autocvar_g_weaponarena != "0") - s = strcat(s, ":", autocvar_g_weaponarena, " arena"); - - // TODO to mutator system - if(autocvar_g_norecoil) - s = strcat(s, ":norecoil"); - - GameLogEcho(s); - GameLogEcho(":gameinfo:end"); - } - else - matchid = strzone(ftos(random())); + if(autocvar_sv_eventlog) + GameLogInit(); // requires matchid to be set cvar_set("nextmap", ""); @@ -1032,7 +992,7 @@ spawnfunc(light) delete(this); } -bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance) +bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance, bool frompos) { float m = e.dphitcontentsmask; e.dphitcontentsmask = goodcontents | badcontents; @@ -1089,15 +1049,23 @@ bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax continue; // rule 4: we must "see" some spawnpoint or item - entity sp = NULL; - IL_EACH(g_spawnpoints, checkpvs(mstart, it), - { - if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1) - { - sp = it; - break; - } - }); + entity sp = NULL; + if(frompos) + { + if((traceline(mstart, e.origin, MOVE_NORMAL, e), trace_fraction) >= 1) + sp = e; + } + if(!sp) + { + IL_EACH(g_spawnpoints, checkpvs(mstart, it), + { + if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1) + { + sp = it; + break; + } + }); + } if(!sp) { int items_checked = 0; @@ -1156,7 +1124,7 @@ bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance) { - return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance); + return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance, false); } /* @@ -1334,7 +1302,7 @@ void NextLevel() } -float InitiateSuddenDeath() +int InitiateSuddenDeath() { // Check first whether normal overtimes could be added before initiating suddendeath mode // - for this timelimit_overtime needs to be >0 of course @@ -1630,8 +1598,8 @@ void CheckRules_World() if(timelimit > 0) timelimit += game_starttime; - float wantovertime; - wantovertime = 0; + int overtimes_prev = overtimes; + int wantovertime = 0; if(checkrules_suddendeathend) { @@ -1717,6 +1685,12 @@ void CheckRules_World() if(checkrules_status == WINNING_YES) { + if (overtimes == -1 && overtimes != overtimes_prev) + { + // if suddendeathend overtime has just begun, revert it + checkrules_suddendeathend = 0; + overtimes = overtimes_prev; + } //print("WINNING\n"); NextLevel(); } @@ -1878,25 +1852,25 @@ void readplayerstartcvars() else if (s == "all" || s == "1") { g_weaponarena = 1; - g_weaponarena_list = "All Weapons"; + g_weaponarena_list = "All Weapons Arena"; g_weaponarena_weapons = weapons_all(); } else if (s == "devall") { g_weaponarena = 1; - g_weaponarena_list = "Dev All Weapons"; + g_weaponarena_list = "Dev All Weapons Arena"; g_weaponarena_weapons = weapons_devall(); } else if (s == "most") { g_weaponarena = 1; - g_weaponarena_list = "Most Weapons"; + g_weaponarena_list = "Most Weapons Arena"; g_weaponarena_weapons = weapons_most(); } else if (s == "all_available") { g_weaponarena = 1; - g_weaponarena_list = "All Available Weapons"; + g_weaponarena_list = "All Available Weapons Arena"; // this needs to run after weaponsInMapAll is initialized InitializeEntity(NULL, weaponarena_available_all_update, INITPRIO_FINDTARGET); @@ -1904,7 +1878,7 @@ void readplayerstartcvars() else if (s == "devall_available") { g_weaponarena = 1; - g_weaponarena_list = "Dev All Available Weapons"; + g_weaponarena_list = "Dev All Available Weapons Arena"; // this needs to run after weaponsInMapAll is initialized InitializeEntity(NULL, weaponarena_available_devall_update, INITPRIO_FINDTARGET); @@ -1912,7 +1886,7 @@ void readplayerstartcvars() else if (s == "most_available") { g_weaponarena = 1; - g_weaponarena_list = "Most Available Weapons"; + g_weaponarena_list = "Most Available Weapons Arena"; // this needs to run after weaponsInMapAll is initialized InitializeEntity(NULL, weaponarena_available_most_update, INITPRIO_FINDTARGET); @@ -1920,7 +1894,7 @@ void readplayerstartcvars() else if (s == "none") { g_weaponarena = 1; - g_weaponarena_list = "No Weapons"; + g_weaponarena_list = "No Weapons Arena"; } else { @@ -1934,10 +1908,13 @@ void readplayerstartcvars() if(wep != WEP_Null) { g_weaponarena_weapons |= (wep.m_wepset); - g_weaponarena_list = strcat(g_weaponarena_list, wep.m_name, " & "); + g_weaponarena_list = strcat(g_weaponarena_list, wep.netname, " & "); } } - g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3)); + if (g_weaponarena_list != "") // remove trailing " & " + g_weaponarena_list = substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3); + else // no valid weapon found + g_weaponarena_list = "No Weapons Arena"; } if (g_weaponarena) @@ -1945,6 +1922,7 @@ void readplayerstartcvars() g_weapon_stay = 0; // incompatible start_weapons = g_weaponarena_weapons; start_items |= IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS; + g_weaponarena_list = strzone(g_weaponarena_list); } else { @@ -2135,7 +2113,7 @@ void readlevelcvars() MUTATOR_CALLHOOK(ReadLevelCvars); - if (!warmup_stage) + if (!warmup_stage && !autocvar_g_campaign) game_starttime = time + cvar("g_start_delay"); FOREACH(Weapons, it != WEP_Null, { it.wr_init(it); });