+#define LATENCY_THINKRATE 10
+.float latency_sum;
+.float latency_cnt;
+.float latency_time;
entity pingplreport;
void PingPLReport_Think()
{
WriteShort(MSG_BROADCAST, max(1, e.ping));
WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255));
WriteByte(MSG_BROADCAST, ceil(e.ping_movementloss * 255));
+
+ // record latency times for clients throughout the match so we can report it to playerstats
+ if(time > (e.latency_time + LATENCY_THINKRATE))
+ {
+ e.latency_sum += e.ping;
+ e.latency_cnt += 1;
+ e.latency_time = time;
+ //print("sum: ", ftos(e.latency_sum), ", cnt: ", ftos(e.latency_cnt), ", avg: ", ftos(e.latency_sum / e.latency_cnt), ".\n");
+ }
}
else
{
BADCVAR("g_balance_kill_delay");
BADCVAR("g_ca_point_leadlimit");
BADCVAR("g_ctf_captimerecord_always");
- BADCVAR("g_ctf_flag_capture_effects");
BADCVAR("g_ctf_flag_glowtrails");
- BADCVAR("g_ctf_flag_pickup_effects");
+ BADCVAR("g_ctf_flag_pickup_verbosename");
BADCVAR("g_domination_point_leadlimit");
BADCVAR("g_forced_respawn");
BADCVAR("g_keyhunt_point_leadlimit");
BADCVAR("gametype");
BADCVAR("g_antilag");
BADCVAR("g_balance_teams");
- BADCVAR("g_balance_teams_force");
+ BADCVAR("g_balance_teams_prevent_imbalance");
+ BADCVAR("g_balance_teams_scorefactor");
BADCVAR("g_ban_sync_trusted_servers");
BADCVAR("g_ban_sync_uri");
BADCVAR("g_ctf_ignore_frags");
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");
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();
+ CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
+ CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
void Map_MarkAsRecent(string m);
float world_already_spawned;
-void RegisterWeapons();
void Nagger_Init();
+void Item_ItemsTime_Init();
void ClientInit_Spawn();
void WeaponStats_Init();
void WeaponStats_Shutdown();
}
// needs to be done so early because of the constants they create
- RegisterWeapons();
- RegisterGametypes();
+ CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
+ CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid));
Map_MarkAsRecent(mapname);
+ PlayerStats_Init(); // we need this to be initiated before InitGameplayMode
+
precache_model ("null"); // we need this one before InitGameplayMode
InitGameplayMode();
readlevelcvars();
addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load);
+ addstat(STAT_ARMOR_LARGE_TIME, AS_FLOAT, item_armor_large_time);
+ addstat(STAT_HEALTH_MEGA_TIME, AS_FLOAT, item_health_mega_time);
+ addstat(STAT_INVISIBLE_TIME, AS_FLOAT, item_invisible_time);
+ addstat(STAT_SPEED_TIME, AS_FLOAT, item_speed_time);
+ addstat(STAT_EXTRALIFE_TIME, AS_FLOAT, item_extralife_time);
+ addstat(STAT_STRENGTH_TIME, AS_FLOAT, item_strength_time);
+ addstat(STAT_SHIELD_TIME, AS_FLOAT, item_shield_time);
+ addstat(STAT_FUELREGEN_TIME, AS_FLOAT, item_fuelregen_time);
+ addstat(STAT_JETPACK_TIME, AS_FLOAT, item_jetpack_time);
+ addstat(STAT_SUPERWEAPONS_TIME, AS_FLOAT, item_superweapons_time);
+ Item_ItemsTime_Init();
+
if(g_ca || g_freezetag)
{
addstat(STAT_REDALIVE, AS_INT, redalive_stat);
cvar_set("sv_curl_serverpackages", substring(s, 1, -1));
}
- 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
print(s, "\n");
if(to_eventlog)
GameLogEcho(s);
+
+ file = -1;
if(to_file)
{
file = fopen(autocvar_sv_logscores_filename, FILE_APPEND);
// - 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();
}
limitreached = (limitreached || leadlimitreached);
}
+ if(limit)
+ game_completion_ratio = max(game_completion_ratio, bound(0, WinningConditionHelper_topscore / limit, 1));
+
return GetWinningCode(
WinningConditionHelper_topscore && limitreached,
WinningConditionHelper_equality
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;
+ if(timelimit > game_starttime)
+ game_completion_ratio = (time - game_starttime) / (timelimit - game_starttime);
+ else
+ game_completion_ratio = 0;
+
if(checkrules_suddendeathend)
{
if(!checkrules_suddendeathwarning)
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]);