]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Player templates: Use GivePlayerRandomWeapons.
authorLyberta <lyberta@lyberta.net>
Wed, 16 Aug 2017 02:36:00 +0000 (05:36 +0300)
committerLyberta <lyberta@lyberta.net>
Wed, 16 Aug 2017 02:36:00 +0000 (05:36 +0300)
qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc
qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qh

index 403eff927ea6f25df60a78989e661168aa6bbc43..92cdc253780093ecb0303fa4d4e8ce637373b8cc 100644 (file)
@@ -207,87 +207,6 @@ string PlayerTemplate_GetStringValue(string template, string variable)
        return cvar_string(fullname);
 }
 
-void PlayerTemplate_GiveRandomWeapons(entity player, int num_weapons,
-       string weapon_names, float shells, float bullets, float rockets,
-       float cells, float plasma)
-{
-       if (num_weapons == 0)
-       {
-               return;
-       }
-       int num_potential_weapons = tokenize_console(weapon_names);
-       for (int i = 0; i < num_weapons; ++i)
-       {
-               RandomSelection_Init();
-               for (int j = 0; j < num_potential_weapons; ++j)
-               {
-                       string weapon = argv(j);
-                       FOREACH(Weapons, it != WEP_Null,
-                       {
-                               // Finding a weapon which player doesn't have.
-                               if (!(player.weapons & it.m_wepset) && (it.netname == weapon))
-                               {
-                                       RandomSelection_AddEnt(it, 1, 1);
-                                       break;
-                               }
-                       });
-               }
-               if (RandomSelection_chosen_ent == NULL)
-               {
-                       return;
-               }
-               player.weapons |= RandomSelection_chosen_ent.m_wepset;
-               switch (RandomSelection_chosen_ent.ammo_field)
-               {
-                       case (ammo_shells):
-                       {
-                               if (player.ammo_shells != 0)
-                               {
-                                       break;
-                               }
-                               GivePlayerAmmo(player, ammo_shells, shells);
-                               break;
-                       }
-                       case (ammo_nails):
-                       {
-                               if (player.ammo_nails != 0)
-                               {
-                                       break;
-                               }
-                               GivePlayerAmmo(player, ammo_nails, bullets);
-                               break;
-                       }
-                       case (ammo_rockets):
-                       {
-                               if (player.ammo_rockets != 0)
-                               {
-                                       break;
-                               }
-                               GivePlayerAmmo(player, ammo_rockets, rockets);
-                               break;
-                       }
-                       case (ammo_cells):
-                       {
-                               if (player.ammo_cells != 0)
-                               {
-                                       break;
-                               }
-                               GivePlayerAmmo(player, ammo_cells, cells);
-                               break;
-                       }
-                       case (ammo_plasma):
-                       {
-                               if (player.ammo_plasma != 0)
-                               {
-                                       break;
-                               }
-                               GivePlayerAmmo(player, ammo_plasma, plasma);
-                               break;
-                       }
-               }
-       }
-}
-
 float PlayerTemplate_GivePlayerItem(entity player, string template,
        string variable)
 {
@@ -410,7 +329,7 @@ void PlayerTemplate_PlayerSpawn(entity player, string template)
        }
        if (!warmup_stage)
        {
-               PlayerTemplate_GiveRandomWeapons(player,
+               GivePlayerRandomWeapons(player,
                        PlayerTemplate_GetFloatValue(template, "num_random_start_weapons"),
                        PlayerTemplate_GetStringValue(template, "random_start_weapons"),
                        PlayerTemplate_GetFloatValue(template, "random_start_shells"),
index 2ec2ebe6b48e3a2b4678612d8f2b0cf5a5a156bc..5d93700accdd4f1f96437fefe39ffe3a67a77529 100644 (file)
@@ -40,19 +40,6 @@ float PlayerTemplate_GetFloatValue(string template, string variable);
 /// \return Value of the variable.
 string PlayerTemplate_GetStringValue(string template, string variable);
 
-/// \brief Give several random weapons and ammo to the player.
-/// \param[in,out] player Player to give weapons to.
-/// \param[in] num_weapons Number of weapons to give.
-/// \param[in] weapon_names Names of weapons to give separated by spaces.
-/// \param[in] shells Amount of shells to give with shell-based weapon.
-/// \param[in] bullets Amount of bullets to give with bullet-based weapon.
-/// \param[in] rockets Amount of rockets to give with rocket-based weapon.
-/// \param[in] cells Amount of cells to give with cell-based weapon.
-/// \param[in] cells Amount of plasma to give with plasma-based weapon.
-void PlayerTemplate_GiveRandomWeapons(entity player, int num_weapons,
-       string weapon_names, float shells, float bullets, float rockets,
-       float cells, float plasma);
-
 /// \brief Gives player items according to the given template's variable.
 /// \param[in] player Player to give items to.
 /// \param[in] template Name of the template.