world.cnt = 0;
}
-/**
- * Takes care of pausing and unpausing the game.
- * Centerprints the information about an upcoming or active timeout to all active
- * players. Also plays reminder sounds.
- */
-void timeoutHandler_Think() {
- entity plr;
- if (timeoutStatus == 1) {
- if (remainingLeadTime > 0) {
- //centerprint the information to every player
- FOR_EACH_REALCLIENT(plr) {
- if(plr.classname == "player") {
- Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, "Timeout begins in %d seconds!", 1, remainingLeadTime);
- }
- }
- remainingLeadTime -= 1;
- //think again in 1 second:
- self.nextthink = time + 1;
- }
- else {
- //now pause the game:
- timeoutStatus = 2;
- //reset all the flood variables
- FOR_EACH_CLIENT(plr) {
- plr.nickspamcount = plr.nickspamtime = plr.floodcontrol_chat = plr.floodcontrol_chatteam = plr.floodcontrol_chattell = plr.floodcontrol_voice = plr.floodcontrol_voiceteam = 0;
- }
- cvar_set("slowmo", ftos(TIMEOUT_SLOWMO_VALUE));
- //copy .v_angle to .lastV_angle for every player in order to fix their view during pause (see PlayerPreThink)
- FOR_EACH_REALPLAYER(plr) {
- plr.lastV_angle = plr.v_angle;
- }
- self.nextthink = time;
- }
- }
- else if (timeoutStatus == 2) {
- if (remainingTimeoutTime > 0) {
- FOR_EACH_REALCLIENT(plr) {
- if(plr.classname == "player") {
- Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, "Timeout ends in %d seconds!", 1, remainingTimeoutTime);
- }
- }
- if(remainingTimeoutTime == autocvar_sv_timeout_resumetime) { //play a warning sound when only <sv_timeout_resumetime> seconds are left
- Announce("prepareforbattle");
- }
- remainingTimeoutTime -= 1;
- self.nextthink = time + TIMEOUT_SLOWMO_VALUE;
- }
- else {
- //unpause the game again
- remainingTimeoutTime = timeoutStatus = 0;
- cvar_set("slowmo", ftos(orig_slowmo));
- //and unlock the fixed view again once there is no timeout active anymore
- FOR_EACH_REALPLAYER(plr) {
- plr.fixangle = FALSE;
- }
- //get rid of the countdown message
- FOR_EACH_REALCLIENT(plr) {
- if(plr.classname == "player") {
- Send_CSQC_Centerprint_Generic_Expire(plr, CPID_TIMEOUT_COUNTDOWN);
- }
- }
- remove(self);
- return;
- }
-
- }
- else if (timeoutStatus == 0) { //if a player called the resumegame command (which set timeoutStatus to 0 already)
- FOR_EACH_REALCLIENT(plr) {
- if(plr.classname == "player") {
- Send_CSQC_Centerprint_Generic_Expire(plr, CPID_TIMEOUT_COUNTDOWN);
- }
- }
- remove(self);
- return;
- }
-}
-
void GotoFirstMap()
{
float n;
BADPREFIX("g_respawn_ghosts");
BADPREFIX("g_voice_flood_");
BADPREFIX("rcon_");
- BADPREFIX("settemp_");
BADPREFIX("sv_allowdownloads");
BADPREFIX("sv_autodemo");
BADPREFIX("sv_curl_");
BADCVAR("g_balance_kill_delay");
BADCVAR("g_ca_point_leadlimit");
BADCVAR("g_ctf_captimerecord_always");
- BADCVAR("g_ctf_capture_leadlimit");
BADCVAR("g_ctf_flag_capture_effects");
BADCVAR("g_ctf_flag_glowtrails");
BADCVAR("g_ctf_flag_pickup_effects");
BADCVAR("g_domination_point_leadlimit");
BADCVAR("g_forced_respawn");
BADCVAR("g_keyhunt_point_leadlimit");
+ BADPREFIX("g_mod_");
BADCVAR("g_nexball_goalleadlimit");
BADCVAR("g_runematch_point_leadlimit");
BADCVAR("leadlimit_and_fraglimit");
BADCVAR("pausable");
BADCVAR("sv_allow_fullbright");
BADCVAR("sv_checkforpacketsduringsleep");
+ BADCVAR("sv_fraginfo");
BADCVAR("sv_timeout");
+ BADPREFIX("sv_timeout_");
BADCVAR("welcome_message_time");
BADPREFIX("crypto_");
BADPREFIX("g_chat_");
BADCVAR("g_balance_teams_force");
BADCVAR("g_ban_sync_trusted_servers");
BADCVAR("g_ban_sync_uri");
- BADCVAR("g_ctf_capture_limit");
BADCVAR("g_ctf_ignore_frags");
- BADCVAR("g_ctf_win_mode");
BADCVAR("g_domination_point_limit");
BADCVAR("g_friendlyfire");
BADCVAR("g_fullbrightitems");
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_powerups");
BADCVAR("sys_ticrate");
BADCVAR("teamplay_mode");
BADCVAR("timelimit_override");
+ BADCVAR("g_spawnshieldtime");
BADPREFIX("g_warmup_");
BADPREFIX("sv_ready_restart_");
+ // mutators that announce themselves properly to the server browser
+ BADCVAR("g_minstagib");
+ BADCVAR("g_new_toys");
+ BADCVAR("g_nix");
+
if(autocvar_g_minstagib)
{
BADCVAR("g_grappling_hook");
self.classname = "worldspawn"; // safeguard against various stuff ;)
+ // needs to be done so early because of the constants they create
+ RegisterWeapons();
+ RegisterGametypes();
+
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
}
head = nextent(head);
}
- // needs to be done so early as they would still spawn
+ // needs to be done so early because of the constants they create
RegisterWeapons();
+ RegisterGametypes();
ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid));
WeaponStats_Init();
- addstat(STAT_WEAPONS, AS_INT, weapons);
+ WEPSET_ADDSTAT();
addstat(STAT_SWITCHWEAPON, AS_INT, switchweapon);
addstat(STAT_SWITCHINGWEAPON, AS_INT, switchingweapon);
addstat(STAT_GAMESTARTTIME, AS_FLOAT, stat_game_starttime);
addstat(STAT_STRENGTH_FINISHED, AS_FLOAT, strength_finished);
addstat(STAT_INVINCIBLE_FINISHED, AS_FLOAT, invincible_finished);
+ addstat(STAT_SUPERWEAPONS_FINISHED, AS_FLOAT, superweapons_finished);
addstat(STAT_PRESSED_KEYS, AS_FLOAT, pressedkeys);
addstat(STAT_FUEL, AS_INT, ammo_fuel);
addstat(STAT_SHOTORG, AS_INT, stat_shotorg);
next_pingtime = time + 5;
detect_maptype();
-
+
+ // set up information replies for clients and server to use
lsmaps_reply = "^7Maps available: ";
lsnewmaps_reply = "^7Maps without a record set: ";
for(i = 0, j = 0; i < MapInfo_count; ++i)
col = "^2";
else
col = "^3";
+
++j;
+
lsmaps_reply = strcat(lsmaps_reply, col, MapInfo_Map_bspname, " ");
+
if(g_race && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "time"))))
lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " ");
else if(g_cts && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, CTS_RECORD, "time"))))
lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " ");
}
}
+
lsmaps_reply = strzone(strcat(lsmaps_reply, "\n"));
- if (!g_race && !g_cts)
- lsnewmaps_reply = "Need to be playing race or CTS for lsnewmaps to work.";
- lsnewmaps_reply = strzone(strcat(lsnewmaps_reply, "\n"));
+ lsnewmaps_reply = strzone(strcat(((!g_race && !g_cts) ? "Need to be playing race or CTS for lsnewmaps to work." : lsnewmaps_reply), "\n"));
maplist_reply = "^7Maps in list: ";
n = tokenize_console(autocvar_g_maplist);
{
records_reply[i] = strzone(getrecords(i));
}
- if(g_cts)
- ladder_reply = strzone(getladder());
+
+ ladder_reply = strzone(getladder());
rankings_reply = strzone(getrankings());
+ // begin other init
ClientInit_Spawn();
RandomSeed_Spawn();
PingPLReport_Spawn();
PlayerStats_Init();
+ // MOD AUTHORS: change this, and possibly remove a few of the blocks below to ignore certain changes
+ modname = "Xonotic";
+ // physics/balance/config changes that count as mod
+ if(cvar_string("g_mod_physics") != cvar_defstring("g_mod_physics"))
+ modname = cvar_string("g_mod_physics");
+ if(cvar_string("g_mod_balance") != cvar_defstring("g_mod_balance"))
+ modname = cvar_string("g_mod_balance");
+ if(cvar_string("g_mod_config") != cvar_defstring("g_mod_config"))
+ modname = cvar_string("g_mod_config");
+ // weird mutators that deserve to count as mod
+ if(autocvar_g_minstagib)
+ modname = "MinstaGib";
+ // extra mutators that deserve to count as mod
+ MUTATOR_CALLHOOK(SetModname);
+ // weird game types that deserve to count as mod
+ if(g_cts)
+ modname = "CTS";
+ // save it for later
+ modname = strzone(modname);
+
+ WinningConditionHelper(); // set worldstatus
+
world_initialized = 1;
}
string GetGametype()
{
- return GametypeNameFromType(game);
+ return MapInfo_Type_ToString(MapInfo_LoadedGametype);
}
string getmapname_stored;
Map_Goto_SetStr(argv(position));
}
-void GameResetCfg()
-{
- // settings persist, except...
- localcmd("\nsettemp_restore\n");
-}
-
void Map_Goto(float reinit)
{
- GameResetCfg();
MapInfo_LoadMap(getmapname_stored, reinit);
}
alreadychangedlevel = TRUE;
return TRUE;
}
- if (autocvar_samelevel) // if samelevel is set, stay on same level
+ if (!reinit && autocvar_samelevel) // if samelevel is set, stay on same level
{
localcmd("restart\n");
alreadychangedlevel = TRUE;
alreadychangedlevel = TRUE;
return TRUE;
}
- if(autocvar_lastlevel)
+ if(!reinit && autocvar_lastlevel)
{
- GameResetCfg();
- localcmd("set lastlevel 0\ntogglemenu\n");
+ cvar_settemp_restore();
+ localcmd("set lastlevel 0\ntogglemenu 1\n");
alreadychangedlevel = TRUE;
return TRUE;
}
void IntermissionThink()
{
FixIntermissionClient(self);
-
- if( (autocvar_sv_autoscreenshot || self.cvar_cl_autoscreenshot)
+
+ float server_screenshot = (autocvar_sv_autoscreenshot && self.cvar_cl_autoscreenshot);
+ float client_screenshot = (self.cvar_cl_autoscreenshot == 2);
+
+ if( (server_screenshot || client_screenshot)
&& ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) )
{
self.autoscreenshot = -1;
- if(clienttype(self) == CLIENTTYPE_REAL) { stuffcmd(self, sprintf("\nautoscreenshot \"%s\" \"%s\"\n", GetMapname(), strftime(FALSE, "%s"))); }
+ if(clienttype(self) == CLIENTTYPE_REAL) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"", GetMapname(), strftime(FALSE, "%s"))); }
return;
}
print(s, "\n");
if(to_eventlog)
GameLogEcho(s);
+
+ file = -1;
if(to_file)
{
file = fopen(autocvar_sv_logscores_filename, FILE_APPEND);
}
}
-
+void minstagib_stop_countdown(entity e);
/*
go to the next level for deathmatch
only called if a time or frag limit has expired
GameLogClose();
FOR_EACH_PLAYER(other) {
+ minstagib_stop_countdown(other);
FixIntermissionClient(other);
if(other.winning)
bprint(other.netname, " ^7wins.\n");
// - for this timelimit_overtime needs to be >0 of course
// - also check the winning condition calculated in the previous frame and only add normal overtime
// again, if at the point at which timelimit would be extended again, still no winner was found
- if ((checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < autocvar_timelimit_overtimes) && autocvar_timelimit_overtime && !(g_race && !g_race_qualifying))
+ if (!autocvar_g_campaign && (checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < autocvar_timelimit_overtimes) && autocvar_timelimit_overtime && !(g_race && !g_race_qualifying))
{
return 1; // need to call InitiateOvertime later
}
{
if(!checkrules_suddendeathend)
{
- checkrules_suddendeathend = time + 60 * autocvar_timelimit_suddendeath;
+ if(autocvar_g_campaign)
+ checkrules_suddendeathend = time; // no suddendeath in campaign
+ else
+ checkrules_suddendeathend = time + 60 * autocvar_timelimit_suddendeath;
if(g_race && !g_race_qualifying)
race_StartCompleting();
}
else if(team1_score + team2_score + team3_score + team4_score == 1)
{
float t, i;
- if(team1_score) t = COLOR_TEAM1;
- if(team2_score) t = COLOR_TEAM2;
- if(team3_score) t = COLOR_TEAM3;
- if(team4_score) t = COLOR_TEAM4;
+ if(team1_score)
+ t = COLOR_TEAM1;
+ else if(team2_score)
+ t = COLOR_TEAM2;
+ else if(team3_score)
+ t = COLOR_TEAM3;
+ else // if(team4_score)
+ t = COLOR_TEAM4;
CheckAllowedTeams(world);
for(i = 0; i < MAX_TEAMSCORE; ++i)
{
leadlimit = 0; // no leadlimit for now
}
- if(g_onslaught)
- timelimit = 0; // ONS has its own overtime rule
-
if(timelimit > 0)
{
timelimit += game_starttime;
return;
}
+ if(g_onslaught)
+ timelimit = 0; // ONS has its own overtime rule
+
float wantovertime;
wantovertime = 0;
mapvote_maps[mapvote_count] = strzone(nextMap);
mapvote_maps_suggested[mapvote_count] = isSuggestion;
+ pakfile = string_null;
for(i = 0; i < mapvote_screenshot_dirs_count; ++i)
{
mapfile = strcat(mapvote_screenshot_dirs[i], "/", mapvote_maps[i]);
clients_found = 0;
FOR_EACH_REALCLIENT(self)
{
+ // TODO add timer
print("Redirecting: sending connect command to ", self.netname, "\n");
if(redirection_target == "self")
- stuffcmd(self, "\ndisconnect; reconnect\n");
+ stuffcmd(self, "\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " reconnect\n");
else
- stuffcmd(self, strcat("\ndisconnect; connect ", redirection_target, "\n"));
+ stuffcmd(self, strcat("\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " \"connect ", redirection_target, "\"\n"));
++clients_found;
}
TargetMusic_RestoreGame();
}
-void SV_Shutdown()
+void Shutdown()
{
entity e;
- if(gameover > 1) // shutting down already?
- return;
-
- gameover = 2; // 2 = server shutting down
+ gameover = 2;
if(world_initialized > 0)
{