]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added GivePlayerFuel.
authorLyberta <lyberta@lyberta.net>
Sat, 26 Aug 2017 16:08:04 +0000 (19:08 +0300)
committerLyberta <lyberta@lyberta.net>
Sat, 26 Aug 2017 16:08:04 +0000 (19:08 +0300)
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh

index 6a6aaad548158e1187e27b155070fdc35f188c99..709cccd430f50a02d57bfa1cc65a6bceee608e66 100644 (file)
@@ -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))
index 331d3ac8c3edf342571aae9204e14cc7b5ed932c..777258939e2969f99576490dce76c62e45934be8 100644 (file)
@@ -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;