X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fmiscfunctions.qc;h=dd14a049e1bbb661464ab7bfb112c20ccf92c45f;hp=026e1d7ceb9e9fa190633702e12f819a09526f49;hb=f7b39f30ba70e25be35459c7d2c1f6f99efe135d;hpb=9ce1079a850c81a5f14a150f6a19cad2f51f6032 diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 026e1d7ceb..dd14a049e1 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -7,6 +7,7 @@ #include "ipban.qh" #include #include "../common/t_items.qh" +#include "mapvoting.qh" #include "resources.qh" #include "items.qh" #include "player.qh" @@ -228,6 +229,30 @@ string AmmoNameFromWeaponentity(Weapon wep) return ammoitems; } +string PlayerHealth(entity this) +{ + float myhealth = floor(GetResource(this, RES_HEALTH)); + if(myhealth == -666) + return "spectating"; + else if(myhealth == -2342 || (myhealth == 2342 && mapvote_initialized)) + return "observing"; + else if(myhealth <= 0 || IS_DEAD(this)) + return "dead"; + return ftos(myhealth); +} + +string WeaponNameFromWeaponentity(entity this, .entity weaponentity) +{ + entity wepent = this.(weaponentity); + if(!wepent) + return "none"; + else if(wepent.m_weapon != WEP_Null) + return wepent.m_weapon.m_name; + else if(wepent.m_switchweapon != WEP_Null) + return wepent.m_switchweapon.m_name; + return "none"; //Weapons_from(wepent.cnt).m_name; +} + string formatmessage(entity this, string msg) { float p, p1, p2; @@ -281,11 +306,11 @@ string formatmessage(entity this, string msg) case "\\":replacement = "\\"; break; case "n": replacement = "\n"; break; case "a": replacement = ftos(floor(GetResource(this, RES_ARMOR))); break; - case "h": replacement = ftos(floor(GetResource(this, RES_HEALTH))); break; + case "h": replacement = PlayerHealth(this); break; case "l": replacement = NearestLocation(this.origin); break; case "y": replacement = NearestLocation(cursor); break; case "d": replacement = NearestLocation(this.death_origin); 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 = WeaponNameFromWeaponentity(this, weaponentity); break; case "W": replacement = AmmoNameFromWeaponentity(this.(weaponentity).m_weapon); 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; @@ -475,6 +500,8 @@ void GetCvars(entity this, entity store, int f) } if (s == "cl_allow_uidtracking") PlayerStats_GameReport_AddPlayer(this); + //if (s == "cl_gunalign") + //W_ResetGunAlign(this, store.cvar_cl_gunalign); } } @@ -715,7 +742,7 @@ void readplayerstartcvars() { g_weapon_stay = 0; // incompatible start_weapons = g_weaponarena_weapons; - start_items |= IT_UNLIMITED_AMMO; + start_items |= IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS; } else { @@ -737,7 +764,7 @@ void readplayerstartcvars() if(!cvar("g_use_ammunition")) start_items |= IT_UNLIMITED_AMMO; - if(start_items & IT_UNLIMITED_WEAPON_AMMO) + if(start_items & IT_UNLIMITED_AMMO) { start_ammo_shells = 999; start_ammo_nails = 999;