]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added GivePlayerAmmo functions.
authorLyberta <lyberta@lyberta.net>
Wed, 12 Apr 2017 04:36:53 +0000 (07:36 +0300)
committerLyberta <lyberta@lyberta.net>
Wed, 12 Apr 2017 04:36:53 +0000 (07:36 +0300)
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh

index 3151d7cdb1c86fb696128d439ef6a38213cff553..3298e7fb035637eeb7ebca73ca2c1e2d241d8950 100644 (file)
@@ -641,6 +641,30 @@ void Item_ScheduleInitialRespawn(entity e)
        Item_ScheduleRespawnIn(e, max(0, game_starttime - time) + ((e.respawntimestart) ? e.respawntimestart : ITEM_RESPAWNTIME_INITIAL(e)));
 }
 
+void GivePlayerShells(entity player, float amount)
+{
+       player.ammo_shells = bound(player.ammo_shells, player.ammo_shells + amount,
+               g_pickup_shells_max);
+}
+
+void GivePlayerBullets(entity player, float amount)
+{
+       player.ammo_nails = bound(player.ammo_nails, player.ammo_nails + amount,
+               g_pickup_nails_max);
+}
+
+void GivePlayerRockets(entity player, float amount)
+{
+       player.ammo_rockets = bound(player.ammo_rockets, player.ammo_rockets +
+               amount, g_pickup_rockets_max);
+}
+
+void GivePlayerCells(entity player, float amount)
+{
+       player.ammo_cells = bound(player.ammo_cells, player.ammo_cells + amount,
+               g_pickup_cells_max);
+}
+
 float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
 {
        if (!item.(ammotype))
index 1b2293bcff0651d442032c328d7a0455783adb3b..ca03b8a04000ac8900230d403b7b3111032a74fc 100644 (file)
@@ -81,6 +81,31 @@ void Item_ScheduleRespawnIn(entity e, float t);
 void Item_ScheduleRespawn(entity e);
 
 void Item_ScheduleInitialRespawn(entity e);
+
+/// \brief Gives player shells.
+/// \param[in,out] player Player to give shells to.
+/// \param[in] amount Amount of shells to give.
+/// \return No return.
+void GivePlayerShells(entity player, float amount);
+
+/// \brief Gives player bullets.
+/// \param[in,out] player Player to give bullets to.
+/// \param[in] amount Amount of bullets to give.
+/// \return No return.
+void GivePlayerBullets(entity player, float amount);
+
+/// \brief Gives player rockets.
+/// \param[in,out] player Player to give rockets to.
+/// \param[in] amount Amount of rockets to give.
+/// \return No return.
+void GivePlayerRockets(entity player, float amount);
+
+/// \brief Gives player cells.
+/// \param[in,out] player Player to give cells to.
+/// \param[in] amount Amount of cells to give.
+/// \return No return.
+void GivePlayerCells(entity player, float amount);
+
 float ITEM_MODE_NONE = 0;
 float ITEM_MODE_HEALTH = 1;
 float ITEM_MODE_ARMOR = 2;