]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Lyberta/URS2' into Lyberta/RandomStartWeapons
authorLyberta <lyberta@lyberta.net>
Mon, 28 Aug 2017 04:45:39 +0000 (07:45 +0300)
committerLyberta <lyberta@lyberta.net>
Mon, 28 Aug 2017 04:45:39 +0000 (07:45 +0300)
1  2 
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/server/client.qc

index 0f1e621610521eaa3141179c930e96819c2ba389,95f315ad2714e0cf1ddbaedac0ecf26a56e299cc..5f545151b1eb88d201217bef61e64f237221ca5f
@@@ -791,90 -835,9 +835,90 @@@ void GivePlayerArmor(entity player, flo
  
  void GivePlayerFuel(entity player, float amount)
  {
-       GivePlayerResource(player, ammo_fuel, amount);
+       GivePlayerResource(player, RESOURCE_FUEL, amount);
  }
  
 +void GivePlayerRandomWeapons(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 Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax)
  {
        if (!item.(ammotype))
Simple merge
Simple merge