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;
+ }
return t;
}
- if(w & 1)
+/// 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(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED))
++ 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) && (it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & WEP_FLAG_HIDDEN))
++ 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_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;