]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/weaponarena_available
authorMario <mario@smbclan.net>
Sun, 11 Aug 2019 11:32:33 +0000 (21:32 +1000)
committerMario <mario@smbclan.net>
Sun, 11 Aug 2019 11:32:33 +0000 (21:32 +1000)
qcsrc/common/t_items.qc
qcsrc/server/miscfunctions.qc
xonotic-server.cfg

index 466b38311214c20d0aa66baefa1a7d35fcf93c98..8573e4af0f9ba26f37e19ed7d84fb81f552ce3eb 100644 (file)
@@ -1249,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;
@@ -1858,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(!g_weaponarena && 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)
index 167a75ae2c371ad5e833099cc962ada6889affac..cdf3371ae96bdaadd7885d64710f11e71844cbef 100644 (file)
@@ -522,6 +522,22 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne
        return t;
 }
 
+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;
+       start_weapons = g_weaponarena_weapons;
+}
+
 void readplayerstartcvars()
 {
        float i, t;
@@ -587,6 +603,18 @@ void readplayerstartcvars()
                                g_weaponarena_weapons |= (it.m_wepset);
                });
        }
+       else if (s == "available")
+       {
+               g_weaponarena = 2;
+               g_weaponarena_list = "Most Weapons";
+               // include weapons the player would start with
+               FOREACH(Weapons, it != WEP_Null, {
+                       int w = want_weapon(it, false);
+                       if(w & 1)
+                               g_weaponarena_weapons |= (it.m_wepset);
+               });
+               InitializeEntity(NULL, weaponarena_available_update, INITPRIO_FINDTARGET);
+       }
        else if (s == "none")
        {
                g_weaponarena = 1;
index d261e262eab2a9351d4542b7969afa1fbd72f680..993d77e4de5d2af8b2e6d202583dac17172ef3ba 100644 (file)
@@ -195,7 +195,7 @@ set g_pickup_items -1 "if set to 0 all items (health, armor, ammo, weapons...) a
 set g_pickup_respawntime_scaling_reciprocal 0 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `reciprocal` (with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player*"
 set g_pickup_respawntime_scaling_offset 0 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `offset` offsets the curve left or right - the results are not intuitive and I recommend plotting the respawn time and the number of items per player to see what's happening"
 set g_pickup_respawntime_scaling_linear 1 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `linear` can be used to simply scale the respawn time linearly"
-set g_weaponarena "0"  "put in a list of weapons to enable a weapon arena mode, or try \"all\" or \"most\""
+set g_weaponarena "0"  "put in a list of weapons to enable a weapon arena mode, or try \"all\" or \"most\" or \"available\""
 set g_weaponarena_random "0"   "if set to a number, only that weapon count is given on every spawn (randomly)"
 set g_weaponarena_random_with_blaster "1"      "additionally, always provide the blaster in random weapon arena games"
 set g_spawnpoints_auto_move_out_of_solid 0 "if set to 1 you will see a warning if a spawn point was placed inside a solid"