From: Mario Date: Sat, 20 Jul 2019 08:46:48 +0000 (+1000) Subject: Experimental 'available' mode for weaponarena, includes spawn weapons and falls back... X-Git-Tag: xonotic-v0.8.5~1360^2~12 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=8d9b7f923d981be7330d7f70f1c52ee2de000bf7 Experimental 'available' mode for weaponarena, includes spawn weapons and falls back to most weapons arena if no weapons are found on the map --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 466b383112..8573e4af0f 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -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) diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 8be233b670..ebeb961270 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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; diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 463df7224e..695d2ec0b1 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -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"