From: Lyberta Date: Fri, 22 Sep 2017 00:32:33 +0000 (+0300) Subject: GunGame added g_gg_kills_per_weapon. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=88f862d57c166104f293ab76513885589a6898e3;p=xonotic%2Fxonotic-data.pk3dir.git GunGame added g_gg_kills_per_weapon. --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index ab3b84b63..dafe7759e 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -537,3 +537,4 @@ set g_invasion_type 0 "type of invasion mode - 0: round-based, 1: hunting, 2: co // ========= set g_gg 0 "GunGame: Kill players with all weapons" set g_gg_weapons "vortex mortar machinegun hagar arc electro devastator crylink shotgun blaster" +set g_gg_kills_per_weapon 3 "Number of kills needed to advance to the next weapon" diff --git a/qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qc b/qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qc index b387a5bd9..b2db39b56 100644 --- a/qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qc +++ b/qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qc @@ -11,6 +11,9 @@ const string GUNGAME_WEAPONS = "g_gg_weapons"; //======================= Global variables ==================================== +/// \brief Number of kills needed to advance to the next weapon. +int autocvar_g_gg_kills_per_weapon; + int gungame_maxlevel; ///< Player who reaches this level wins. string gungame_weapons; ///< Holds weapons corresponding to levels. @@ -47,7 +50,8 @@ void GunGame_Reset() strunzone(gungame_weapons); } gungame_weapons = strzone(cvar_string(GUNGAME_WEAPONS)); - gungame_maxlevel = tokenize_console(gungame_weapons); + gungame_maxlevel = tokenize_console(gungame_weapons) * + autocvar_g_gg_kills_per_weapon; if (gungame_maxlevel == 0) { error("GunGame: Invalid weapon configuration."); @@ -66,7 +70,7 @@ entity GunGame_GetWeapon(int level) return NULL; } tokenize_console(gungame_weapons); - string weapon = argv(level); + string weapon = argv(floor(level / autocvar_g_gg_kills_per_weapon)); FOREACH(Weapons, it != WEP_Null, { if (it.netname == weapon) diff --git a/qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qh b/qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qh index 4fe8f90a3..44df2e326 100644 --- a/qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qh +++ b/qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qh @@ -5,8 +5,6 @@ #pragma once -//#include "../gamemode.qh" - /// \brief Initializes global data for the gametype. /// \return No return. void GunGame_Initialize();