]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/resources/cl_resources.qh
Merge branch 'master' into terencehill/replicatevars_enhancements
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / resources / cl_resources.qh
1 #pragma once
2
3 /// \file
4 /// \brief Header file that describes the resource system.
5 /// \copyright GNU GPLv2 or any later version.
6
7 #include <common/resources/resources.qh>
8
9 // ============================ Public API ====================================
10
11 /// \brief Returns the current amount of resource the given entity has.
12 /// \param[in] e Entity to check.
13 /// \param[in] res_type Type of the resource (a RES_* constant).
14 /// \return Current amount of resource the given entity has.
15 float GetResource(entity e, Resource res_type);
16
17 /// \brief Sets the resource amount of an entity without calling any hooks.
18 /// \param[in,out] e Entity to adjust.
19 /// \param[in] res_type Type of the resource (a RES_* constant).
20 /// \param[in] amount Amount of resource to set.
21 /// \return Boolean for whether the ammo amount was changed
22 bool SetResourceExplicit(entity e, Resource res_type, float amount);
23
24 /// \brief Sets the current amount of resource the given entity will have.
25 /// \param[in,out] e Entity to adjust.
26 /// \param[in] res_type Type of the resource (a RES_* constant).
27 /// \param[in] amount Amount of resource to set.
28 /// \return No return.
29 void SetResource(entity e, Resource res_type, float amount);
30
31 /// \brief Takes an entity some resource.
32 /// \param[in,out] receiver Entity to take resource from.
33 /// \param[in] res_type Type of the resource (a RES_* constant).
34 /// \param[in] amount Amount of resource to take.
35 /// \return No return.
36 void TakeResource(entity receiver, Resource res_type, float amount);
37
38 /// \brief Takes an entity some resource but not less than a limit.
39 /// \param[in,out] receiver Entity to take resource from.
40 /// \param[in] res_type Type of the resource (a RES_* constant).
41 /// \param[in] amount Amount of resource to take.
42 /// \param[in] limit Limit of resources to take.
43 /// \return No return.
44 void TakeResourceWithLimit(entity receiver, Resource res_type, float amount, float limit);