]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/resources.qh
Clear out .health and .armorvalue from the client side
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / 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.qh>
8
9 /// \brief Unconditional maximum amount of resources the entity can have.
10 const int RESOURCE_AMOUNT_HARD_LIMIT = 999;
11
12 // ============================ Public API ====================================
13
14 /// \brief Returns the current amount of resource the given entity has.
15 /// \param[in] e Entity to check.
16 /// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
17 /// \return Current amount of resource the given entity has.
18 float GetResourceAmount(entity e, int resource_type);
19
20 /// \brief Sets the resource amount of an entity without calling any hooks.
21 /// \param[in,out] e Entity to adjust.
22 /// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
23 /// \param[in] amount Amount of resource to set.
24 /// \return Boolean for whether the ammo amount was changed
25 bool SetResourceAmountExplicit(entity e, int resource_type, float amount);
26
27 /// \brief Sets the current amount of resource the given entity will have.
28 /// \param[in,out] e Entity to adjust.
29 /// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
30 /// \param[in] amount Amount of resource to set.
31 /// \return No return.
32 void SetResourceAmount(entity e, int resource_type, float amount);
33
34 // ===================== Legacy and/or internal API ===========================
35
36 /// \brief Converts an entity field to resource type.
37 /// \param[in] resource_field Entity field to convert.
38 /// \return Resource type (a RESOURCE_* constant).
39 int GetResourceType(.float resource_field);
40
41 /// \brief Converts resource type (a RESOURCE_* constant) to entity field.
42 /// \param[in] resource_type Type of the resource.
43 /// \return Entity field for that resource.
44 .float GetResourceField(int resource_type);