]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
GunGame added g_gg_kills_per_weapon.
authorLyberta <lyberta@lyberta.net>
Fri, 22 Sep 2017 00:32:33 +0000 (03:32 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 22 Sep 2017 00:32:33 +0000 (03:32 +0300)
gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qc
qcsrc/common/gamemodes/gamemode/gungame/sv_gungame.qh

index ab3b84b63e97407044269ca763f06f8ecd73e5db..dafe7759e466cceb7ddcc4de3de184bf779e2543 100644 (file)
@@ -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"
index b387a5bd966cb935a03c1bc6d28a0111925e3576..b2db39b56a2f9513aeb16d15fb1abe8be8580335 100644 (file)
@@ -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)
index 4fe8f90a382a9741ad99e56e6f6954090ef5d695..44df2e3263c22b866b71cf4aa37d5e96e738692e 100644 (file)
@@ -5,8 +5,6 @@
 
 #pragma once
 
-//#include "../gamemode.qh"
-
 /// \brief Initializes global data for the gametype.
 /// \return No return.
 void GunGame_Initialize();