X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_world.qc;h=8e8dce9b12080abd58a7ff9ac91fd9bd2de9f317;hp=27fe5c1ef395653d8b296185b1c01794c7fac772;hb=3bbcff2475d1b2efc1314a358bf60c6fba6e4be6;hpb=3e21073f2bd7f282947bc1f214b3ec25d69ccae0 diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 27fe5c1ef..8e8dce9b1 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -5,7 +5,7 @@ #include "bot/api.qh" #include "campaign.qh" #include "cheats.qh" -#include "cl_client.qh" +#include "client.qh" #include "command/common.qh" #include "command/getreplies.qh" #include "command/sv_cmd.qh" @@ -13,7 +13,7 @@ #include "g_hook.qh" #include "ipban.qh" #include "mapvoting.qh" -#include "mutators/all.qh" +#include "mutators/_mod.qh" #include "race.qh" #include "scores.qh" #include "teamplay.qh" @@ -21,7 +21,7 @@ #include "../common/constants.qh" #include "../common/deathtypes/all.qh" #include "../common/mapinfo.qh" -#include "../common/monsters/all.qh" +#include "../common/monsters/_mod.qh" #include "../common/monsters/sv_monsters.qh" #include "../common/vehicles/all.qh" #include "../common/notifications/all.qh" @@ -32,8 +32,8 @@ #include "../common/triggers/trigger/secret.qh" #include "../common/triggers/target/music.qh" #include "../common/util.qh" -#include "../common/items/all.qh" -#include "../common/weapons/all.qh" +#include "../common/items/_mod.qh" +#include #include "../common/state.qh" const float LATENCY_THINKRATE = 10; @@ -56,9 +56,9 @@ void PingPLReport_Think(entity this) { WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT); WriteByte(MSG_BROADCAST, this.cnt); - WriteShort(MSG_BROADCAST, max(1, e.ping)); - WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255)); - WriteByte(MSG_BROADCAST, ceil(e.ping_movementloss * 255)); + WriteShort(MSG_BROADCAST, bound(1, e.ping, 65535)); + WriteByte(MSG_BROADCAST, min(ceil(e.ping_packetloss * 255), 255)); + WriteByte(MSG_BROADCAST, min(ceil(e.ping_movementloss * 255), 255)); // record latency times for clients throughout the match so we can report it to playerstats if(time > (e.latency_time + LATENCY_THINKRATE)) @@ -320,17 +320,20 @@ void cvar_changes_init() BADCVAR("g_invasion_point_limit"); BADCVAR("g_keyhunt_point_leadlimit"); BADCVAR("g_nexball_goalleadlimit"); + BADCVAR("g_new_toys_use_pickupsound"); + BADCVAR("g_physics_predictall"); + BADCVAR("g_piggyback"); BADCVAR("g_tdm_point_leadlimit"); BADCVAR("g_tdm_point_limit"); BADCVAR("leadlimit_and_fraglimit"); BADCVAR("leadlimit_override"); BADCVAR("pausable"); - BADCVAR("sv_allow_fullbright"); BADCVAR("sv_checkforpacketsduringsleep"); BADCVAR("sv_intermission_cdtrack"); BADCVAR("sv_minigames"); BADCVAR("sv_namechangetimer"); BADCVAR("sv_precacheplayermodels"); + BADCVAR("sv_stepheight"); BADCVAR("sv_timeout"); BADPREFIX("crypto_"); BADPREFIX("gameversion_"); @@ -342,9 +345,11 @@ void cvar_changes_init() BADPREFIX("net_"); BADPREFIX("prvm_"); BADPREFIX("skill_"); + BADPREFIX("sv_allow_"); BADPREFIX("sv_cullentities_"); BADPREFIX("sv_maxidle_"); BADPREFIX("sv_minigames_"); + BADPREFIX("sv_radio_"); BADPREFIX("sv_timeout_"); BADPREFIX("sv_vote_"); BADPREFIX("timelimit_"); @@ -369,6 +374,7 @@ void cvar_changes_init() BADCVAR("g_balance_teams_scorefactor"); BADCVAR("g_ban_sync_trusted_servers"); BADCVAR("g_ban_sync_uri"); + BADCVAR("g_buffs"); BADCVAR("g_ca_teams_override"); BADCVAR("g_ctf_ignore_frags"); BADCVAR("g_domination_point_limit"); @@ -391,6 +397,8 @@ void cvar_changes_init() BADCVAR("g_maxplayers"); BADCVAR("g_mirrordamage"); BADCVAR("g_nexball_goallimit"); + BADCVAR("g_norecoil"); + BADCVAR("g_physics_clientselect"); BADCVAR("g_powerups"); BADCVAR("g_spawnshieldtime"); BADCVAR("g_start_delay"); @@ -443,6 +451,7 @@ void cvar_changes_init() BADCVAR("g_grappling_hook"); BADCVAR("g_jetpack"); +#undef BADPRESUFFIX #undef BADPREFIX #undef BADCVAR @@ -555,6 +564,8 @@ spawnfunc(__init_dedicated_server) static_init_late(); static_init_precache(); + IL_PUSH(g_spawnpoints, e); // just incase + MapInfo_Enumerate(); MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0); } @@ -906,7 +917,8 @@ spawnfunc(worldspawn) if(cvar_string("g_mod_config") != cvar_defstring("g_mod_config")) modname = cvar_string("g_mod_config"); // extra mutators that deserve to count as mod - MUTATOR_CALLHOOK(SetModname); + MUTATOR_CALLHOOK(SetModname, modname); + modname = M_ARGV(0, string); // save it for later modname = strzone(modname); @@ -1332,32 +1344,32 @@ entity FindIntermission() local float cyc; // look for info_intermission first - spot = find (NULL, classname, "info_intermission"); + spot = find(NULL, classname, "info_intermission"); if (spot) { // pick a random one cyc = random() * 4; while (cyc > 1) { - spot = find (spot, classname, "info_intermission"); + spot = find(spot, classname, "info_intermission"); if (!spot) - spot = find (spot, classname, "info_intermission"); + spot = find(spot, classname, "info_intermission"); cyc = cyc - 1; } return spot; } // then look for the start position - spot = find (NULL, classname, "info_player_start"); + spot = find(NULL, classname, "info_player_start"); if (spot) return spot; // testinfo_player_start is only found in regioned levels - spot = find (NULL, classname, "testplayerstart"); + spot = find(NULL, classname, "testplayerstart"); if (spot) return spot; // then look for the start position - spot = find (NULL, classname, "info_player_deathmatch"); + spot = find(NULL, classname, "info_player_deathmatch"); if (spot) return spot; @@ -1501,7 +1513,7 @@ void FixIntermissionClient(entity e) stuffcmd(e, "\nscr_printspeed 1000000\n"); RandomSelection_Init(); FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, LAMBDA( - RandomSelection_Add(NULL, 0, it, 1, 1); + RandomSelection_AddString(it, 1, 1); )); if (RandomSelection_chosen_string != "") { @@ -1768,7 +1780,8 @@ float WinningCondition_RanOutOfSpawns() } )); - FOREACH_ENTITY_CLASS("info_player_deathmatch", true, LAMBDA( + IL_EACH(g_spawnpoints, true, + { switch(it.team) { case NUM_TEAM_1: team1_score = 1; break; @@ -1776,7 +1789,7 @@ float WinningCondition_RanOutOfSpawns() case NUM_TEAM_3: team3_score = 1; break; case NUM_TEAM_4: team4_score = 1; break; } - )); + }); ClearWinners(); if(team1_score + team2_score + team3_score + team4_score == 0) @@ -1980,6 +1993,34 @@ string GotoMap(string m) return "Map switch will happen after scoreboard."; } +bool autocvar_sv_gameplayfix_multiplethinksperframe; +void RunThink(entity this) +{ + // don't let things stay in the past. + // it is possible to start that way by a trigger with a local time. + if(this.nextthink <= 0 || this.nextthink > time + frametime) + return; + + float oldtime = time; // do we need to save this? + + for (int iterations = 0; iterations < 128 && !wasfreed(this); iterations++) + { + time = max(oldtime, this.nextthink); + this.nextthink = 0; + + if(getthink(this)) + getthink(this)(this); + // mods often set nextthink to time to cause a think every frame, + // we don't want to loop in that case, so exit if the new nextthink is + // <= the time the qc was told, also exit if it is past the end of the + // frame + if(this.nextthink <= time || this.nextthink > oldtime + frametime || !autocvar_sv_gameplayfix_multiplethinksperframe) + break; + } + + time = oldtime; +} + bool autocvar_sv_freezenonclients; bool autocvar_sv_gameplayfix_delayprojectiles; void Physics_Frame() @@ -1992,22 +2033,20 @@ void Physics_Frame() if(IS_CLIENT(it) || it.classname == "" || it.move_movetype == MOVETYPE_PUSH || it.move_movetype == MOVETYPE_FAKEPUSH || it.move_movetype == MOVETYPE_PHYSICS) continue; - int mt = it.move_movetype; - - if(mt == MOVETYPE_PUSH || mt == MOVETYPE_FAKEPUSH || mt == MOVETYPE_PHYSICS) - { - it.move_qcphysics = false; - set_movetype(it, mt); - continue; - } - - set_movetype(it, ((it.move_qcphysics) ? MOVETYPE_NONE : it.move_movetype)); + set_movetype(it, it.move_movetype); if(it.move_movetype == MOVETYPE_NONE) continue; if(it.move_qcphysics) Movetype_Physics_NoMatchTicrate(it, PHYS_INPUT_TIMELENGTH, false); + + if(it.movetype >= MOVETYPE_USER_FIRST && it.movetype <= MOVETYPE_USER_LAST) // these cases have no think handling + { + // handle thinking here + if (getthink(it) && it.nextthink > 0 && it.nextthink <= time + frametime) + RunThink(it); + } }); if(autocvar_sv_gameplayfix_delayprojectiles >= 0) @@ -2052,10 +2091,6 @@ void EndFrame() { antilag_record(it, it, altime); }); - FOREACH_CLIENT(PS(it), { - PlayerState s = PS(it); - s.ps_push(s, it); - }); systems_update(); IL_ENDFRAME(); }