]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/t_items.qc
Experimental 'available' mode for weaponarena, includes spawn weapons and falls back...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / t_items.qc
index bce35c7dd78f5a3c56e53bb9f754bb65ec49a9a7..8573e4af0f9ba26f37e19ed7d84fb81f552ce3eb 100644 (file)
@@ -743,23 +743,16 @@ bool Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax)
        if (item.spawnshieldtime)
        {
                if ((player_amount >= ammomax) && (item.pickup_anyway <= 0))
-               {
                        return false;
-               }
-               if (amount < 0)
-                       TakeResourceWithLimit(player, res_type, -amount, ammomax);
-               else
-                       GiveResourceWithLimit(player, res_type, amount, ammomax);
-               return true;
        }
-       if (g_weapon_stay != 2)
-       {
+       else if (g_weapon_stay == 2)
+               ammomax = min(amount, ammomax);
+       else
                return false;
-       }
        if (amount < 0)
-               TakeResourceWithLimit(player, res_type, -amount, min(amount, ammomax));
+               TakeResourceWithLimit(player, res_type, -amount, ammomax);
        else
-               GiveResourceWithLimit(player, res_type, amount, min(amount, ammomax));
+               GiveResourceWithLimit(player, res_type, amount, ammomax);
        return true;
 }
 
@@ -1222,6 +1215,9 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                return;
        }
 
+       precache_model(this.model);
+       precache_sound(this.item_pickupsound);
+
        if (Item_IsLoot(this))
        {
                this.reset = SUB_Remove;
@@ -1253,6 +1249,8 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        {
                if(!have_pickup_item(this))
                {
+                       if(g_weaponarena == 2 && weaponid)
+                               weaponsInMap |= WepSet_FromWeapon(Weapons_from(weaponid));
                        startitem_failed = true;
                        delete(this);
                        return;
@@ -1313,9 +1311,6 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
 
                weaponsInMap |= WepSet_FromWeapon(Weapons_from(weaponid));
 
-               precache_model(this.model);
-               precache_sound(this.item_pickupsound);
-
                if (   def.instanceOfPowerup
                        || def.instanceOfWeaponPickup
                        || (def.instanceOfHealth && def != ITEM_HealthSmall)
@@ -1347,12 +1342,13 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                        this.ItemStatus |= ITS_ANIMATE2;
        }
 
+       if(Item_IsLoot(this))
+               this.gravity = 1;
+
        if(def.instanceOfWeaponPickup)
        {
                if (!Item_IsLoot(this)) // if dropped, colormap is already set up nicely
                        this.colormap = 1024; // color shirt=0 pants=0 grey
-               else
-                       this.gravity = 1;
                if (!(this.spawnflags & 1024))
                        this.ItemStatus |= ITS_ANIMATE1;
                this.SendFlags |= ISF_COLORMAP;
@@ -1864,7 +1860,7 @@ float GiveItems(entity e, float beginarg, float endarg)
        POSTGIVE_RES_ROT(e, RES_HEALTH, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_MEGAHEALTH, SND_Null);
 
        if(e.superweapons_finished <= 0)
-               if(STAT(WEAPONS, e) & WEPSET_SUPERWEAPONS)
+               if(!g_weaponarena && (STAT(WEAPONS, e) & WEPSET_SUPERWEAPONS))
                        e.superweapons_finished = autocvar_g_balance_superweapons_time;
 
        if(e.strength_finished <= 0)