]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added GivePlayerHealth and GivePlayerArmor.
authorLyberta <lyberta@lyberta.net>
Wed, 12 Apr 2017 05:35:00 +0000 (08:35 +0300)
committerLyberta <lyberta@lyberta.net>
Wed, 12 Apr 2017 05:35:00 +0000 (08:35 +0300)
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh

index 3298e7fb035637eeb7ebca73ca2c1e2d241d8950..ec237c7d631fd68fe168cfb5dfb96b4933968a3b 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 GivePlayerHealth(entity player, float amount)
+{
+       if (amount == 0)
+       {
+               return;
+       }
+       player.health = bound(player.health, player.health + amount,
+                g_pickup_healthmega_max);
+       player.pauserothealth_finished = max(player.pauserothealth_finished, time +
+               autocvar_g_balance_pause_health_rot);
+}
+
+void GivePlayerArmor(entity player, float amount)
+{
+       if (amount == 0)
+       {
+               return;
+       }
+       player.armorvalue = bound(player.armorvalue, player.armorvalue + amount,
+                g_pickup_armormega_max);
+       player.pauserotarmor_finished = max(player.pauserotarmor_finished, time +
+               autocvar_g_balance_pause_armor_rot);
+}
+
 void GivePlayerShells(entity player, float amount)
 {
        player.ammo_shells = bound(player.ammo_shells, player.ammo_shells + amount,
index ca03b8a04000ac8900230d403b7b3111032a74fc..6ce04b830c1724ddee9412a036722bfa0aea7482 100644 (file)
@@ -82,25 +82,37 @@ void Item_ScheduleRespawn(entity e);
 
 void Item_ScheduleInitialRespawn(entity e);
 
-/// \brief Gives player shells.
+/// \brief Gives health to the player.
+/// \param[in,out] player Player to give health to.
+/// \param[in] amount Amount of health to give.
+/// \return No return.
+void GivePlayerHealth(entity player, float amount);
+
+/// \brief Gives armor to the player.
+/// \param[in,out] player Player to give armor to.
+/// \param[in] amount Amount of armor to give.
+/// \return No return.
+void GivePlayerArmor(entity player, float amount);
+
+/// \brief Gives shells to the player.
 /// \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.
+/// \brief Gives bullets to the player.
 /// \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.
+/// \brief Gives rockets to the player.
 /// \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.
+/// \brief Gives cells to the player.
 /// \param[in,out] player Player to give cells to.
 /// \param[in] amount Amount of cells to give.
 /// \return No return.