]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/miscfunctions.qc
Merge branch 'martin-t/blaster' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / miscfunctions.qc
index e01fab2d428c70890901664ad18d3c18da4cda68..a59f4afa231380a58cc9f5e24fd6b7e76dd6e0b5 100644 (file)
@@ -429,6 +429,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 +501,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);
 
@@ -526,8 +529,8 @@ WepSet weapons_start()
 {
        WepSet ret = '0 0 0';
        FOREACH(Weapons, it != WEP_Null, {
-               int w = want_weapon(it, false); // TODO too complicated? see my MR, test CTS/courtfun - ballstealer
-               if(w & 1)
+               int w = want_weapon(it, false);
+               if (w & 1)
                        ret |= it.m_wepset;
        });
        return ret;
@@ -537,7 +540,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 +560,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;
@@ -635,7 +638,7 @@ void readplayerstartcvars()
        {
                // no arena
        }
-       else if (s == "off") // TODO remove? CA and others don't respect this
+       else if (s == "off")
        {
                // forcibly turn off weaponarena
        }
@@ -748,16 +751,11 @@ void readplayerstartcvars()
                start_ammo_plasma = cvar("g_start_ammo_plasma");
                start_ammo_fuel = cvar("g_start_ammo_fuel");
                random_start_weapons_count = cvar("g_random_start_weapons_count");
-               SetResource(random_start_ammo, RES_SHELLS, cvar(
-                       "g_random_start_shells"));
-               SetResource(random_start_ammo, RES_BULLETS, cvar(
-                       "g_random_start_bullets"));
-               SetResource(random_start_ammo, RES_ROCKETS,
-                       cvar("g_random_start_rockets"));
-               SetResource(random_start_ammo, RES_CELLS, cvar(
-                       "g_random_start_cells"));
-               SetResource(random_start_ammo, RES_PLASMA, cvar(
-                       "g_random_start_plasma"));
+               SetResource(random_start_ammo, RES_SHELLS, cvar("g_random_start_shells"));
+               SetResource(random_start_ammo, RES_BULLETS, cvar("g_random_start_bullets"));
+               SetResource(random_start_ammo, RES_ROCKETS,cvar("g_random_start_rockets"));
+               SetResource(random_start_ammo, RES_CELLS, cvar("g_random_start_cells"));
+               SetResource(random_start_ammo, RES_PLASMA, cvar("g_random_start_plasma"));
        }
 
        warmup_start_ammo_shells = start_ammo_shells;
@@ -815,16 +813,16 @@ void readplayerstartcvars()
        start_ammo_cells = max(0, start_ammo_cells);
        start_ammo_plasma = max(0, start_ammo_plasma);
        start_ammo_fuel = max(0, start_ammo_fuel);
-       SetResource(random_start_ammo, RES_SHELLS, max(0,
-               GetResource(random_start_ammo, RES_SHELLS)));
-       SetResource(random_start_ammo, RES_BULLETS, max(0,
-               GetResource(random_start_ammo, RES_BULLETS)));
-       SetResource(random_start_ammo, RES_ROCKETS, max(0,
-               GetResource(random_start_ammo, RES_ROCKETS)));
-       SetResource(random_start_ammo, RES_CELLS, max(0,
-               GetResource(random_start_ammo, RES_CELLS)));
-       SetResource(random_start_ammo, RES_PLASMA, max(0,
-               GetResource(random_start_ammo, RES_PLASMA)));
+       SetResource(random_start_ammo, RES_SHELLS,
+               max(0, GetResource(random_start_ammo, RES_SHELLS)));
+       SetResource(random_start_ammo, RES_BULLETS,
+               max(0, GetResource(random_start_ammo, RES_BULLETS)));
+       SetResource(random_start_ammo, RES_ROCKETS,
+               max(0, GetResource(random_start_ammo, RES_ROCKETS)));
+       SetResource(random_start_ammo, RES_CELLS,
+               max(0, GetResource(random_start_ammo, RES_CELLS)));
+       SetResource(random_start_ammo, RES_PLASMA,
+               max(0, GetResource(random_start_ammo, RES_PLASMA)));
 
        warmup_start_ammo_shells = max(0, warmup_start_ammo_shells);
        warmup_start_ammo_nails = max(0, warmup_start_ammo_nails);