GiveResource(receiver, GetResourceType(resource_property), amount);
}
-void GivePlayerRandomWeapons(entity player, int num_weapons,
- string weapon_names, float shells, float bullets, float rockets,
- float cells, float plasma)
+void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names,
+ float shells, float bullets, float rockets, float cells, float plasma)
{
if (num_weapons == 0)
{
FOREACH(Weapons, it != WEP_Null,
{
// Finding a weapon which player doesn't have.
- if (!(player.weapons & it.m_wepset) && (it.netname == weapon))
+ if (!(receiver.weapons & it.m_wepset) && (it.netname == weapon))
{
RandomSelection_AddEnt(it, 1, 1);
break;
{
return;
}
- player.weapons |= RandomSelection_chosen_ent.m_wepset;
+ receiver.weapons |= RandomSelection_chosen_ent.m_wepset;
switch (RandomSelection_chosen_ent.ammo_field)
{
case (ammo_shells):
{
- if (player.ammo_shells != 0)
+ if (receiver.ammo_shells != 0)
{
break;
}
- GivePlayerResource(player, RESOURCE_SHELLS, shells);
+ GiveResource(receiver, RESOURCE_SHELLS, shells);
break;
}
case (ammo_nails):
{
- if (player.ammo_nails != 0)
+ if (receiver.ammo_nails != 0)
{
break;
}
- GivePlayerResource(player, RESOURCE_BULLETS, bullets);
+ GiveResource(receiver, RESOURCE_BULLETS, bullets);
break;
}
case (ammo_rockets):
{
- if (player.ammo_rockets != 0)
+ if (receiver.ammo_rockets != 0)
{
break;
}
- GivePlayerResource(player, RESOURCE_ROCKETS, rockets);
+ GiveResource(receiver, RESOURCE_ROCKETS, rockets);
break;
}
case (ammo_cells):
{
- if (player.ammo_cells != 0)
+ if (receiver.ammo_cells != 0)
{
break;
}
- GivePlayerResource(player, RESOURCE_CELLS, cells);
+ GiveResource(receiver, RESOURCE_CELLS, cells);
break;
}
case (ammo_plasma):
{
- if (player.ammo_plasma != 0)
+ if (receiver.ammo_plasma != 0)
{
break;
}
- GivePlayerResource(player, RESOURCE_PLASMA, plasma);
+ GiveResource(receiver, RESOURCE_PLASMA, plasma);
break;
}
}
void GiveResourceViaProperty(entity receiver, .float resource_property,
float amount);
-/// \brief Give several random weapons and ammo to the player.
-/// \param[in,out] player Player to give weapons to.
+/// \brief Give several random weapons and ammo to the entity.
+/// \param[in,out] receiver Entity 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.
+/// \param[in] plasma Amount of plasma to give with plasma-based weapon.
/// \return No return.
-void GivePlayerRandomWeapons(entity player, int num_weapons,
- string weapon_names, float shells, float bullets, float rockets,
- float cells, float plasma);
+void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names,
+ float shells, float bullets, float rockets, float cells, float plasma);
float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax);
this.health = start_health;
this.armorvalue = start_armorvalue;
this.weapons = start_weapons;
- GivePlayerRandomWeapons(this, random_start_weapons_count,
+ GiveRandomWeapons(this, random_start_weapons_count,
cvar_string("g_random_start_weapons"), random_start_shells,
random_start_bullets, random_start_rockets, random_start_cells,
random_start_plasma);