X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fmiscfunctions.qc;h=35f0f227e77ee4c18859d3c10ef55c658aa78d21;hp=530e43f4a6a0392e2bd6d10b66a929829d5f9136;hb=3bbcff2475d1b2efc1314a358bf60c6fba6e4be6;hpb=79eebf87e68861e205a8754d6551bd0aa2229c44 diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 530e43f4a..35f0f227e 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -25,6 +25,7 @@ #include "../common/items/_mod.qh" #include "../common/state.qh" #include "../common/effects/qc/globalsound.qh" +#include "../common/wepent.qh" #include "../lib/csqcmodel/sv_model.qh" #include "../lib/warpzone/anglestransform.qh" #include "../lib/warpzone/server.qh" @@ -97,7 +98,7 @@ void GameLogEcho(string s) } if (autocvar_sv_eventlog_console) { - LOG_INFO(s, "\n"); + dedicated_print(strcat(s, "\n")); } } @@ -259,6 +260,8 @@ string formatmessage(entity this, string msg) replacement = substring(msg, p, 2); escape = substring(msg, p + 1, 1); + .entity weaponentity = weaponentities[0]; // TODO: unhardcode + switch(escape) { case "%": replacement = "%"; break; @@ -269,7 +272,7 @@ string formatmessage(entity this, string msg) case "l": replacement = NearestLocation(this.origin); break; case "y": replacement = NearestLocation(cursor); break; case "d": replacement = NearestLocation(this.death_origin); break; - case "w": replacement = ((PS(this).m_weapon == WEP_Null) ? ((PS(this).m_switchweapon == WEP_Null) ? Weapons_from(this.cnt) : PS(this).m_switchweapon) : PS(this).m_weapon).m_name; break; + case "w": replacement = ((this.(weaponentity).m_weapon == WEP_Null) ? ((this.(weaponentity).m_switchweapon == WEP_Null) ? Weapons_from(this.(weaponentity).cnt) : this.(weaponentity).m_switchweapon) : this.(weaponentity).m_weapon).m_name; break; case "W": replacement = ammoitems; break; case "x": replacement = ((cursor_ent.netname == "" || !cursor_ent) ? "nothing" : cursor_ent.netname); break; case "s": replacement = ftos(vlen(this.velocity - this.velocity_z * '0 0 1')); break; @@ -447,7 +450,14 @@ void GetCvars(entity this, int f) if (f > 0) { if (s == "cl_weaponpriority") - if (PS(this)) PS(this).m_switchweapon = w_getbestweapon(this); + { + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if (this.(weaponentity) && (this.(weaponentity).m_weapon != WEP_Null || slot == 0)) + this.(weaponentity).m_switchweapon = w_getbestweapon(this, weaponentity); + } + } if (s == "cl_allow_uidtracking") PlayerStats_GameReport_AddPlayer(this); } @@ -1073,7 +1083,7 @@ bool WarpZone_Projectile_Touch_ImpactFilter_Callback(entity this, entity toucher if(this.classname == "nade") return false; // no checks here else if(this.classname == "grapplinghook") - RemoveGrapplingHook(this.realowner); + RemoveHook(this); else if(this.classname == "spike") { W_Crylink_Dequeue(this); @@ -1144,7 +1154,6 @@ float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundma { float m, i; vector start, org, delta, end, enddown, mstart; - entity sp; m = e.dphitcontentsmask; e.dphitcontentsmask = goodcontents | badcontents; @@ -1200,16 +1209,26 @@ float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundma continue; // rule 4: we must "see" some spawnpoint or item - for(sp = NULL; (sp = find(sp, classname, "info_player_deathmatch")); ) - if(checkpvs(mstart, sp)) - if((traceline(mstart, sp.origin, MOVE_NORMAL, e), trace_fraction) >= 1) - break; + entity sp = NULL; + IL_EACH(g_spawnpoints, checkpvs(mstart, it), + { + if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1) + { + sp = it; + break; + } + }); if(!sp) { - for(sp = NULL; (sp = findflags(sp, flags, FL_ITEM)); ) - if(checkpvs(mstart, sp)) - if((traceline(mstart, sp.origin + (sp.mins + sp.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1) - break; + IL_EACH(g_items, checkpvs(mstart, it), + { + if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1) + { + sp = it; + break; + } + }); + if(!sp) continue; }