]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/miscfunctions.qc
Merge branch 'master' into Mario/monsters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / miscfunctions.qc
index 23b2d669365785bb5cf0af7866bde8a2a5ed3d8d..4c5bef5979bf0841657b24cb4797afb827aae898 100644 (file)
@@ -390,6 +390,8 @@ REPLICATE(autoswitch, bool, "cl_autoswitch");
 
 REPLICATE(cvar_cl_allow_uid2name, bool, "cl_allow_uid2name");
 
+REPLICATE(cvar_cl_allow_uidranking, bool, "cl_allow_uidranking");
+
 REPLICATE(cvar_cl_autoscreenshot, int, "cl_autoscreenshot");
 
 REPLICATE(cvar_cl_autotaunt, float, "cl_autotaunt");
@@ -398,6 +400,8 @@ REPLICATE(cvar_cl_clippedspectating, bool, "cl_clippedspectating");
 
 REPLICATE(cvar_cl_handicap, float, "cl_handicap");
 
+REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
+
 REPLICATE(cvar_cl_jetpack_jump, bool, "cl_jetpack_jump");
 
 REPLICATE(cvar_cl_movement_track_canjump, bool, "cl_movement_track_canjump");
@@ -429,6 +433,9 @@ void GetCvars(entity this, entity store, int f)
 {
        string s = string_null;
 
+       if (f == 0)
+               LOG_INFO("Warning: requesting cvar values is deprecated. Client should send them automatically using REPLICATE.\n");
+
        if (f > 0)
                s = strcat1(argv(f));
 
@@ -498,7 +505,7 @@ float want_weapon(entity weaponinfo, float allguns)
        allow_mutatorblocked = M_ARGV(3, bool);
 
        if(allguns)
-               d = boolean((weaponinfo.spawnflags & WEP_FLAG_NORMAL) && !(weaponinfo.spawnflags & WEP_FLAG_HIDDEN));
+               d = boolean((weaponinfo.spawnflags & WEP_FLAG_NORMAL) && !(weaponinfo.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK)));
        else if(!mutator_returnvalue)
                d = !(!weaponinfo.weaponstart);
 
@@ -527,7 +534,7 @@ WepSet weapons_start()
        WepSet ret = '0 0 0';
        FOREACH(Weapons, it != WEP_Null, {
                int w = want_weapon(it, false);
-               if(w & 1)
+               if (w & 1)
                        ret |= it.m_wepset;
        });
        return ret;
@@ -537,7 +544,7 @@ WepSet weapons_all()
 {
        WepSet ret = '0 0 0';
        FOREACH(Weapons, it != WEP_Null, {
-               if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED))
+               if (!(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK)))
                        ret |= it.m_wepset;
        });
        return ret;
@@ -557,7 +564,7 @@ WepSet weapons_most()
 {
        WepSet ret = '0 0 0';
        FOREACH(Weapons, it != WEP_Null, {
-               if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && (it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & WEP_FLAG_HIDDEN))
+               if ((it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK)))
                        ret |= it.m_wepset;
        });
        return ret;
@@ -708,7 +715,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
        {
@@ -730,7 +737,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;
@@ -1189,11 +1196,6 @@ bool WarpZone_Projectile_Touch_ImpactFilter_Callback(entity this, entity toucher
                        return false; // no checks here
                else if(this.classname == "grapplinghook")
                        RemoveHook(this);
-               else if(this.classname == "spike")
-               {
-                       W_Crylink_Dequeue(this);
-                       delete(this);
-               }
                else
                        delete(this);
                return true;
@@ -1255,7 +1257,7 @@ string uid2name(string myuid) {
        return s;
 }
 
-float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
+bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance, bool frompos)
 {
     float m, i;
     vector start, org, delta, end, enddown, mstart;
@@ -1315,14 +1317,22 @@ float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundma
 
        // rule 4: we must "see" some spawnpoint or item
     entity sp = NULL;
-    IL_EACH(g_spawnpoints, checkpvs(mstart, it),
+    if(frompos)
     {
-       if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
-       {
-               sp = it;
-               break;
-       }
-    });
+       if((traceline(mstart, e.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
+               sp = e;
+    }
+    if(!sp)
+    {
+           IL_EACH(g_spawnpoints, checkpvs(mstart, it),
+           {
+               if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
+               {
+                       sp = it;
+                       break;
+               }
+           });
+       }
        if(!sp)
        {
                int items_checked = 0;
@@ -1380,9 +1390,9 @@ float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundma
         return false;
 }
 
-float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
+bool MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance)
 {
-       return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance);
+       return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance, false);
 }
 
 void write_recordmarker(entity pl, float tstart, float dt)