X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_world.qc;h=1ba0a54eba6451f324d5555a876c51985e00d086;hb=fb3dd670570afd2a2896108f02f4c85dd6b4b55c;hp=cbe65b6109e1f22c70de774afd07296ae713a996;hpb=31a6820253244d6a4b374d377f1b5e5ea89a4db9;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index cbe65b610..7fcd14612 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -101,9 +101,7 @@ void fteqcc_testbugs() * players. Also plays reminder sounds. */ void timeoutHandler_Think() { - local entity plr; - // NOTE: the below Send_CSQC_Centerprint_Generic send msgs with countdown_num - // parameter set as 0, even if the msgs are part of a countdown + entity plr; if (timeoutStatus == 1) { if (remainingLeadTime > 0) { //centerprint the information to every player @@ -255,6 +253,7 @@ void cvar_changes_init() BADPREFIX("con_"); BADPREFIX("scoreboard_"); BADPREFIX("g_campaign"); + BADPREFIX("g_waypointsprite_"); BADPREFIX("gl_"); BADPREFIX("joy"); BADPREFIX("hud_"); @@ -280,7 +279,6 @@ void cvar_changes_init() // private BADCVAR("developer"); - BADCVAR("g_banned_list"); BADCVAR("log_dest_udp"); BADCVAR("log_file"); BADCVAR("net_address"); @@ -288,14 +286,18 @@ void cvar_changes_init() BADCVAR("port"); BADCVAR("savedgamecfg"); BADCVAR("serverconfig"); + BADCVAR("sv_autoscreenshot"); BADCVAR("sv_heartbeatperiod"); BADCVAR("sv_vote_master_password"); BADCVAR("sys_colortranslation"); BADCVAR("sys_specialcharactertranslation"); + BADCVAR("timeformat"); BADCVAR("timestamps"); BADPREFIX("developer_"); BADPREFIX("g_ban_"); + BADPREFIX("g_banned_list"); BADPREFIX("g_chat_flood_"); + BADPREFIX("g_playerstats_"); BADPREFIX("g_voice_flood_"); BADPREFIX("rcon_"); BADPREFIX("settemp_"); @@ -306,12 +308,10 @@ void cvar_changes_init() BADPREFIX("sv_logscores_"); BADPREFIX("sv_master"); BADPREFIX("sv_weaponstats_"); + BADPREFIX("sv_waypointsprite_"); // these can contain player IDs, so better hide - BADCVAR("g_forced_team_red"); - BADCVAR("g_forced_team_blue"); - BADCVAR("g_forced_team_yellow"); - BADCVAR("g_forced_team_pink"); + BADPREFIX("g_forced_team_"); // mapinfo BADCVAR("fraglimit"); @@ -382,6 +382,7 @@ void cvar_changes_init() BADCVAR("leadlimit_and_fraglimit"); BADCVAR("leadlimit_override"); BADCVAR("pausable"); + BADCVAR("sv_allow_fullbright"); BADCVAR("sv_checkforpacketsduringsleep"); BADCVAR("sv_timeout"); BADCVAR("welcome_message_time"); @@ -392,10 +393,13 @@ void cvar_changes_init() BADPREFIX("net_"); BADPREFIX("prvm_"); BADPREFIX("skill_"); - BADPREFIX("sv_fragmessage_"); + BADPREFIX("sv_cullentities_"); + BADPREFIX("sv_fraginfo_"); BADPREFIX("sv_maxidle_"); BADPREFIX("sv_vote_"); BADPREFIX("timelimit_"); + BADCVAR("gameversion"); + BADPREFIX("gameversion_"); // allowed changes to server admins (please sync this to server.cfg) // vi commands: @@ -407,6 +411,7 @@ void cvar_changes_init() BADCVAR("bot_number"); BADCVAR("bot_prefix"); BADCVAR("bot_suffix"); + BADCVAR("bot_config_file"); BADCVAR("capturelimit_override"); BADCVAR("fraglimit_override"); BADCVAR("gametype"); @@ -419,6 +424,7 @@ void cvar_changes_init() BADCVAR("g_ctf_ignore_frags"); BADCVAR("g_ctf_win_mode"); BADCVAR("g_domination_point_limit"); + BADCVAR("g_friendlyfire"); BADCVAR("g_fullbrightitems"); BADCVAR("g_fullbrightplayers"); BADCVAR("g_keyhunt_point_limit"); @@ -432,15 +438,17 @@ void cvar_changes_init() BADCVAR("g_maplist_votable_abstain"); BADCVAR("g_maplist_votable_nodetail"); BADCVAR("g_maplist_votable_suggestions"); + BADCVAR("g_maxplayers"); BADCVAR("g_minstagib"); + BADCVAR("g_mirrordamage"); BADCVAR("g_nexball_goallimit"); BADCVAR("g_runematch_point_limit"); BADCVAR("g_start_delay"); + BADCVAR("g_warmup"); BADCVAR("g_weapon_stay"); BADPRESUFFIX("g_", "_weapon_stay"); BADCVAR("hostname"); BADCVAR("log_file"); BADCVAR("maxplayers"); - BADCVAR("g_maxplayers"); BADCVAR("minplayers"); BADCVAR("net_address"); BADCVAR("port"); @@ -468,10 +476,10 @@ void cvar_changes_init() BADCVAR("sv_vote_master_commands"); BADCVAR("sv_vote_master_password"); BADCVAR("sv_vote_simple_majority_factor"); + BADCVAR("sys_ticrate"); + BADCVAR("teamplay_mode"); BADCVAR("timelimit_override"); - BADCVAR("g_warmup"); BADPREFIX("g_warmup_"); - BADCVAR("teamplay_mode"); if(autocvar_g_minstagib) { @@ -625,7 +633,7 @@ void spawnfunc_worldspawn (void) allowed_to_spawn = TRUE; - local entity head; + entity head; head = nextent(world); maxclients = 0; while(head) @@ -637,7 +645,7 @@ void spawnfunc_worldspawn (void) // needs to be done so early as they would still spawn RegisterWeapons(); - ServerProgsDB = db_load("server.db"); + ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid)); TemporaryDB = db_create(); @@ -700,10 +708,6 @@ void spawnfunc_worldspawn (void) if(self.spawnflags & SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS) bot_waypoints_for_items = 0; - // for setting by mapinfo - q3acompat_machineshotgunswap = autocvar_sv_q3acompat_machineshotgunswap; - cvar_set("sv_q3acompat_machineshotgunswap", "0"); - precache(); WaypointSprite_Init(); @@ -714,8 +718,7 @@ void spawnfunc_worldspawn (void) GameLogInit(); // prepare everything if(autocvar_sv_eventlog) { - s = strcat(ftos(autocvar_sv_eventlog_files_counter), "."); - s = strcat(s, ftos(random())); + s = sprintf("%d.%s.%06d", ftos(autocvar_sv_eventlog_files_counter), strftime(FALSE, "%s"), floor(random() * 1000000)); matchid = strzone(s); GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s)); @@ -785,22 +788,22 @@ void spawnfunc_worldspawn (void) continue; if(argv(0) == "cd") { - print("Found ^1DEPRECATED^7 cd loop command in .cfg file; put this line in mapinfo instead:\n"); + print("Found ^1UNSUPPORTED^7 cd loop command in .cfg file; put this line in mapinfo instead:\n"); print(" cdtrack ", argv(2), "\n"); } else if(argv(0) == "fog") { - print("Found ^1DEPRECATED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:\n"); + print("Found ^1UNSUPPORTED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:\n"); print(" \"fog\" \"", s, "\"\n"); } else if(argv(0) == "set") { - print("Found ^1DEPRECATED^7 set command in .cfg file; put this line in mapinfo instead:\n"); + print("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n"); print(" clientsettemp_for_type all ", argv(1), " ", argv(2), "\n"); } else if(argv(0) != "//") { - print("Found ^1DEPRECATED^7 set command in .cfg file; put this line in mapinfo instead:\n"); + print("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n"); print(" clientsettemp_for_type all ", argv(0), " ", argv(1), "\n"); } } @@ -812,6 +815,7 @@ void spawnfunc_worldspawn (void) addstat(STAT_WEAPONS, AS_INT, weapons); addstat(STAT_SWITCHWEAPON, AS_INT, switchweapon); + addstat(STAT_SWITCHINGWEAPON, AS_INT, switchingweapon); addstat(STAT_GAMESTARTTIME, AS_FLOAT, stat_game_starttime); addstat(STAT_ALLOW_OLDNEXBEAM, AS_INT, stat_allow_oldnexbeam); Nagger_Init(); @@ -852,7 +856,11 @@ void spawnfunc_worldspawn (void) addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed); addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw); addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw); - + + // secrets + addstat(STAT_SECRETS_TOTAL, AS_FLOAT, stat_secrets_total); + addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found); + next_pingtime = time + 5; detect_maptype(); @@ -959,7 +967,7 @@ string GetMapname() float Map_Count, Map_Current; string Map_Current_Name; -// NOTE: this now expects the map list to be already tokenize()d and the count in Map_Count +// NOTE: this now expects the map list to be already tokenized and the count in Map_Count float GetMaplistPosition() { float pos, idx; @@ -1099,7 +1107,7 @@ void GameResetCfg() { // settings persist, except... localcmd("\nsettemp_restore\n"); -}; +} void Map_Goto() { @@ -1193,7 +1201,7 @@ void Maplist_Init() if(Map_Count == 0) { bprint( "Maplist is empty! Resetting it to default map list.\n" ); - cvar_set("g_maplist", MapInfo_ListAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); + cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); if(autocvar_g_maplist_shuffle) ShuffleMaplist(); localcmd("\nmenu_cmd sync\n"); @@ -1238,7 +1246,7 @@ string GetNextMap() } return ""; -}; +} float DoNextMapOverride() { @@ -1265,11 +1273,7 @@ float DoNextMapOverride() } if (autocvar_samelevel) // if samelevel is set, stay on same level { - // this does not work because it tries to exec maps/nexdm01.mapcfg (which doesn't exist, it should be trying maps/dm_nexdm01.mapcfg for example) - //localcmd(strcat("exec \"maps/", mapname, ".mapcfg\"\n")); - // so instead just restart the current map using the restart command (DOES NOT WORK PROPERLY WITH exit_cfg STUFF) localcmd("restart\n"); - //changelevel (mapname); alreadychangedlevel = TRUE; return TRUE; } @@ -1289,13 +1293,13 @@ float DoNextMapOverride() return TRUE; } return FALSE; -}; +} void GotoNextMap() { - //local string nextmap; - //local float n, nummaps; - //local string s; + //string nextmap; + //float n, nummaps; + //string s; if (alreadychangedlevel) return; alreadychangedlevel = TRUE; @@ -1313,7 +1317,7 @@ void GotoNextMap() if(allowReset) { bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" ); - cvar_set("g_maplist", MapInfo_ListAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); + cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); if(autocvar_g_maplist_shuffle) ShuffleMaplist(); localcmd("\nmenu_cmd sync\n"); @@ -1325,7 +1329,7 @@ void GotoNextMap() } Map_Goto(); } -}; +} /* @@ -1343,9 +1347,8 @@ void IntermissionThink() { FixIntermissionClient(self); - if(autocvar_sv_autoscreenshot) - if(self.autoscreenshot > 0) - if(time > self.autoscreenshot) + if( (autocvar_sv_autoscreenshot || self.cvar_cl_autoscreenshot) + && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) ) { self.autoscreenshot = -1; if(clienttype(self) == CLIENTTYPE_REAL) @@ -1357,11 +1360,11 @@ void IntermissionThink() return; if(!mapvote_initialized) - if (time < intermission_exittime + 10 && !self.BUTTON_ATCK && !self.BUTTON_JUMP && !self.BUTTON_ATCK2 && !self.BUTTON_HOOK && !self.BUTTON_USE) + if (time < intermission_exittime + 10 && !(self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE)) return; MapVote_Start(); -}; +} /* ============ @@ -1408,7 +1411,7 @@ entity FindIntermission() //objerror ("FindIntermission: no spot"); return world; -}; +} */ /* @@ -1588,6 +1591,7 @@ void NextLevel() FOR_EACH_CLIENT(e) PlayerStats_AddGlobalInfo(e); PlayerStats_Shutdown(); + WeaponStats_Shutdown(); if(autocvar_sv_eventlog) GameLogEcho(":gameover"); @@ -1623,7 +1627,7 @@ void CheckRules_Player() // fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities // (div0: and that in CheckRules_World please) -}; +} float checkrules_equality; float checkrules_suddendeathwarning; @@ -1732,7 +1736,7 @@ void ClearWinners(void) float WinningCondition_Onslaught() { entity head; - local float t1, t2, t3, t4; + float t1, t2, t3, t4; WinningConditionHelper(); // set worldstatus @@ -1792,7 +1796,7 @@ float LMS_NewPlayerLives() void assault_new_round(); float WinningCondition_Assault() { - local float status; + float status; WinningConditionHelper(); // set worldstatus @@ -1807,7 +1811,7 @@ float WinningCondition_Assault() SetWinners(team, COLOR_TEAM1); } - local entity ent; + entity ent; ent = find(world, classname, "target_assault_roundend"); if(ent) { @@ -1824,7 +1828,7 @@ float WinningCondition_Assault() } else { - local entity oldself; + entity oldself; oldself = self; self = ent; assault_new_round(); @@ -2016,7 +2020,6 @@ float WinningCondition_Race(float fraglimit) return wc; } -void ReadyRestart(); float WinningCondition_QualifyingThenRace(float limit) { float wc; @@ -2038,6 +2041,9 @@ float WinningCondition_RanOutOfSpawns() if(have_team_spawns <= 0) return WINNING_NO; + if(autocvar_g_spawn_useallspawns <= 0) + return WINNING_NO; + if(!some_spawn_has_been_used) return WINNING_NO; @@ -2103,6 +2109,7 @@ CheckRules_World Exit deathmatch games upon conditions ============ */ +void ReadyRestart(); void CheckRules_World() { float timelimit; @@ -2279,7 +2286,7 @@ void CheckRules_World() //print("WINNING\n"); NextLevel(); } -}; +} float mapvote_nextthink; float mapvote_initialized; @@ -2298,7 +2305,6 @@ string mapvote_maps_pakfile[MAPVOTE_COUNT]; float mapvote_maps_suggested[MAPVOTE_COUNT]; string mapvote_suggestions[MAPVOTE_COUNT]; float mapvote_suggestion_ptr; -float mapvote_maxlen; float mapvote_voters; float mapvote_votes[MAPVOTE_COUNT]; float mapvote_run; @@ -2360,8 +2366,10 @@ void MapVote_AddVotable(string nextMap, float isSuggestion) for(j = 0; j < mapvote_count; ++j) if(mapvote_maps[j] == nextMap) return; - if(strlen(nextMap) > mapvote_maxlen) - mapvote_maxlen = strlen(nextMap); + // suggestions might be no longer valid/allowed after gametype switch! + if(isSuggestion) + if(!MapInfo_CheckMap(nextMap)) + return; mapvote_maps[mapvote_count] = strzone(nextMap); mapvote_maps_suggested[mapvote_count] = isSuggestion; @@ -2423,7 +2431,7 @@ void MapVote_Init() if(mapvote_count == 0) { bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" ); - cvar_set("g_maplist", MapInfo_ListAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); + cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags())); if(autocvar_g_maplist_shuffle) ShuffleMaplist(); localcmd("\nmenu_cmd sync\n"); @@ -2798,7 +2806,7 @@ void MapVote_Think() } MapVote_Tick(); -}; +} string GotoMap(string m) { @@ -2907,7 +2915,7 @@ void RestoreGame() // some things then break, so let's work around them... // Progs DB (capture records) - ServerProgsDB = db_load("server.db"); + ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid)); // Mapinfo MapInfo_Shutdown(); @@ -2941,9 +2949,9 @@ void SV_Shutdown() if(!cheatcount_total) { if(autocvar_sv_db_saveasdump) - db_dump(ServerProgsDB, "server.db"); + db_dump(ServerProgsDB, strcat("server.db", autocvar_sessionid)); else - db_save(ServerProgsDB, "server.db"); + db_save(ServerProgsDB, strcat("server.db", autocvar_sessionid)); } if(autocvar_developer) {