]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/resources.qh
Moved USR into separate file.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / resources.qh
1 #pragma once
2
3 /// \brief Unconditional maximum amount of resources the player can have.
4 const int RESOURCE_AMOUNT_HARD_LIMIT = 999;
5
6 /// \brief Describes the available resource types.
7 enum
8 {
9         RESOURCE_HEALTH, ///< Health.
10         RESOURCE_ARMOR, ///< Armor.
11         RESOURCE_SHELLS, ///< Shells (used by shotgun).
12         RESOURCE_BULLETS, ///< Bullets (used by machinegun and rifle)
13         RESOURCE_ROCKETS, ///< Rockets (used by mortar, hagar, devastator, etc).
14         RESOURCE_CELLS, ///< Cells (used by electro, crylink, vortex, etc)
15         RESOURCE_PLASMA, ///< Plasma (unused).
16         RESOURCE_FUEL ///< Fuel (used by jetpack).
17 };
18
19 // ============================ Public API ====================================
20
21 /// \brief Returns the maximum amount of the given resource.
22 /// \param[in] e Entity to check.
23 /// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
24 /// \return Maximum amount of the given resource.
25 float GetResourceLimit(entity e, int resource_type);
26
27 /// \brief Gives player a resource such as health, armor or ammo.
28 /// \param[in,out] receiver Entity to give resource to.
29 /// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
30 /// \param[in] amount Amount of resource to give.
31 /// \return No return.
32 void GiveResource(entity receiver, int resource_type, float amount);
33
34 // ===================== Legacy and/or internal API ===========================
35
36 /// \brief Converts resource entity property to resource type.
37 /// \param[in] resource_property Resource entity property to convert.
38 /// \return Resource type (a RESOURCE_* constant).
39 int GetResourceType(.float resource_property);
40
41 /// \brief Converts resource type (a RESOURCE_* constant) to entity property.
42 /// \param[in] resource_type Type of the resource.
43 /// \return Entity proprty for that resource.
44 .float GetResourceProperty(int resource_type);