From e5997c301421c84ba752033f339138652f7f76f4 Mon Sep 17 00:00:00 2001 From: Lyberta Date: Sat, 26 Aug 2017 19:08:04 +0300 Subject: [PATCH 1/1] Added GivePlayerFuel. --- qcsrc/common/t_items.qc | 12 ++++++++++++ qcsrc/common/t_items.qh | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 6a6aaad548..709cccd430 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -715,6 +715,18 @@ void GivePlayerAmmo(entity player, .float ammotype, float amount) min(maxvalue, ITEM_COUNT_HARD_LIMIT)); } +void GivePlayerFuel(entity player, float amount) +{ + if (amount == 0) + { + return; + } + player.ammo_fuel = bound(player.ammo_fuel, player.ammo_fuel + amount, + min(g_pickup_fuel_max, ITEM_COUNT_HARD_LIMIT)); + player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + + autocvar_g_balance_pause_fuel_rot); +} + float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode) { if (!item.(ammotype)) diff --git a/qcsrc/common/t_items.qh b/qcsrc/common/t_items.qh index 331d3ac8c3..777258939e 100644 --- a/qcsrc/common/t_items.qh +++ b/qcsrc/common/t_items.qh @@ -105,6 +105,12 @@ void GivePlayerArmor(entity player, float amount); /// \return No return. void GivePlayerAmmo(entity player, .float ammotype, float amount); +/// \brief Gives fuel to the player. +/// \param[in,out] player Player to give fuel to. +/// \param[in] amount Amount of fuel to give. +/// \return No return. +void GivePlayerFuel(entity player, float amount); + float ITEM_MODE_NONE = 0; float ITEM_MODE_HEALTH = 1; float ITEM_MODE_ARMOR = 2; -- 2.39.2