]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/spawning.qc
Fix a minor typo in a comment
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / spawning.qc
index 8ade74aa40da69efb610d8c84c4a6a1e5e552835..0685062f58787167e8a463576ba98638becf72eb 100644 (file)
@@ -1,11 +1,12 @@
 #include "spawning.qh"
 
-#include "weaponsystem.qh"
-#include "../resources.qh"
-#include <server/mutators/_mod.qh>
+#include <common/resources/sv_resources.qh>
+#include <common/weapons/_all.qh>
 #include <server/items/items.qh>
 #include <server/items/spawning.qh>
-#include <common/weapons/_all.qh>
+#include <server/mutators/_mod.qh>
+#include <server/weapons/weaponsystem.qh>
+#include <server/world.qh>
 
 .bool m_isreplaced; ///< Holds whether the weapon has been replaced.
 
@@ -59,7 +60,9 @@ void weapon_defaultspawnfunc(entity this, Weapon wpn)
                                if(wep != WEP_Null)
                                {
                                        entity replacement = spawn();
-                                       copyentity(this, replacement);
+                                       Item_CopyFields(this, replacement);
+                                       // DO NOT USE, causes #2792
+                                       //copyentity(this, replacement);
                                        replacement.m_isreplaced = true;
                                        weapon_defaultspawnfunc(replacement, wep);
                                }
@@ -107,23 +110,13 @@ void weapon_defaultspawnfunc(entity this, Weapon wpn)
                        this.superweapons_finished = autocvar_g_balance_superweapons_time;
 
        // if we don't already have ammo, give us some ammo
+       // TODO: registry handles
        if ((wpn.ammo_type != RES_NONE) && !GetResource(this, wpn.ammo_type))
        {
                int ammo = 0;
-               if (this.count > 0)
-               {
-                       switch (wpn.netname)
-                       {
-                               case "arc":        ammo = cvar("g_balance_arc_beam_ammo");              break;
-                               case "devastator": ammo = cvar("g_balance_devastator_ammo");            break;
-                               case "machinegun": ammo = cvar("g_balance_machinegun_sustained_ammo");  break;
-                               case "minelayer":  ammo = cvar("g_balance_minelayer_ammo");             break;
-                               case "seeker":     ammo = cvar("g_balance_seeker_tag_ammo");            break;
-                               default:           ammo = cvar(strcat("g_balance_", wpn.netname, "_primary_ammo"));
-                       }
-
-                       ammo *= this.count;
-               }
+               if (q3compat && this.count > 0)
+                       ammo = this.count * GetAmmoConsumptionQ3(wpn.netname);
+                       // WEAPONTODO: magazines of MG, rifle and OK weapons are unaccounted for
                else
                {
                        switch (wpn.ammo_type)
@@ -161,6 +154,8 @@ void weapon_defaultspawnfunc(entity this, Weapon wpn)
 
        if(!this.owner)
                this.glowmod = wpn.wpcolor;
+       else
+               this.glowmod = colormapPaletteColor(this.owner.clientcolors & 0x0F, true);
 
        GameItem def = wpn.m_pickup;
        _StartItem(