]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/spawning.qc
Merge branch 'terencehill/il_loop_fix' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / spawning.qc
index ec9952fff27039ee857fdc9b036ffbc6d65618e0..dc7b110e2cc2857da219b18290871de34cc515f0 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,7 @@ void weapon_defaultspawnfunc(entity this, Weapon wpn)
                                if(wep != WEP_Null)
                                {
                                        entity replacement = spawn();
-                                       copyentity(this, replacement);
+                                       Item_CopyFields(this, replacement);
                                        replacement.m_isreplaced = true;
                                        weapon_defaultspawnfunc(replacement, wep);
                                }
@@ -107,11 +108,12 @@ 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)
-                       ammo = this.count * GetAmmoConsumptionPrimary(wpn.netname);
+               if (q3compat && this.count > 0)
+                       ammo = this.count * GetAmmoConsumptionQ3(wpn.netname);
                        // WEAPONTODO: magazines of MG, rifle and OK weapons are unaccounted for
                else
                {
@@ -150,6 +152,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(