X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_world.qc;h=08329a29d7e61a76a2f1e3097b307a93fa0fff78;hb=7a05dc86c2d0cd8e44eba58c42d3cd0093ca419e;hp=c815b0815a8539690c0c882f2b0e9b5a7663e6f5;hpb=21cd0bef7a9329d0201610bccedf8a29048b0291;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index c815b0815..08329a29d 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -236,6 +236,7 @@ void cvar_changes_init() BADCVAR("g_configversion"); BADCVAR("g_maplist_index"); BADCVAR("halflifebsp"); + BADPREFIX("sv_world"); // client BADPREFIX("cl_"); @@ -279,6 +280,8 @@ void cvar_changes_init() BADCVAR("sys_colortranslation"); BADCVAR("sys_specialcharactertranslation"); BADCVAR("timestamps"); + BADCVAR("net_address"); + BADCVAR("net_address_ipv6"); // mapinfo BADCVAR("timelimit"); @@ -512,6 +515,8 @@ void spawnfunc_worldspawn (void) InitGameplayMode(); readlevelcvars(); GrappleHookInit(); + ElectroInit(); + LaserInit(); player_count = 0; bot_waypoints_for_items = cvar("g_waypoints_for_items"); @@ -635,6 +640,13 @@ void spawnfunc_worldspawn (void) addstat(STAT_LEADLIMIT, AS_FLOAT, stat_leadlimit); addstat(STAT_BULLETS_LOADED, AS_INT, campingrifle_bulletcounter); + addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge); + + // g_movementspeed hack + addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw); + addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw); + addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw); + next_pingtime = time + 5; InitializeEntity(self, cvar_changes_init, INITPRIO_CVARS); @@ -694,7 +706,22 @@ void spawnfunc_worldspawn (void) CheatInit(); - localcmd("\n_sv_hook_gamestart ", GetGametype(), ";"); + localcmd("\n_sv_hook_gamestart ", GetGametype(), "\n"); + + // fill sv_curl_serverpackages from .serverpackage files + if(cvar("sv_curl_serverpackages_auto")) + { + fd = search_begin("*.serverpackage", TRUE, FALSE); + s = ""; + if(fd >= 0) + { + j = search_getsize(fd); + for(i = 0; i < j; ++i) + s = strcat(s, " ", search_getfilename(fd, i)); + search_end(fd); + } + cvar_set("sv_curl_serverpackages", substring(s, 1, -1)); + } world_initialized = 1; } @@ -1422,7 +1449,7 @@ void NextLevel() if(cvar("g_campaign")) CampaignPreIntermission(); - localcmd("\nsv_hook_gameend;"); + localcmd("\nsv_hook_gameend\n"); } /* @@ -1502,16 +1529,23 @@ void InitiateOvertime() // ONLY call this if InitiateSuddenDeath returned true float GetWinningCode(float fraglimitreached, float equality) { - if(equality) - if(fraglimitreached) - return WINNING_STARTSUDDENDEATHOVERTIME; - else - return WINNING_NEVER; - else + if(cvar("g_campaign") == 1) if(fraglimitreached) return WINNING_YES; else return WINNING_NO; + + else + if(equality) + if(fraglimitreached) + return WINNING_STARTSUDDENDEATHOVERTIME; + else + return WINNING_NEVER; + else + if(fraglimitreached) + return WINNING_YES; + else + return WINNING_NO; } // set the .winning flag for exactly those players with a given field value @@ -1630,7 +1664,7 @@ float WinningCondition_Assault() TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 666 - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 0)); - if(ent.cnt == 1) // this was the second round + if(ent.cnt == 1 || cvar("g_campaign")) // this was the second round { status = WINNING_YES; } @@ -1735,6 +1769,8 @@ void ShuffleMaplist() float leaderfrags; float WinningCondition_Scores(float limit, float leadlimit) { + float limitreached; + // TODO make everything use THIS winning condition (except LMS) WinningConditionHelper(); @@ -1779,13 +1815,22 @@ float WinningCondition_Scores(float limit, float leadlimit) } } + limitreached = FALSE; + if(limit) + if(WinningConditionHelper_topscore >= limit) + limitreached = TRUE; + if(leadlimit) + { + float leadlimitreached; + leadlimitreached = (WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit); + if(cvar("leadlimit_and_fraglimit")) + limitreached = (limitreached && leadlimitreached); + else + limitreached = (limitreached || leadlimitreached); + } + return GetWinningCode( - WinningConditionHelper_topscore && - ( - (limit && (WinningConditionHelper_topscore >= limit)) - || - (leadlimit && (WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit)) - ), + WinningConditionHelper_topscore && limitreached, WinningConditionHelper_equality ); }