]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix weaponarena available including hidden weapons, also fix available weapons not...
authorMario <mario@smbclan.net>
Sat, 24 Aug 2019 18:07:29 +0000 (04:07 +1000)
committerMario <mario@smbclan.net>
Sat, 24 Aug 2019 18:07:29 +0000 (04:07 +1000)
qcsrc/common/t_items.qc
qcsrc/server/defs.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/weapons/spawning.qc

index 8573e4af0f9ba26f37e19ed7d84fb81f552ce3eb..429a013b185ea2e6a1c8240b35d904db1ef0a955 100644 (file)
@@ -1249,8 +1249,6 @@ 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;
index b52649a34ead3389310bb9ef544b4c3e4e1bc3d2..6e1020c4386e98b5bbc1c9b4e15bce60932bb19c 100644 (file)
@@ -191,7 +191,8 @@ void FixIntermissionClient(entity e);
 void FixClientCvars(entity e);
 
 // WEAPONTODO: remove this
-//WepSet weaponsInMap;
+//WepSet weaponsInMap; // lists all the weapons actually spawned in the map, does not include filtered items
+vector weaponsInMapAll; // holds a list of all the weapons that have been placed by the mapper (weaponreplace applied), ignores most filters
 
 .float respawn_countdown; // next number to count
 
index cdf3371ae96bdaadd7885d64710f11e71844cbef..273b854ce966e96807a01414fc2596fcbf0a90ce 100644 (file)
@@ -524,18 +524,15 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne
 
 void weaponarena_available_update(entity this)
 {
-       if(!weaponsInMap)
-       {
-               // if no weapons are available, just fall back to most weapons arena
-               FOREACH(Weapons, it != WEP_Null, {
-                       if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && (it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & WEP_FLAG_HIDDEN))
-                               g_weaponarena_weapons |= (it.m_wepset);
-               });
-               start_weapons = g_weaponarena_weapons;
-               return;
-       }
-       g_weaponarena_weapons |= weaponsInMap;
+       FOREACH(Weapons, it != WEP_Null, {
+               // if no weapons are available, just fall back to normal weapons (most weapons arena)
+               bool wep_available = ((weaponsInMapAll) ? !!(weaponsInMapAll & WepSet_FromWeapon(it)) : (it.spawnflags & WEP_FLAG_NORMAL));
+               if(wep_available && !(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && !(it.spawnflags & WEP_FLAG_HIDDEN))
+                       g_weaponarena_weapons |= WepSet_FromWeapon(it);
+       });
        start_weapons = g_weaponarena_weapons;
+       if(warmup_stage)
+               warmup_start_weapons = start_weapons;
 }
 
 void readplayerstartcvars()
index ba17d3f1f893bdb2c42a7aa89fa4e674867ba548..d5c79d085685f4c494934b15bd13050ef94fde76 100644 (file)
@@ -79,6 +79,9 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
                }
        }
 
+       if(!Item_IsLoot(this))
+               weaponsInMapAll |= WepSet_FromWeapon(wpn);
+
        if (!Item_IsDefinitionAllowed(wpn.m_pickup))
        {
                delete(this);