3 /// \brief Unconditional maximum amount of resources the player can have.
4 const int RESOURCE_AMOUNT_HARD_LIMIT = 999;
6 /// \brief Describes the available resource types.
9 RESOURCE_HEALTH = 1, ///< 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).
19 // ============================ Public API ====================================
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);
27 /// \brief Returns the current amount of resource the given entity has.
28 /// \param[in] e Entity to check.
29 /// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
30 /// \return Current amount of resource the given entity has.
31 float GetResourceAmount(entity e, int resource_type);
33 /// \brief Gives an entity some resource.
34 /// \param[in,out] receiver Entity to give resource to.
35 /// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
36 /// \param[in] amount Amount of resource to give.
37 /// \return No return.
38 void GiveResource(entity receiver, int resource_type, float amount);
40 // ===================== Legacy and/or internal API ===========================
42 /// \brief Converts an entity field to resource type.
43 /// \param[in] resource_field Entity field to convert.
44 /// \return Resource type (a RESOURCE_* constant).
45 int GetResourceType(.float resource_field);
47 /// \brief Converts resource type (a RESOURCE_* constant) to entity field.
48 /// \param[in] resource_type Type of the resource.
49 /// \return Entity field for that resource.
50 .float GetResourceField(int resource_type);