From: Martin Taibr Date: Sun, 25 Aug 2019 23:00:59 +0000 (+0200) Subject: Merge branch 'master' into martin-t/available X-Git-Tag: xonotic-v0.8.5~1360^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=91bd86fc694af8c3555cc465d4d75250a8528b5e;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into martin-t/available --- 91bd86fc694af8c3555cc465d4d75250a8528b5e diff --cc qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index 95f760c47,cf2821844..4721cb380 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@@ -497,6 -502,14 +497,14 @@@ MUTATOR_HOOKFUNCTION(ca, GetPlayerStatu MUTATOR_HOOKFUNCTION(ca, SetWeaponArena) { - // most weapons arena - if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") M_ARGV(0, string) = "most"; + if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") + M_ARGV(0, string) = autocvar_g_ca_weaponarena; } + + MUTATOR_HOOKFUNCTION(ca, SV_ParseServerCommand) + { + string cmd_name = M_ARGV(0, string); + if (cmd_name == "shuffleteams") + shuffleteams_on_reset_map = !allowed_to_spawn; + return false; + } diff --cc qcsrc/server/miscfunctions.qc index 23b2d6693,854e39781..a59f4afa2 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@@ -521,87 -525,6 +524,87 @@@ float want_weapon(entity weaponinfo, fl return t; } +/// Weapons the player normally starts with outside weapon arena. +WepSet weapons_start() +{ + WepSet ret = '0 0 0'; + FOREACH(Weapons, it != WEP_Null, { + int w = want_weapon(it, false); - if(w & 1) ++ if (w & 1) + ret |= it.m_wepset; + }); + return ret; +} + +WepSet weapons_all() +{ + WepSet ret = '0 0 0'; + FOREACH(Weapons, it != WEP_Null, { - if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED)) ++ if (!(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK))) + ret |= it.m_wepset; + }); + return ret; +} + +WepSet weapons_devall() +{ + WepSet ret = '0 0 0'; + FOREACH(Weapons, it != WEP_Null, + { + ret |= it.m_wepset; + }); + return ret; +} + +WepSet weapons_most() +{ + WepSet ret = '0 0 0'; + FOREACH(Weapons, it != WEP_Null, { - if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && (it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & WEP_FLAG_HIDDEN)) ++ if ((it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK))) + ret |= it.m_wepset; + }); + return ret; +} + +void weaponarena_available_all_update(entity this) +{ + if (weaponsInMapAll) + { + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_start() | (weaponsInMapAll & weapons_all()); + } + else + { + // if no weapons are available on the map, just fall back to all weapons arena + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_all(); + } +} + +void weaponarena_available_devall_update(entity this) +{ + if (weaponsInMapAll) + { + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_start() | weaponsInMapAll; + } + else + { + // if no weapons are available on the map, just fall back to devall weapons arena + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_devall(); + } +} + +void weaponarena_available_most_update(entity this) +{ + if (weaponsInMapAll) + { + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_start() | (weaponsInMapAll & weapons_most()); + } + else + { + // if no weapons are available on the map, just fall back to most weapons arena + start_weapons = warmup_start_weapons = g_weaponarena_weapons = weapons_most(); + } +} + void readplayerstartcvars() { float i, t;