X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmiscfunctions.qc;h=6db6454f6b904ddaf0a4b355c8d9d2111a1441e8;hb=02bdc3f123932f71f2f9456fa56f2107f69caedf;hp=9b0324755a41669bc1b6d0a750a306d45d481bba;hpb=d8102a4b1f5ddbaa66ea65195a8fff0c90e15529;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 9b0324755..6db6454f6 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -8,6 +8,21 @@ void crosshair_trace(entity pl) { traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * MAX_SHOT_DISTANCE, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl)); } +void crosshair_trace_plusvisibletriggers(entity pl) +{ + entity first; + entity e; + first = findchainfloat(solid, SOLID_TRIGGER); + + for (e = first; e; e = e.chain) + if (e.model != "") + e.solid = SOLID_BSP; + + crosshair_trace(pl); + + for (e = first; e; e = e.chain) + e.solid = SOLID_TRIGGER; +} void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag); void WarpZone_crosshair_trace(entity pl) { @@ -367,13 +382,13 @@ void spawnfunc_target_location() self.classname = "target_location"; // location name in netname // eventually support: count, teamgame selectors, line of sight? -}; +} void spawnfunc_info_location() { self.classname = "target_location"; self.message = self.netname; -}; +} string NearestLocation(vector p) { @@ -583,9 +598,11 @@ void GetCvars(float f) get_cvars_s = s; MUTATOR_CALLHOOK(GetCvars); GetCvars_handleFloat(s, f, autoswitch, "cl_autoswitch"); + GetCvars_handleFloat(s, f, cvar_cl_autoscreenshot, "cl_autoscreenshot"); GetCvars_handleFloat(s, f, cvar_cl_playerdetailreduction, "cl_playerdetailreduction"); GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion"); GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap"); + GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating"); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete); @@ -615,6 +632,8 @@ void GetCvars(float f) GetCvars_handleFloatOnce(s, f, cvar_cl_gunalign, "cl_gunalign"); GetCvars_handleFloat(s, f, cvar_cl_allow_uid2name, "cl_allow_uid2name"); GetCvars_handleFloat(s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking"); + GetCvars_handleFloat(s, f, cvar_cl_movement_track_canjump, "cl_movement_track_canjump"); + GetCvars_handleFloat(s, f, cvar_cl_newusekeysupported, "cl_newusekeysupported"); // fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early) if (f > 0) @@ -737,13 +756,13 @@ string playername(entity p) vector randompos(vector m1, vector m2) { - local vector v; + vector v; m2 = m2 - m1; v_x = m2_x * random() + m1_x; v_y = m2_y * random() + m1_y; v_z = m2_z * random() + m1_z; return v; -}; +} //#NO AUTOCVARS START @@ -1119,6 +1138,8 @@ string GetGametype(); // g_world.qc void readlevelcvars(void) { // first load all the mutators + if(cvar("g_invincible_projectiles")) + MUTATOR_ADD(mutator_invincibleprojectiles); if(cvar("g_nix")) MUTATOR_ADD(mutator_nix); if(cvar("g_dodging")) @@ -1127,6 +1148,8 @@ void readlevelcvars(void) MUTATOR_ADD(mutator_rocketflying); if(cvar("g_vampire")) MUTATOR_ADD(mutator_vampire); + if(cvar("g_sandbox")) + MUTATOR_ADD(sandbox); if(cvar("sv_allow_fullbright")) serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT; @@ -1178,7 +1201,6 @@ void readlevelcvars(void) g_bloodloss = cvar("g_bloodloss"); sv_maxidle = cvar("sv_maxidle"); sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle"); - sv_pogostick = cvar("sv_pogostick"); g_ctf_reverse = cvar("g_ctf_reverse"); sv_autotaunt = cvar("sv_autotaunt"); sv_taunt = cvar("sv_taunt"); @@ -1255,9 +1277,6 @@ void readlevelcvars(void) if(!g_weapon_stay) g_weapon_stay = cvar("g_weapon_stay"); - if (!g_weapon_stay && (cvar("deathmatch") == 2)) - g_weapon_stay = 1; - g_ghost_items = cvar("g_ghost_items"); if(g_ghost_items >= 1) @@ -1291,7 +1310,9 @@ float sound_allowed(float dest, entity e) { if (e.classname == "body") e = e.enemy; - if (e.owner && e.owner != e) + else if (e.realowner && e.realowner != e) + e = e.realowner; + else if (e.owner && e.owner != e) e = e.owner; else break; @@ -1457,7 +1478,7 @@ float spamsound(entity e, float chan, string samp, float vol, float atten) void play2team(float t, string filename) { - local entity head; + entity head; if (autocvar_bot_sound_monopoly) return; @@ -1631,7 +1652,7 @@ void precache() if(autocvar_sv_precacheweapons) { //precache weapon models/sounds - local float wep; + float wep; wep = WEP_FIRST; while (wep <= WEP_LAST) { @@ -1672,8 +1693,7 @@ void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, msg_entity = e; WRITESPECTATABLE_MSG_ONE({ WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_NOTIFY); - WriteByte(MSG_ONE, CSQC_CENTERPRINT_GENERIC); + WriteByte(MSG_ONE, TE_CSQC_CENTERPRINT_GENERIC); WriteByte(MSG_ONE, id); WriteString(MSG_ONE, s); if (id != 0 && s != "") @@ -1753,6 +1773,8 @@ void remove_except_protected(entity e) void remove_unsafely(entity e) { + if(e.classname == "spike") + error("Removing spikes is forbidden (crylink bug), please report"); remove_builtin(e); } @@ -2014,6 +2036,7 @@ float SUB_NoImpactCheck() #define SUB_OwnerCheck() (other && (other == self.owner)) void RemoveGrapplingHook(entity pl); +void W_Crylink_Dequeue(entity e); float WarpZone_Projectile_Touch_ImpactFilter_Callback() { if(SUB_OwnerCheck()) @@ -2022,6 +2045,11 @@ float WarpZone_Projectile_Touch_ImpactFilter_Callback() { if(self.classname == "grapplinghook") RemoveGrapplingHook(self.realowner); + else if(self.classname == "spike") + { + W_Crylink_Dequeue(self); + remove(self); + } else remove(self); return TRUE; @@ -2037,7 +2065,6 @@ float MAX_IPBAN_URIS = 16; float URI_GET_DISCARD = 0; float URI_GET_IPBAN = 1; float URI_GET_IPBAN_END = 16; -float URI_GET_PLAYERSTATS_SENT = 17; void URI_Get_Callback(float id, float status, string data) { @@ -2045,7 +2072,11 @@ void URI_Get_Callback(float id, float status, string data) dprint(data); dprint("\nEnd of data.\n"); - if (id == URI_GET_DISCARD) + if(url_URI_Get_Callback(id, status, data)) + { + // handled + } + else if (id == URI_GET_DISCARD) { // discard } @@ -2054,10 +2085,6 @@ void URI_Get_Callback(float id, float status, string data) // online ban list OnlineBanList_URI_Get_Callback(id, status, data); } - else if (id == URI_GET_PLAYERSTATS_SENT) - { - PlayerStats_Sent_URI_Get_Callback(id, status, data); - } else { print("Received HTTP request data for an invalid id ", ftos(id), ".\n"); @@ -2463,6 +2490,7 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f { float m, i; vector start, org, delta, end, enddown, mstart; + entity sp; m = e.dphitcontentsmask; e.dphitcontentsmask = goodcontents | badcontents; @@ -2515,6 +2543,19 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f if (trace_fraction >= 1) continue; + // rule 4: we must "see" some spawnpoint + for(sp = world; (sp = find(sp, classname, "info_player_deathmatch")); ) + if(checkpvs(mstart, sp)) + break; + if(!sp) + { + for(sp = world; (sp = findflags(sp, flags, FL_ITEM)); ) + if(checkpvs(mstart, sp)) + break; + if(!sp) + continue; + } + // find a random vector to "look at" end_x = org_x + random() * delta_x; end_y = org_y + random() * delta_y;