]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/spawning.qc
Deprecate weapon_func
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / spawning.qc
index ea62fcf19eba9c05d08169e827357b879ef3ba9a..95d02a1d5f9ed094ea7c18c49de1ab16ff28484e 100644 (file)
@@ -1,17 +1,10 @@
-#if defined(CSQC)
-#elif defined(MENUQC)
-#elif defined(SVQC)
-       #include "../../dpdefs/progsdefs.qh"
-    #include "../../dpdefs/dpextensions.qh"
-    #include "../../common/weapons/weapons.qh"
-    #include "spawning.qh"
-    #include "weaponsystem.qh"
-    #include "../t_items.qh"
-    #include "../autocvars.qh"
-    #include "../constants.qh"
-    #include "../defs.qh"
-    #include "../mutators/mutators_include.qh"
-#endif
+#include "spawning.qh"
+#include "../_all.qh"
+
+#include "weaponsystem.qh"
+#include "../mutators/mutators_include.qh"
+#include "../t_items.qh"
+#include "../../common/weapons/all.qh"
 
 string W_Apply_Weaponreplace(string in)
 {
@@ -42,11 +35,10 @@ string W_Apply_Weaponreplace(string in)
 }
 
 void weapon_defaultspawnfunc(float wpn)
-{
+{SELFPARAM();
        entity e;
        float t;
        string s;
-       entity oldself;
        float i, j;
        int f;
 
@@ -62,9 +54,7 @@ void weapon_defaultspawnfunc(float wpn)
                }
 
                s = W_Apply_Weaponreplace(e.netname);
-               ret_string = s;
-               other = e;
-               MUTATOR_CALLHOOK(SetWeaponreplace);
+               MUTATOR_CALLHOOK(SetWeaponreplace, self, e, s);
                s = ret_string;
                if(s == "")
                {
@@ -76,7 +66,6 @@ void weapon_defaultspawnfunc(float wpn)
                if(t >= 2)
                {
                        self.team = --internalteam;
-                       oldself = self;
                        for(i = 1; i < t; ++i)
                        {
                                s = argv(i);
@@ -85,8 +74,8 @@ void weapon_defaultspawnfunc(float wpn)
                                        e = get_weaponinfo(j);
                                        if(e.netname == s)
                                        {
-                                               self = spawn();
-                                               copyentity(oldself, self);
+                                               setself(spawn());
+                                               copyentity(this, self);
                                                self.classname = "replacedweapon";
                                                weapon_defaultspawnfunc(j);
                                                break;
@@ -94,10 +83,10 @@ void weapon_defaultspawnfunc(float wpn)
                                }
                                if(j > WEP_LAST)
                                {
-                                       print("The weapon replace list for ", oldself.classname, " contains an unknown weapon ", s, ". Skipped.\n");
+                                       LOG_INFO("The weapon replace list for ", this.classname, " contains an unknown weapon ", s, ". Skipped.\n");
                                }
                        }
-                       self = oldself;
+                       setself(this);
                }
                if(t >= 1) // always the case!
                {
@@ -114,7 +103,7 @@ void weapon_defaultspawnfunc(float wpn)
                        }
                        if(j > WEP_LAST)
                        {
-                               print("The weapon replace list for ", self.classname, " contains an unknown weapon ", s, ". Skipped.\n");
+                               LOG_INFO("The weapon replace list for ", self.classname, " contains an unknown weapon ", s, ". Skipped.\n");
                        }
                }
                if(wpn == 0)
@@ -191,6 +180,6 @@ void weapon_defaultspawnfunc(float wpn)
        StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
        #if 0 // WEAPONTODO
        if (self.modelindex) // don't precache if self was removed
-               WEP_ACTION(e.weapon, WR_INIT);
+               _WEP_ACTION(e.weapon, WR_INIT);
        #endif
 }