]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/miscfunctions.qc
Merge branch 'master' into TimePath/debug_draw
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / miscfunctions.qc
index cbf296f84bc72bb5fec71a8657d2bab8e112a206..f756622bf880e091ae74fd6629be180410e3e2f3 100644 (file)
@@ -4,7 +4,7 @@
 #include "constants.qh"
 #include "g_hook.qh"
 #include "ipban.qh"
-#include "mutators/mutators_include.qh"
+#include "mutators/all.qh"
 #include "t_items.qh"
 #include "weapons/accuracy.qh"
 #include "weapons/csqcprojectile.qh"
@@ -446,11 +446,6 @@ void GetCvars(float f)
        GetCvars_handleFloat(s, f, cvar_cl_noantilag, "cl_noantilag");
        GetCvars_handleFloat(s, f, cvar_cl_voice_directional, "cl_voice_directional");
        GetCvars_handleFloat(s, f, cvar_cl_voice_directional_taunt_attenuation, "cl_voice_directional_taunt_attenuation");
-       GetCvars_handleFloat(s, f, cvar_cl_accuracy_data_share, "cl_accuracy_data_share");
-       GetCvars_handleFloat(s, f, cvar_cl_accuracy_data_receive, "cl_accuracy_data_receive");
-
-       self.cvar_cl_accuracy_data_share = boolean(self.cvar_cl_accuracy_data_share);
-       self.cvar_cl_accuracy_data_receive = boolean(self.cvar_cl_accuracy_data_receive);
 
        GetCvars_handleFloatOnce(s, f, cvar_cl_gunalign, "cl_gunalign");
        GetCvars_handleFloat(s, f, cvar_cl_allow_uid2name, "cl_allow_uid2name");
@@ -485,25 +480,27 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne
 {
        int i = weaponinfo.weapon;
        int d = 0;
+       bool allow_mutatorblocked = false;
 
-       if (!i)
+       if(!i)
                return 0;
 
-       if (g_lms || g_ca || allguns)
+       bool mutator_returnvalue = MUTATOR_CALLHOOK(WantWeapon, weaponinfo, d, allguns, allow_mutatorblocked);
+       d = ret_float;
+       allguns = want_allguns;
+       allow_mutatorblocked = false;
+
+       if(allguns)
        {
                if(weaponinfo.spawnflags & WEP_FLAG_NORMAL)
                        d = true;
                else
                        d = false;
        }
-       else if (g_cts)
-               d = (i == WEP_SHOTGUN.m_id);
-       else if (g_nexball)
-               d = 0; // weapon is set a few lines later
-       else
+       else if(!mutator_returnvalue)
                d = !(!weaponinfo.weaponstart);
 
-       if(!g_cts && (weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED)) // never default mutator blocked guns
+       if(!allow_mutatorblocked && (weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED)) // never default mutator blocked guns
                d = 0;
 
        float t = weaponinfo.weaponstartoverride;
@@ -545,11 +542,9 @@ void readplayerstartcvars()
        g_weaponarena_weapons = '0 0 0';
 
        s = cvar_string("g_weaponarena");
-       if (s == "0" || s == "")
-       {
-               if(g_ca || g_freezetag)
-                       s = "most";
-       }
+
+       MUTATOR_CALLHOOK(SetWeaponArena, s);
+       s = ret_string;
 
        if (s == "0" || s == "")
        {
@@ -601,7 +596,7 @@ void readplayerstartcvars()
                                if (e.netname == s)
                                {
                                        g_weaponarena_weapons |= WepSet_FromWeapon(j);
-                                       g_weaponarena_list = strcat(g_weaponarena_list, e.message, " & ");
+                                       g_weaponarena_list = strcat(g_weaponarena_list, e.m_name, " & ");
                                        break;
                                }
                        }
@@ -1654,10 +1649,7 @@ bool modeleffect_SendEntity(entity this, entity to, int sf)
 
 void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector ang, vector angv, float s0, float s2, float a, float t1, float t2)
 {
-       entity e;
-       float sz;
-       e = spawn();
-       e.classname = "modeleffect";
+       entity e = new(modeleffect);
        _setmodel(e, m);
        e.frame = f;
        setorigin(e, o);
@@ -1676,7 +1668,7 @@ void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector an
                e.scale2 = s2 / max6(-e.mins.x, -e.mins.y, -e.mins.z, e.maxs.x, e.maxs.y, e.maxs.z);
        else
                e.scale2 = -s2;
-       sz = max(e.scale, e.scale2);
+       float sz = max(e.scale, e.scale2);
        setsize(e, e.mins * sz, e.maxs * sz);
        Net_LinkEntity(e, false, 0.1, modeleffect_SendEntity);
 }